diff --git a/block_range.sh b/block_range.sh index c2724ed..8325df3 100644 --- a/block_range.sh +++ b/block_range.sh @@ -7,7 +7,7 @@ set -e ### Variables URL="http://www.ipdeny.com/ipblocks/data/countries" -ZONES="cn hk ru tw" +ZONES="cn hk ru tw kp kr sg" SCRIPTDIR="/root/firewall" ZONEDIR="${SCRIPTDIR}/blocked_zones/" RULESFILE="/tmp/iptables_rules-$(date +'%s')" @@ -93,7 +93,7 @@ download_zones() for zone in $(echo "${ZONES[*]}"); do echo "Downloading $zone.zone file"; - ${WGET} -P "${ZONEDIR}" "${URL}/$zone.zone"; + ${WGET} --quiet -P "${ZONEDIR}" "${URL}/$zone.zone"; done } @@ -105,7 +105,7 @@ create_chains() for chain in $(echo "${ZONES[*]}"); do echo "Creating $chain chain"; - ${IPSET} create ${chain} hash:net; + ${IPSET} create -exist ${chain} hash:net; done } @@ -116,9 +116,10 @@ populate_chains() { for chain in $(echo "${ZONES[*]}"); do + echo "Populating $chain"; for ip in $(cat $ZONEDIR/$chain.zone); do - ${IPSET} add $chain $ip; + ${IPSET} add -exist $chain $ip; done; done }