last_login plugin with MySQL

Luigi Rosa lists at luigirosa.com
Sat Oct 18 14:37:01 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gedalya wrote on 18/10/2014 16:10:

> I guess you have to use the proxy.
> 
> So maybe something like
> 
> plugin { last_login_dict = proxy::lastlogin }
> 
> dict { lastlogin = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext }
> 
> I'll try it later myself, thanks for taking it thus far :-) I've been
> meaning to try this out but was rather perplexed.

I made some progress thank to your suggestions.

dovecot-dict-sql.conf.ext content is:

map {
  pattern = /shared/last-login/$user
  table = mailbox
  username_field = username
  value_field = lastlogin
  fields {
    username = $user
  }
}

Note that you must not specify "driver" parameter


Plugin is defined this way:


plugin {
  last_login_dict = proxy::lastlogin
  last_login_key = last-login/%u # default
}

dict {
  lastlogin = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
  mode = 0660
  user = 501
}


But I get two errors.


First is the permission of /var/run/dovecot/dict that is 700 root.root and I
get a permission error. Nothing changes if I put user = root. I have to
manually chmod /var/run/dovecot/dict every time I restart Dovecot otherwise I get

Error: net_connect_unix(/var/run/dovecot//dict) failed: Permission denied
(euid=501(mailvirtuale) egid=501(mailvirtuale) missing +r perm:
/var/run/dovecot//dict, dir owned by 0:0 mode=0755)

If I chmod 777 /var/run/dovecot/dict the error disappears but I get this:

dovecot: imap-login: Login: user=<username>, method=PLAIN, rip=127.0.0.1,
lip=127.0.0.1, mpid=497913, secured, session=<6R0mYbMFFwB/AAAB>
dovecot: dict: Error: sql dict set: Invalid/unmapped key:
shared/last-login/username



Ciao,
luigi

- -- 
/
+--[Luigi Rosa]--
\

Don't tell me what you dreamed last night for I've been reading Freud.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUQnsNAAoJEO5WT/qgw4yKPgsP/i3PvHmaHZ3FTyDkXczenVm+
12dA5MHQ7p26Xai7C3hJeLn/mteZUqc7aEM839nB6vFo+nPBJYjPgVB7k24eSq4T
ZV/F3RZV+I4f1oTvzxH8gKvFnXEEbGSXsM7/U+anSdbNVMEPfpZDxgf/DKJfCk61
NBJN+n9bqQ4ZhaN6UD9AGh5w3Oyh4GK40D7Xv6NVca+psMjuT17TKgZ1JaMg7Ir0
QV4f3wmCWfMFGIpxUvUca7UTENYWHkdfLqsWjDU8+tLM7meuJ3PKMasuOKTNMglY
8PyszRGPCBfPvoQluC0K7uXqlEMLpXEmdz354chilXYX4T7zUh+9IHV4MSg1SSQX
B7HMrTOU5TY7HfqzHOtLrb4CVtj6thzl9Ixh7Qa13LDbjzqSI5Pe78nVcmfVqp8I
Wqovm+XWqm6nUoNFh850iw57t15D6Pg+vZT/qJBT8o++lcA+ssriNsFHw8/nFqSV
qe7Oxifhrn7j4KRdBlK8gKiydhxFT//bIdlS2bOwPi+nnkcnT7xT46L1WZVfhQez
hYTxAK9ETKonT4O2IKSSn92fxqEobZu99Kom5sRm4uLsvQxdOwjKPJn0Bx00XCW1
vCp1/gmFYkLPAtB/hQ0U32WpL1x/GMKRd6BZXsHQMDgVkf4dVQqB23oUiugl/whE
U5s4Dr/5WbmNITXOd0/W
=LFZi
-----END PGP SIGNATURE-----


More information about the dovecot mailing list