I have Dovecot 1.2.12 running on Ubuntu Server 10.10 and I'm trying to get a post-login script to log the date and time that the users access their IMAP mailbox. I've read the Dovecot wiki and added the following to dovecot.conf:
mail_executable: /usr/lib/dovecot/logon.sh /usr/lib/dovecot/imap
The logon.sh script is pretty basic (logging all user access to a single file, plus the touch method given by the wiki):
#!/bin/sh dt=$(date) echo $USER $dt >> /opt/logon touch ~/.last_login
With the mail_executable line as above, the script runs successfully when a user attempts to log in, but access to the IMAP server fails (clients are Roundcube webmail running on the same box, and MS Outlook). /var/log/mail.log isn't very revealing. The login is logged normally and then nothing follows it:
dovecot: imap-login: Login: user=<username>, method=PLAIN, rip=172.16.2.26, lip=172.16.2.26, secured
Putting the script after the IMAP executable, like this:
mail_executable: /usr/lib/dovecot/imap /usr/lib/dovecot/logon.sh
results in normal IMAP functionality, but the script doesn't run.
Output of dovecot -n:
# 1.2.12: /etc/dovecot/dovecot.conf # OS: Linux 2.6.35-32-server x86_64 Ubuntu 10.10 ext4 log_timestamp: %Y-%m-%d %H:%M:%S disable_plaintext_auth: no login_dir: /var/run/dovecot/login login_executable: /usr/lib/dovecot/imap-login mail_privileged_group: mail mail_location: maildir:/home/%u/Maildir mail_debug: yes mbox_write_locks: fcntl dotlock mail_executable: /usr/lib/dovecot/logon.sh /usr/lib/dovecot/imap auth default: passdb: driver: pam userdb: driver: passwd
I feel like I'm missing something obvious here. Please help! Thanks in advance.