Created
March 30, 2011 10:45
-
-
Save nacx/894192 to your computer and use it in GitHub Desktop.
Simple chain to ban ip addresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BANFILE='/root/banned' | |
iptables -N BANNED | |
if [ -f ${BANFILE} ]; then | |
for IP in `sort -ru ${BANFILE}`; do | |
iptables -A BANNED -s ${IP} -j DROP | |
done | |
fi | |
iptables -A BANNED -j RETURN | |
iptables -A INPUT -i eth0 -m state --state NEW -j BANNED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment