[Dovecot] Last login datetime on accounts
I have searching for the best way to tell if a Dovecot user is idle by finding the last time they have logged in.
Right now the best way I can tell is to do something like "touch" a file in the users homedir via a post login exec.
This seems like a LOT of overhead, to accomplish such a simple task, especially if your doing a lot of dozens of logins per second. Is there an easier/better way? Is there a way to possibly tell Dovecot to refresh the mod time on an index file whenever the user successfully auths or to refresh a separate file in the homedir, ie: ~/.lastlogin (not ~/Maildir/.lastlogin as that would obviously cause some issues)
Seems like something that would be far less overhead than calling a shell, execing another command, etc.
I'm open to other ideas/alternatives if they are out there!
TIA
-- Robert Blayzor INOC, LLC rblayzor@inoc.net http://www.inoc.net/~rblayzor/
Am 16.07.2012 01:31, schrieb Robert Blayzor:
I have searching for the best way to tell if a Dovecot user is idle by finding the last time they have logged in.
Right now the best way I can tell is to do something like "touch" a file in the users homedir via a post login exec.
This seems like a LOT of overhead, to accomplish such a simple task, especially if your doing a lot of dozens of logins per second. Is there an easier/better way? Is there a way to possibly tell Dovecot to refresh the mod time on an index file whenever the user successfully auths or to refresh a separate file in the homedir, ie: ~/.lastlogin (not ~/Maildir/.lastlogin as that would obviously cause some issues)
Seems like something that would be far less overhead than calling a shell, execing another command, etc.
I'm open to other ideas/alternatives if they are out there!
TIA
i have running touch with 3000 users, i dont see much overhead, anyway its true ,its not very elegant, perhaps i.e you may write some daily cron bash find script looking about latest timestamp of files in .new with maildir which of cource is not the same as last_login script, but may good enough for you
-- Best Regards MfG Robert Schetterer
On 2012-07-16 2:45 AM, Robert Schetterer robert@schetterer.org wrote:
i have running touch with 3000 users, i dont see much overhead, anyway its true ,its not very elegant, perhaps i.e you may write some daily cron bash find script looking about latest timestamp of files in .new with maildir which of cource is not the same as last_login script, but may good enough for you
Why not a simple post-login script that updates your userDB?
http://wiki2.dovecot.org/PostLoginScripting
--
Best regards,
Charles
Am 16.07.2012 12:48, schrieb Charles Marcus:
On 2012-07-16 2:45 AM, Robert Schetterer robert@schetterer.org wrote:
i have running touch with 3000 users, i dont see much overhead, anyway its true ,its not very elegant, perhaps i.e you may write some daily cron bash find script looking about latest timestamp of files in .new with maildir which of cource is not the same as last_login script, but may good enough for you
Why not a simple post-login script that updates your userDB?
i may fail, but in the orig question PostLoginScripting is allready used but with touch a last_login file so update some db with same mech may not much better i thought some other way then PostLoginScripting was searched for
-- Best Regards MfG Robert Schetterer
On 16/07/2012 12:01, Robert Schetterer wrote:
Am 16.07.2012 12:48, schrieb Charles Marcus:
On 2012-07-16 2:45 AM, Robert Schetterer robert@schetterer.org wrote:
i have running touch with 3000 users, i dont see much overhead, anyway its true ,its not very elegant, perhaps i.e you may write some daily cron bash find script looking about latest timestamp of files in .new with maildir which of cource is not the same as last_login script, but may good enough for you Why not a simple post-login script that updates your userDB?
i may fail, but in the orig question PostLoginScripting is allready used but with touch a last_login file so update some db with same mech may not much better i thought some other way then PostLoginScripting was searched for
I have a similar desire, I would also like to log "logout" time. I think for lowest load you would want postloginscript to talk to some long running daemon process, which in turn caches logins and does sensible batching of updates.
Timo commented that a plugin would be a good way to do all of the above:
http://dovecot.org/patches/2.2/imap-logout-plugin.c
I haven't had capacity to build anything yet...
Cheers
E dW
participants (4)
-
Charles Marcus
-
Ed W
-
Robert Blayzor
-
Robert Schetterer