Why Last-login?

Greg Wildman gregw at itns.co.za
Thu Mar 4 11:00:31 EET 2021


On Wed, 2021-03-03 at 04:57 -0700, @lbutlr wrote:
> I've noticed several threads over the last year or so about last-
> login, and I was curious WHY people care about tracking this in the
> database. I can see wanting to know if a user has logged in recently,
> but this seems quite easy to tell by simply looking at the time stamp
> and/or contents of the mail spool for the user.

<snip>

> Am I missing some reason I would need/want to keep track of that
> specific login time separately?

I keep the last login details in a database for support/reporting
tools. Support staff can get at this information without system access.
I track the last login timestamp for imap, pop3, lmtp and sieve
seperately. Again for support and reporting reasons. I also have local
tools that interrogate the DB when I am doing my admin thing on the
server.

Current dovecot last_login config ('X' used to replace private data)

-----------------------------------------------------------------------
  connect = host=XXXXX dbname=XXXXX user=XXXXXX password=XXXXXX

  # Remote connections
  map {
      pattern = shared/last-login/$service/$user/$rip
      table = mail_stats
      value_field = last_login
      value_type = uint
      fields {
          mailbox = $user
          remote_ip = $rip
          protocol = $service
     } 
  }

  # Local conections, no remote IP
  map {
      pattern = shared/last-login/$service/$user/
      table = mail_stats
      value_field = last_login
      value_type = uint
      fields {
          mailbox = $user
          protocol = $service
      }
  }
-----------------------------------------------------------------------


E.g. inspecting a mailbox config ('X' used to replace private data)

             Mailbox :   xx003 at XXXXXXX.co.za                                                                        
             Created :   2020-08-18 17:45:34                                                                       
         Description :   XXXX XXXXXXXXX                                                                                
               Quota :   8G, used 6.3 GiB (78%)                                                                    
          SMTP Limit :   100 per hour                                                                              
                                                                                                                   
           Addresses :   xxxxxxxxx, xxxxxxx, xxxxxx                                                                 
                                                                                                                   
    Can receive mail :   YES                                                                                       
       Can send mail :   YES                                                                                       
   Can download mail :   YES                                                                                       
     Can filter mail :   YES                                                                                       
      Has IM account :   NO                                                                                        
            Catchall :   NO                                                                                        
                                                                                                                   
       Last Modified :   2020-08-18 19:46:12                                                                       
           Last IMAP :   2021-03-04 10:52:03                                                                       
           Last POP3 :   None                                                                                      
       Last Delivery :   2021-03-04 10:26:49                                                                       
                                                                                                                   
                Home :   /srv/hosting/xxxxx/xxxxx/xxxxxx.co.za/mail/xx003                                        
                                                                                                                   
         Sieve rules :   roundcube ACTIVE                                                                          
                         Default                                                                                   
 



-- 
Greg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://dovecot.org/pipermail/dovecot/attachments/20210304/a3a3bf60/attachment.sig>


More information about the dovecot mailing list