Hello, I think Tom wants to integrate said feature to make mail system more user-friendly.
There is an option of parsing log file, which (despite what Tom says) is quite real-time. With this option what is not real-time is the response. Typically too many login failures cause system to block the IP, but probably Tom wants to display a user-friendly message, something like "too many login failures, please come back in 15 minutes". Therefore, creating real-time analysis is not problematic and can be done with tailing log files. Crafting the response based on that analysis is more tricky. Tom, maybe you should look into making custom milter instead of hacking Postfix itself. Loose coupling FTW. b. On 27 January 2015 at 17:36, k...@rice.edu <k...@rice.edu> wrote: > On Tue, Jan 27, 2015 at 05:26:35PM +0100, Peter Hodur wrote: > > On Tuesday, January 27, 2015, Wietse Venema <wie...@porcupine.org> > wrote: > > > > > > > > > This is typically done with "enable_long_queue_ids = yes", a program > > > that watches the maillog file, and a collection of regular expressions > > > that extract information. > > > > > > > > Thank you for tour reply. I know this option and i use it. But i do not > > want to parse log file. This will introduce some delay in processing and > > decision based on logged data. (For example, i want to monitor 5xx > response > > ratio on individual sasl user names and block users in realtime - many > 5xx > > errors is obviously indicator, that user send spam messages, so i can > route > > it to another smtp client process with dedicate ip and/or block it) > > > > Instead i want to hook some function in postfix (may be function which > > flushes records to log file?) and add couple of lines of code that > connect > > to redis database and puts there some statistics. > > > > So i ask here, if someone with knowledge of postfix internals can tell > me, > > what is the right place to add this code. What "function" to hook... I > have > > read som source code of postfix and im not sure im able to identify right > > place to add my logging code) > > > > > > Thanks > > > > Tom > > Hi Tom, > > It sounds like you need to integrate with your log system and not postfix. > Have it send the needed logs to the service/file/port of your choice. This > is not really postfix specific. > > Regards, > Ken >