On 21/02/2012 20:36, Timo Sirainen wrote:
On 21.2.2012, at 16.33, Ed W wrote:
I'm also pleased to see that there is little negative cost in using a proxy... I recently added imap-proxy to our webmail setup because I wanted to log "last login + logout" times. I haven't quite figured out how to best log "logout time" (Timo, any chance of a post logout script? Or perhaps it's possible with the current login scripting?). You could of course grep the logs, but other than that you'd need to write a Dovecot plugin. Luckily it's really simple to write a plugin. Basically:
void postlogout_init(struct module *module) { } void postlogout_deinit(void) { system("/usr/local/bin/dovecot-postlogout.sh"); }
Add a few missing #includes and compile and enable for imap/pop3 and that should be it.
Thanks - that's really obvious and quite interesting. I guess a simple "log" plugin makes sense.
Quick followup question - the logout log file currently logs a bunch of statistics such as mails read/deleted, bytes sent/received. How might I access these from the _deinit context as above? Apologies if this is a RTFM question?
Finally, do you see it feasible to offer a "scriptable" plugin
interface, eg perhaps using some high performance scripting language
such as lua? Such a plugin might itself be simply a standard plugin..?
The motivation being to offer the ability to create plugins to those who
are nervous of using a compiler, and of course to reduce the ability of
a badly written plugin to kill dovecot?
Cheers
Ed W