On Sun, 2009-08-02 at 10:51 +0800, Zhang Huangbin wrote:
Hi, all.
I found doc here: http://wiki.dovecot.org/PostLoginScripting and use ${USER}, ${IP} to track last-login username and remote ip
address, but how can i track the mail protocol it used? like pop3,
pop3s, imap, imaps?
How about giving the imap or pop3 as parameter? You're already modifying mail_executable, so:
protocol imap { mail_executable = script.sh imap } protocol pop3 { mail_executable = script.sh pop3 }
As for separating imap from imaps.. What about STARTTLS? If you just want to know if SSL/TLS was used vs. not used, then.. Well, that information is kind of lost already at that point. Although you could have your userdb return an extra field with that state.
For example let's say you're using static userdb, you can use:
userdb static { args = ... secured=%c }
And then you'll have "SECURED=secured" environment. Although %c also returns "secured" with localhost connections. http://wiki.dovecot.org/Variables
The same way you could also set service=%s to avoid giving the imap/pop3 parameter.