ZhangHuangbin wrote:RajeshM wrote:I have already enable this and getting output in database, but need same output in iredmail admin panel too just like last login columns shows in admin panel.
Would you mind sharing the detailed configuration? so that i can reproduce it and integrate it in iRedMail first, then iRedAdmin-Pro.
btw, are you sure the IP address get updated for each login? I failed to achieve this, because Dovecot updates only the last login TIME and ignore the last login IP address. I doubt you get this fixed.
Hi,
Following are the details
Dovecot config as below
################################################
protocol imap {
# Append plugin name `last_login` here
mail_plugins = last_login
}
protocol pop3 {
# Append plugin name `last_login` here
mail_plugins = last_login
}
dict {
# Add this line. For FreeBSD, please replace the path by
# /usr/local/etc/dovecot/dovecot-last-login.conf
lastlogin = mysql:/etc/dovecot/dovecot-last-login.conf
}
plugin {
# Add 2 lines
last_login_dict = proxy::lastlogin
last_login_key = last-login/%s/%u/%d/%r/%l
}
##################################################
SQL statement:
################################################
CREATE TABLE IF NOT EXISTS `last_login` (
`username` VARCHAR(255) NOT NULL DEFAULT '',
`domain` VARCHAR(255) NOT NULL DEFAULT '',
`ip` varchar(40) NOT NULL DEFAULT '',
`imap` INT(11) DEFAULT NULL,
`pop3` INT(11) DEFAULT NULL,
`lda` INT(11) DEFAULT NULL,
PRIMARY KEY (`username`),
INDEX (`domain`),
INDEX (`ip`),
INDEX (`imap`),
INDEX (`pop3`),
INDEX (`lda`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
################################################
/etc/dovecot/dovecot-last-login.conf file content
#################################################
connect = host=127.0.0.1 port=3306 dbname=vmail user=vmailadmin password=my_secret_password
map {
pattern = shared/last-login/imap/$user/$domain/$ip
table = last_login
value_field = imap
value_type = uint
fields {
username = $user
domain = $domain
ip = $ip
}
}
map {
pattern = shared/last-login/pop3/$user/$domain/$ip
table = last_login
value_field = pop3
value_type = uint
fields {
username = $user
domain = $domain
ip = $ip
}
}
# If you want to track the time of last email delivered to mailbox via LDA,
# please enable `last_login` plugin in the `protocol lda {}` block in dovecot.conf.
#map {
# pattern = shared/last-login/lda/$user/$domain/$ip
# table = last_login
# value_field = lda
# value_type = uint
#
# fields {
# username = $user
# domain = $domain
# ip = $ip
# }
#}
# If you want to track the time of last email delivered to mailbox via LMTP,
# please enable `last_login` plugin in the `protocol lmtp {}` block in dovecot.conf.
# We treat lmtp as lda, store the time in sql column `lda`.
#map {
# pattern = shared/last-login/lmtp/$user/$domain/$ip
# table = last_login
# value_field = lda
# value_type = uint
#
# fields {
# username = $user
# domain = $domain
# ip = $ip
# }
#}
#################################################
db screenshot attach for reference
Thanks,
Sunil
Post's attachmentsUntitled-1.png
Untitled-1.png 14.25 kb, 1 downloads since 2020-08-19
You don't have the permssions to download the attachments of this post.