[Dovecot] Best way to get login protocol (pop3/imap) in post-login script
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?
Currently, i wrote shell script as post-login script, and use below
command to get protocol:
$(basename ${MAIL_PLUGIN_DIR})
But is it the best way to get it?
Thanks very much. :)
-- Best Regards.
Zhang Huangbin
- Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu:
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.
On Aug 3, 2009, at 9:47 AM, Timo Sirainen wrote:
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 }
It works with above setting. Thanks Timo :)
-- Best Regards.
Zhang Huangbin
- Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu:
participants (2)
-
Timo Sirainen
-
Zhang Huangbin