LastLogin update

Júlio Covolato julio at psi.com.br
Mon Jun 24 17:25:18 EEST 2019


Em 22/06/2019 22:41, Zhang Huangbin via dovecot escreveu:
>
>> On Jun 23, 2019, at 4:43 AM, @lbutlr via dovecot <dovecot at dovecot.org> wrote:
>>
>>> https://docs.iredmail.org/track.user.last.login.html
>> This is cool, but I have a question:
>>
>>> For MySQL/MariaDB backends, we create the sql table in database vmail.
>> Would this interfere with or confuse postfixadmin? I use that so that users can update their own passwords and domain admins can add users and aliases.
> The document is for iRedMail, it supports storing mail accounts in SQL or OpenLDAP, that's why the document mentions the difference.
> You're free to use any database on your own mail server.
>
> ----
> Zhang Huangbin, founder of iRedMail project: https://www.iredmail.org/

What I did:

#$ cat dovecot-last-login.conf

connect = host=127.0.0.1 port=3306 dbname=vmail user=vmailadmin 
password=xxxxxxxxxxxxxxx

map {
     pattern = shared/last-login/$user/$domain/$rip/$service
     table = last_login
     value_field = last_login
     value_type = uint

     fields {
         username = $user
         domain = $domain
         rip = $rip
         proto = $service
     }
}

------------------------------------------------------

dovecot.conf:

plugin {

...

...

     # Track last login time on imap and pop3
     last_login_dict = proxy::lastlogin
     last_login_key = last-login/%u/%d/%r/%s
}

Result on mysql:

mysql> select * from last_login where username = 'julio at xxx.com.br';
+------------------+------------+------------+---------------+-------+
| username         | domain     | last_login | rip           | proto |
+------------------+------------+------------+---------------+-------+
| julio at xxx.com.br | xxx.com.br | 1559921589 | 177.xxx.xxx.230 | imap  |
+------------------+------------+------------+---------------+-------+
1 row in set (0.00 sec)


----------------------------------
     _    Engº Julio Cesar Covolato
    0v0   <julio at psi.com.br>
   /(_)\  F: +55 11 99175-9260
    ^ ^   PSI INTERNET
----------------------------------


---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus



More information about the dovecot mailing list