Add 'resources/gen-baniplist.sh'
This commit is contained in:
30
resources/gen-baniplist.sh
Normal file
30
resources/gen-baniplist.sh
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user