A shell script that grabs the latest Spamhaus DROP List and adds it to iptables.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md Update README.md Feb 18, 2013
spamhaus.sh Forgot to envoke chain from input rules Feb 20, 2013

README.md

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