Add script for blacklist countries with RIPE LIR informations
This commit is contained in:
parent
c3a66eb333
commit
7ff2fd64c4
23
blacklist-countries.sh
Normal file
23
blacklist-countries.sh
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
ripedeny_file=/var/tmp/ripe_deny
|
||||
|
||||
cd /var/tmp
|
||||
|
||||
rm -f $ripedeny_file
|
||||
|
||||
GET http://zidane.evolix.net/spam/ripe.cidr.md5 > ripe.cidr.md5
|
||||
GET http://zidane.evolix.net/spam/ripe.cidr > ripe.cidr
|
||||
|
||||
for i in CN KR RU; do
|
||||
|
||||
grep "^$i|" ripe.cidr >> $ripedeny_file
|
||||
|
||||
done
|
||||
|
||||
/sbin/iptables -F NEEDRESTRICT
|
||||
|
||||
for i in $(cat $ripedeny_file); do
|
||||
BLOCK=$(echo $i | cut -d"|" -f2)
|
||||
/sbin/iptables -I NEEDRESTRICT -s $BLOCK -j DROP
|
||||
done
|
Loading…
Reference in a new issue