Simple and flexible firewall for Linux server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
445 B

  1. #!/bin/sh
  2. ripedeny_file=/var/tmp/ripe_deny
  3. cd /var/tmp
  4. rm -f $ripedeny_file
  5. GET http://antispam00.evolix.org/spam/ripe.cidr.md5 > ripe.cidr.md5
  6. GET http://antispam00.evolix.org/spam/ripe.cidr > ripe.cidr
  7. for i in CN KR RU; do
  8. grep "^$i|" ripe.cidr >> $ripedeny_file
  9. done
  10. /sbin/iptables -F NEEDRESTRICT
  11. for i in $(cat $ripedeny_file); do
  12. BLOCK=$(echo $i | cut -d"|" -f2)
  13. /sbin/iptables -I NEEDRESTRICT -s $BLOCK -j DROP
  14. done