1

Topic: [FAQ] How to track user last login data (ip, date, mail protocol).

This tutorial is used to explain how to translate iRedAdmin to your language. If they don't work for you, please post a new topic in our iRedAdmin support forum.

How to Track User Last Login Date and IP Address

=================================================

WARNING

Tracking operation MAY cause PERFORMANCE ISSUE on a BUSY server
due to frequently update the SQL database/LDAP directory server, AND
roundcube webmail will automatic check users' mailbox via IMAP protocol
frequently.

Requirements

This tutorial is written for Dovecot-1.x. If you have Dovecot-2.x running, please refer to official tutorial.

Modify dovecot.conf, add 'mail_executable' in protocol imap and/or pop3
    protocol imap {
        mail_drop_priv_before_exec=yes
        mail_executable = /usr/bin/trackLastLogin.sh imap
        ...
    }

    protocol pop3 {
        mail_drop_priv_before_exec=yes
        mail_executable = /usr/bin/trackLastLogin.sh pop3
        ...
    }
Download samples/trackLastLogin.sh, copy to /usr/bin/trackLastLogin.sh, set correct owner and permission.
# wget http://iredmail.googlecode.com/hg/extra/trackLastLogin.sh
# mv -i trackLastLogin.sh /usr/bin/
# chown root:root /usr/bin/trackLastLogin.sh
# chmod 0755 /usr/bin/trackLastLogin.sh
Open /usr/bin/trackLastLogin.sh, choose your preferred update method.

Currently, it supports updating user last login data to plain text, MySQL database and OpenLDAP directory server.

  • For plain text, user 'dovecot' must have write privilege on the log file.

  • For MySQL database, you must specify correct mysql user and password, this mysql user should have SELECT and UPDATE privilege.

  • For LDAP server, you must specify correct URI, bind dn and password, this bind dn should have write privilege.

Reference

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.