Today I got an e-mail from my daily logwatch that I could not process the log files because they were to big. A bit surprised about this sudden load on my server, I took a look at the files and discovered that my mail.log was 300 MB… Apparently a spammer had found a way to abuse my server to send spam.
I tested my server with various sites to see if it was an open relay, but all these tests failed. I used http://abuse.net/relay.html, but this isn’t a complete test. A better one is http://www.ordb.org/submit/, but this one will record your server in its database when your server is an open relay. This database is used by spam filters and mail servers to reject incoming mail.
You can use this ordb.org site if you add the following to postfix main.cf:
smtpd_client_restrictions = reject_rbl_client relays.ordb.org
Since I could not find how the spammer was abusing my server, I blocked the ip responsible for sending the e-mails by following this post: http://www.linuxquestions.org/questions/history/277040
iptables -I INPUT -s 83.217.36.171/255.255.255.255 -j DROP
I also set this parameter in /etc/postfix/main.cf, since I only use my server to send mail from within squirrelmail (= webmail) or from a script in a cgi-bin dir:
mynetworks_style = host
I think the problem is related to a cgi script that is used by one of the sites that I host and that sends e-mail. I renamed the script to make sure this wouldn’t happen again (my apache logs showed 404 errors from spiders that look for all kinds of cgi programs, probably in order to abuse them). I will also investigate how this cgi program can be abused and if there is an update available for it.
The damage isn’t that great, since I think approximately 200.000 messages were put in the mail queue, but I couldn’t find one that wasn’t rejected by the receiving server (my spamassassin filter had already marked them as spam before sending them out).
Anyway, I feel like being robbed…