[Dovecot] v2.0 post-login scripts

Timo Sirainen tss at iki.fi
Sat Dec 12 02:35:24 EET 2009


Post-login scripts work a bit differently in v2.0, because the old way
just couldn't work anymore. I suppose at some point I should fork the
wiki to v1.x and v2.x and start writing these things there, but for now
I'll just write it here:

First you'll need to tell imap service that it should connect to
postlogin service:

service imap {
  executable = imap imap-postlogin
}

Then you'll need the imap-postlogin service:

# The service name below doesn't actually matter.
service imap-postlogin {
  executable = script rawlog /tmp/test.sh
  unix_listener imap-postlogin {
  }
}

The "script" executable does all the magic. If you want multiple
scripts, just make them a chain, like above script first executes
rawlog, and rawlog then executes /tmp/test.sh:

#!/bin/sh

echo "* OK Hello $USER ($IP -> $LOCAL_IP)"
export MAIL=maildir:/tmp/test
export USERDB_KEYS="$USERDB_KEYS mail"

exec $*

So it's pretty similar to how it works before, except now you'll also
need to update $USERDB_KEYS to contain all environments that you want to
pass to imap process.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20091211/8c036c69/attachment.bin 


More information about the dovecot mailing list