Recap: last_login plugin with MySQL
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
With many thanks to Gedalya and Sven Hartge
Situation: Dovecot installation with userbase in a MySQL table with the same structure described in Postfix.Admin installation; filesystem permission is flat with a single user (vmail) who owns maildir mailbox files and directories.
Procedure to implement last-login plugin to update mailbox table. The lastlogin value is an integer in time() format
Alter mailbox SQL table to add a lastlogin
unsigned int field
Add this to 10-master.conf
service dict { unix_listener dict { mode = 0660 user = vmail } }
In 90-plugin.conf add this:
plugin { last_login_dict = proxy::lastlogin last_login_key = last-login/%u # default }
dict { lastlogin = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext }
Enable last login for IMAP and POP3:
protocol imap { mail_plugins = $mail_plugins last_login }
protocol pop3 { mail_plugins = $mail_plugins last_login }
Finally edit dovecot-dict-sql.conf.ext and add this lines:
connect = {same values as dovecot-sql.conf.ext} map { pattern = shared/last-login/$user table = mailbox username_field = username value_field = lastlogin fields { username = $user } }
Ciao, luigi
/ +--[Luigi Rosa]-- \
After things have gone from bad to worse, the cycle will repeat itself. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1
iQIcBAEBAgAGBQJUQp/PAAoJEO5WT/qgw4yKLscP/1ysmNOP23fQeqN2I7gxfhKp 4TF0Buf0rxKjxzjE5jcw4T/vDKhdjj2uaYtpUkE188l+tmGdeQ55ENyXEml/Svvw eEs9Kc2UJTlSQpQFpspUezvOtPwgb0L3720rCqs61BshGFgpZsiUEpPW8mHeVoo1 j5zmo9TVdrSPr8XqLzoR+fdIamZRzZH2pLA9x9cgzsVMmqSlMm4Xv3f/JMloNs98 fwWo13Ji5uFCRbbMmNUDCDOpd4wPYZ7ASS64Jf9nR4DZ75fnQmRgvsbl3EWicrqT 94Z4hlSEkOYWxDzooFta37+Sp61IjQWkWFiM+0260Q5u8IArpatW+tT2eD3jzaxP Gu0HB8jg+bT9cXXtfo1HyA+JYswEtwKiUvUKa/09j6oDGgBD2KR1yhDJNsZsJXkB bEKsACdSztEvfe9j91AzW8S/W3Uk5c7l9RH1CXVNTCbQXaeagScAguh94KKP0oiW P43mBkuFg2mM+5+bXz0U8EYfswt/zYkp/pKFajEwyXIWdeUICPmFJA+GKpBXeJPn CL8nJCnUpKNsy85+Z6MXYXIv6a0D0utocdsQzR8gjG2whNnv7EFeHa2hyagKfG5g ydOSG6tKlWHCOSFaTogmUVZVXEGsE1gUmJZMeoyZVI5jEl3b3KJSTxB7QHtMsm5q NOyZ+PdNJtyDC8n4T48t =MJj6 -----END PGP SIGNATURE-----
participants (1)
-
Luigi Rosa