Monty Python spam skit

anti-spam script

I created a script to notify the abuse@ person for an IP address, while simultaneously banning that IP address for a time-period using fail2ban.

In my case this is useful for spam that I receive through a web based contact form. I don’t want to put a captcha on the form, and most of the spam was coming from the same IPs every day.

This script depends on curl, pcregrep and fail2ban. You could replace fail2ban with iptables however setting an expiration date with iptables alone is more complicated. Since I use fail2ban everywhere (and you should too), this method is just easier. pcregrep is required for doing a multi-line regex match.

Please share!
  • 2
    Shares

There are no comments

Your email address will not be published. Required fields are marked *