Koozali.org: home of the SME Server

Custom Template Help

Offline grattman

  • ****
  • 122
  • +0/-0
Custom Template Help
« on: September 17, 2007, 03:02:38 PM »
Hey all,

I need some advice on how to do some things correctly. I am trying to deny certain users the ability to send/receive email on our system. Using this post:
http://forums.contribs.org/index.php?topic=36897.msg164619#msg164619

I am having problems getting the fragment to work. First off...some questions...

1) Do I need to copy the existing template, such as /var/qmail/control/badmailfrom to the /etc/e-smith/templates-custom/var/qmail/control/badmailfrom directory?

2) If not, is there a protocol in naming the custom template you are making? Fro instance 44Something?

So I have a 44badmailfrom fragment in /etc/e-smith/templates-custom/var/qmail/control/badmailfrom that contains only one address for now.

When I try to expand the template using /sbin/e-smith/expand-template /etc/e-smith/templates-custom/var/qmail/control/badmailfrom/44badmailfrom I get the following error:

ERROR: No templates were found for /etc/e-smith/templates-custom/var/qmail/control/badmailfrom/44badmailfrom.
 at /sbin/e-smith/expand-template line 45



Next question....

I had another thread about doing the netlogon.bat thing, but no answer I figured I could accomplish the same thing by updating the smb.conf file.

I would like to replace this portion of the smb.conf:

log file = /var/log/samba/log.%m
logon drive = Z:
logon home = \\%L\%U\._winprofile
logon path = \\%L\Profiles\%U
logon script = netlogon.bat

The goal is to have the users (who already have accounts on another machine) have their home logon drive mount a different server. So say I have \\server1\user\home as the path currently, I want them to map \\server2\user\home as their logon drive. What is the best way to accomplish this? I figured altering the smb.conf through a template, but I want to make sure I am doing it right, and from my question 1, some how I don't seem to know what the hell I am doing with expanding templates.

I have searched for a definitive expanding template tutorial, but I cannot find one. I have tried to hodgepodge several threads together to attempt the qmail change...to no avail.

Thanks for your help in advance,
Grattman
...

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Custom Template Help
« Reply #1 on: September 17, 2007, 03:21:23 PM »

1) Do I need to copy the existing template, such as /var/qmail/control/badmailfrom to the /etc/e-smith/templates-custom/var/qmail/control/badmailfrom directory?

yes

Quote
2) If not, is there a protocol in naming the custom template you are making? Fro instance 44Something?

fragments are evaluated in alphabetical order

Quote
When I try to expand the template using /sbin/e-smith/expand-template /etc/e-smith/templates-custom/var/qmail/control/badmailfrom/44badmailfrom I get the following error:

ERROR: No templates were found for /etc/e-smith/templates-custom/var/qmail/control/badmailfrom/44badmailfrom.
 at /sbin/e-smith/expand-template line 45


you have to expand the configuration file, not the fragment

try
Code: [Select]
expand-template /var/qmail/control/badmailfrom


Quote
I would like to replace this portion of the smb.conf:

log file = /var/log/samba/log.%m
logon drive = Z:
logon home = \\%L\%U\._winprofile
logon path = \\%L\Profiles\%U
logon script = netlogon.bat

find the right template (matbe they are more than one) and modify it according to your needs.

Everything abount sme's templating, please read the developers manual/codumentation

HTH

Ciao

Stefano

Offline grattman

  • ****
  • 122
  • +0/-0
Re: Custom Template Help
« Reply #2 on: September 17, 2007, 03:52:38 PM »
Stefano,

Thank you for your quick response. I know that everything is about templating in SME, keeps people like me from making HUGE mistakes. I see the error in my way..trying to exapnd the fragment instead of the template. It worked fine....now I just have to add 600 users to it.

Quote
find the right template (matbe they are more than one) and modify it according to your needs.

I know which template to work with...I guess in a nutshell I am asking, can I replace the \\%L with \\server2?

Grattman
...

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Custom Template Help
« Reply #3 on: September 17, 2007, 03:57:58 PM »

I know which template to work with...I guess in a nutshell I am asking, can I replace the \\%L with \\server2?


I think so.. naturally, you must be sure "server2" will not change name :-)

Ciao

Stefano

Offline grattman

  • ****
  • 122
  • +0/-0
Re: Custom Template Help
« Reply #4 on: September 17, 2007, 05:40:33 PM »
After tooling around...this did not work. Does anyone know where the %L is defined? I have poked through most of the templates in smb.conf directory and have not come across it. Obviously it is server-level, so I am assuming I am attempting something that is a) much more difficult than I figured, or b) not possible.

Any help is greatly appreciated,
Grattman
...

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Custom Template Help
« Reply #5 on: September 17, 2007, 09:59:09 PM »
After tooling around...this did not work. Does anyone know where the %L is defined?
Yes it is a samba template or macro and automatically expands to the netbios name of your server (http://us1.samba.org/samba/docs/man/manpages-3/smb.conf.5.html). See the Variable Substitution for all parameters.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)