Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.01 KB

README.md

File metadata and controls

42 lines (32 loc) · 1.01 KB

Spamhaus DROP List

A shell script that grabs the latest Spamhaus DROP & EDROP Lists and adds them to iptables. We use this script (among other tools) on our Debian web server & 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
sudo iptables -F SpamhausAct