spamhaus
spamhaus copied to clipboard
A shell script that grabs the latest Spamhaus DROP List and adds it to iptables.
Spamhaus DROP List
A shell script that grabs the latest Spamhaus DROP List and adds it to iptables. We use this (among other tools) on our Ubuntu proxy server at AppThemes to cut down on spam and other malicious activity.
Usage
Place the script somewhere on your server.
# find a nice home cd /home/YOUR-USERNAME/bin/ # create the file and paste vim spamhaus.sh # make it executable chmod +x spamhaus.sh # set it loose sudo ./spamhaus.sh # confirm the rules have been added sudo iptables -L Spamhaus -n
Automatic Updating
In order for the list to automatically update each day, you'll need to setup a cron job with crontab.
# fire up the crontab (no sudo) crontab -e # run the script every day at 3am 0 3 * * * /home/YOUR-USERNAME/bin/spamhaus.sh
Troubleshooting
If you need to remove all the Spamhaus rules, run the following:
sudo iptables -F Spamhaus