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. For example, on my system I can look at the timestamps on the 'new' folders in the user's maildir to see if they are getting mail, and if the folders are empty, I have a time stamp of when they last checked that mailbox, giving me a pretty accurate time for when they last logged in. For example, looking at one user: # ls -lsdtr /path/to/user/maildir/{new,.**/new} I can see that the most recent "new" mailboxes were accessed on 02 Mar 14:25 and 03 Mar 01:45, and I can see that the latter mailbox has files in it and the former mailbox does not (just by the size, without doing an extra ls of those directories), so I know that the last time the user logged in was about 14:25 or later yesterday and that they definitely have not logged in in the last 3h05, which seems close enough to me. Am I missing some reason I would need/want to keep track of that specific login time separately? -- 'But you ain't part of it, are you?' said Granny conversationally. 'You try, but you always find yourself watchin' yourself watchin' people, eh? Never quite believin' anything? Thinkin' the wrong thoughts?'
Le 3/3/21 ? 12:57 PM, @lbutlr a ?crit?:> 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. > > For example, on my system I can look at the timestamps on the 'new' folders in the user's maildir to see if they are getting mail, and if the folders are empty, I have a time stamp of when they last checked that mailbox, giving me a pretty accurate time for when they last logged in. > > For example, looking at one user: > > # ls -lsdtr /path/to/user/maildir/{new,.**/new} > > I can see that the most recent "new" mailboxes were accessed on 02 Mar 14:25 and 03 Mar 01:45, and I can see that the latter mailbox has files in it and the former mailbox does not (just by the size, without doing an extra ls of those directories), so I know that the last time the user logged in was about 14:25 or later yesterday and that they definitely have not logged in in the last 3h05, which seems close enough to me. > > Am I missing some reason I would need/want to keep track of that specific login time separately? >What about mbox files ? -- Yassine.
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>