Postfix w/ Maildrop
Postfix_w/o_Maildrop gives a working setup sans Maildrop - following that should give a working mail server, and Maildrop doesn't leave any cruft behind in the process.
Contents |
Maildrop
apt-get install maildrop
At time of writing, the maildrop package in unstable is affected by bug #459545 maildrop: Tries to overwrite /usr/bin/makedat, which is also supplied by courier-base. Install maildrop from testing, and install it before Courier.
Configuration
Postfix
master.cf
/etc/postfix/master.cf should contain:
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
main.cf
/etc/postfix/main.cf should contain (among other things):
virtual_transport = maildrop
User tables
The records in the database have to be changed to make Postfix use maildrop as opposed to delivering the mail itself.
update postfix_transport set destination="maildrop:";
Maildrop
Useful reading for writing Maildrop filter files: maildropfilter man page
To make sure maildirs are created for new users, add to /etc/courier/maildroprc:
# Global maildrop filter file
# Uncomment this line to make maildrop default to ~/Maildir for
# delivery- this is where courier-imap (amongst others) will look.
#DEFAULT="$HOME/Maildir"
SHELL="/bin/bash"
logfile "/var/log/maildrop"
VERBOSE="5"
log "========"
MAILDIR = "$DEFAULT"
`test -f $MAILDIR/.forward`
if ($RETURNCODE == 0 )
{
include "$MAILDIR/.forward"
}
`test -e $MAILDIR`
if ( $RETURNCODE != 0 )
{
`/usr/bin/maildirmake $MAILDIR`
`chmod -R 0700 $MAILDIR`
}
Testing for a .forward file, and including it if it exists, lets individual virtual users set maildrop rules.
Issues
Log file
If the log file specified in the maildroprc isn't created, or maildrop doesn't have the permissions to access it, this will appear in the logs:
status=deferred (temporary failure. Command output: /usr/bin/maildrop: Unable to create log file. )
Authdaemon
It looks like if the changes to authdaemon made before are reverted, Maildrop also gets broken, with the effect that messages get bounced:
status=bounced (user unknown. Command output: ERR: authdaemon: s_connect() failed: Permission denied Invalid user specified. )
Evidently this is a bad thing.