2Grumpy
01-19-2004, 02:37 PM
I dunno about you other guys, but formmail abuse is our #1 cause of spam complaints. So today I finally did a little research and came up with this little jewel for logging ANY and ALL calls to "formmail" (case irrelevant) to a formmail.log in apache (/var/log/httpd/formmail.log on most systems):
LogFormat "%h %l %u %t \"%v %r\" %>s %b" formmaillog
SetEnvIf Request_URI "[F,f][O,o][R,r][M,m][M,m][A,a][I,i][L,l]" formmail
CustomLog logs/formmail.log formmaillog env=formmail
Here's an output from the formmail.log:
24.214.X.X - - [19/Jan/2004:12:24:56 -0600] "dixiesys.com GET /ForMMail.pl HTTP/1.1" 404 286
The most helpful thing is the %v in the LogFormat because this logs _virtual host_ information too so you can quickly see what vhost is getting the request.
Now all I need is a script to monitor formmail.log and alert me on a certain condition, maybe a 5 minute check and alert if more than say, 10 new lines are in the log (obviously this would need tweaking in the real world probably) so that you can catch the formmail crap before it results in XX thousand emails and several spamcop complaints! Actually I'll probably change the log location to something like /var/www/html/logs/formmail.log and then I can run a central script on a remote server that checks all my servers every few minutes by just loading this url (like www.servername.com/logs/formmail.log) so I only have to run one script rather than 54 scripts once on each server!
This is a first draft of this log rule if anyone improves it reply here and share the improvements :)
I spend way too much time chasing down formmail abuses :(
<edit>signature removed</edit>
LogFormat "%h %l %u %t \"%v %r\" %>s %b" formmaillog
SetEnvIf Request_URI "[F,f][O,o][R,r][M,m][M,m][A,a][I,i][L,l]" formmail
CustomLog logs/formmail.log formmaillog env=formmail
Here's an output from the formmail.log:
24.214.X.X - - [19/Jan/2004:12:24:56 -0600] "dixiesys.com GET /ForMMail.pl HTTP/1.1" 404 286
The most helpful thing is the %v in the LogFormat because this logs _virtual host_ information too so you can quickly see what vhost is getting the request.
Now all I need is a script to monitor formmail.log and alert me on a certain condition, maybe a 5 minute check and alert if more than say, 10 new lines are in the log (obviously this would need tweaking in the real world probably) so that you can catch the formmail crap before it results in XX thousand emails and several spamcop complaints! Actually I'll probably change the log location to something like /var/www/html/logs/formmail.log and then I can run a central script on a remote server that checks all my servers every few minutes by just loading this url (like www.servername.com/logs/formmail.log) so I only have to run one script rather than 54 scripts once on each server!
This is a first draft of this log rule if anyone improves it reply here and share the improvements :)
I spend way too much time chasing down formmail abuses :(
<edit>signature removed</edit>
