diff --git a/resources/gen-baniplist.sh b/resources/gen-baniplist.sh new file mode 100644 index 0000000..bf84cba --- /dev/null +++ b/resources/gen-baniplist.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Purpose: Block all traffic from conrtys in ISO var. Use ISO code. +# ------------------------------------------------------------------------------- + +### Setting VAR's ### +ISO="ru cn br" + +WGET=/usr/bin/wget +EGREP=/bin/egrep +SPAMLIST="countrydrop" +ZONEROOT="/opt/blockfiles" +DLROOT="http://www.ipdeny.com/ipblocks/data/countries" + +#running script +[ ! -d $ZONEROOT ] && /bin/mkdir -p $ZONEROOT +rm /etc/nginx/blockips.conf + +for c in $ISO +do + tDB=$ZONEROOT/$c.zone + $WGET -O $tDB $DLROOT/$c.zone + BADIPS=$(egrep -v "^#|^$" $tDB) + + for ipblock in $BADIPS + do + echo "deny $ipblock" >> /etc/nginx/blockips.conf + done + +done +exit 0