Em 12/11/2021 14:47, Lefteris Tsintjelis escreveu:
Hi,

I am currently using postfix/dovecot with postfix admin and I track the last login date already by using this:

https://doc.dovecot.org/configuration_manual/lastlogin_plugin/

Besides last login date, I would like to also implement IPv4 and IPv6 last login tracking also and if possible, IP based login checking. Is post-login scripting the best most efficient way to go?

Regards,

Lefteris

Hi,

This is my lastlogin config to track remote ip:

dovecot.conf:

dict {

  lastlogin = mysql:/etc/dovecot/dovecot-last-login.conf
  ....
}

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
    }
}

Mysql table last_login:

+------------+--------------+------+-----+---------+-------+
| Field      | Type         | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| username   | varchar(255) | NO   | PRI |         |       |
| domain     | varchar(255) | NO   | MUL |         |       |
| last_login | int(11)      | YES  | MUL | NULL    |       |
| rip        | varchar(16)  | NO   | MUL |         |       |
| proto      | varchar(10)  | NO   |     | NULL    |       |
+------------+--------------+------+-----+---------+-------+

Hope this help!

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

Reply via email to