Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- modprobe -v ip_set
- modprobe -v ip_set_hash_netport
- #create list for IPs
- ipset create whitelist hash:net
- for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/pl.zone)
- do
- sudo ipset add whitelist $IP
- done
- for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/pl.zone)
- do
- sudo ipset add whitelist $IP
- done
- for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/de.zone)
- do
- sudo ipset add whitelist $IP
- done
- for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/fr.zone)
- do
- sudo ipset add whitelist $IP
- done
- for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/gb.zone)
- do
- sudo ipset add whitelist $IP
- done
- for IP in $(/etc/banhammer.d/whitelist)
- do
- sudo ipset add whitelist $IP
- done
- iptables -N countryfilter
- iptables -A INPUT -j countryfilter
- iptables -A countryfilter -m --set whitelist src -j RETURN
- iptables -A countryfilter -j DROP
Advertisement
Add Comment
Please, Sign In to add comment