Morten Trab wrote:
Hi,
I'm trying to get TMDA running smooth under Courier/Maildrop.
When setting my /etc/tmdarc like this tmda-filter works but tmda-ofmipd doesn't:
import os ... # USERn and HOSTn is set by the .mailfilter file PENDING_DIR = "/home/vmail/%s/%s/Maildir/.tmda/pending/" % (os.environ["HOSTn"],os.environ["USERn"]) PENDING_WHITELIST_APPEND = "/home/vmail/%s/%s/Maildir/.tmda/whitelist" % (os.environ["HOSTn"],os.environ["USERn"]) PENDING_BLACKLIST_APPEND = "/home/vmail/%s/%s/Maildir/.tmda/blacklist" % (os.environ["HOSTn"],os.environ["USERn"]) CONFIRM_APPEND = "/home/vmail/%s/%s/Maildir/.tmda/confirmed" % (os.environ["HOSTn"],os.environ["USERn"]) BARE_APPEND = "/home/vmail/%s/%s/Maildir/.tmda/whitelist" % (os.environ["HOSTn"],os.environ["USERn"])
But when setting the /etc/tmdarc file to this ~ is extracted to be /home/vmail where it ought to be /home/vmail/domain.tld/user EVEN when using the vpopmail-vdir.sh in a slightly modified version:
import os ... PENDING_DIR = os.path.expanduser("~/Maildir/.tmda/pending/") PENDING_WHITELIST_APPEND = os.path.expanduser("~/Maildir/.tmda/whitelist") PENDING_BLACKLIST_APPEND = os.path.expanduser("~/Maildir/.tmda/blacklist") CONFIRM_APPEND = os.path.expanduser("~/Maildir/.tmda/confirmed") BARE_APPEND = os.path.expanduser("~/Maildir/.tmda/whitelist")
My .mailfilter file looks like this:
USERn=$USER HOSTn=$HOST export USERn export HOSTn
exception { xfilter "/usr/bin/tmda-filter -p --vhome-script /usr/bin/vpopmail-vdir.sh $USER $HOST " }
if ($RETURNCODE != 0) { exit }
exception { to "$DEFAULT" }
OK. Looking at tmda-ofmipd's vpopmail support, it works like this:
First off, given the SMTP user-id of the user sending email, it works out the system user-id that owns that domain. I think for vpopmail, all email is handled under one single user-id.
Once tmda-ofmipd has this information, it looks up the home in /etc/passwd of that user. This is what ~ will expand to. This isn't what you want, since ~ will be the same for all users on your system.
However, tmda-ofmip does set the LOGIN environment variable to whatever the SMTP AUTH user ID was. You can use this in your /etc/tmdarc.
I suggest for simplicity that your .mailfilter file just set LOGIN to whatever the user would use for outbound SMTP AUTH. This will then be the same as what tmda-ofmipd will set LOGIN to, which will make /etc/tmdarc work the same in both cases.
If SMTP AUTH credentials will be: user=swarren password=pw
.mailfilter will start with: LOGIN=swarren export LOGIN
Then, in /etc/tmdarc, do this:
login = os.environ['LOGIN'] hostn = some_python_function(login) usern = some_other_python_function(login) # or (hostn, usern) = some_python_function(login) user_home = '/home/vmail/%s/%s' % (hostn, usern) ... PENDING_DIR = user_home + '/Maildir/.tmda/pending/' ...
where some_python_function() could be any Python code. For example, you could shell out to your vuserinfo script and parse its output for example.
-- Stephen Warren, Software Engineer, NVIDIA, Fort Collins, CO [EMAIL PROTECTED] http://www.wwwdotorg.org/pgp.html
signature.asc
Description: OpenPGP digital signature
_____________________________________________ tmda-users mailing list ([email protected]) http://tmda.net/lists/listinfo/tmda-users
