diff --git a/conf/blacklist/blocklist b/conf/blacklist/blacklist similarity index 63% rename from conf/blacklist/blocklist rename to conf/blacklist/blacklist index 87c715bf..055f4d9d 100644 --- a/conf/blacklist/blocklist +++ b/conf/blacklist/blacklist @@ -2,12 +2,10 @@ IP_TMP=/tmp/ip.tmp IP_BLACKLIST=/etc/ip-blacklist.conf IP_BLACKLIST_TMP=/tmp/ip-blacklist.tmp -IP_BLACKLIST_CUSTOM=/etc/ip-blacklist-custom.conf # optional list="chinese nigerian russian lacnic exploited-servers" BLACKLISTS=( "http://www.projecthoneypot.org/list_of_ips.php?t=d&rss=1" # Project Honey Pot Directory of Dictionary Attacker IPs "http://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=1.1.1.1" # TOR Exit Nodes -"http://www.maxmind.com/en/anonymous_proxies" # MaxMind GeoIP Anonymous Proxies "http://danger.rulez.sk/projects/bruteforceblocker/blist.php" # BruteForceBlocker IP List "http://www.spamhaus.org/drop/drop.lasso" # Spamhaus Don't Route Or Peer List (DROP) "http://cinsscore.com/list/ci-badguys.txt" # C.I. Army Malicious IP List @@ -21,16 +19,6 @@ do grep -Po '(?:\d{1,3}\.){3}\d{1,3}(?:/\d{1,2})?' $IP_TMP >> $IP_BLACKLIST_TMP done -# This part may not work for everyone, it seems wizcraft doesn't allow all VPS wget access, but I am looking into it -for i in `echo $list`; do - # Download - wget --quiet http://www.wizcrafts.net/$i-iptables-blocklist.html - # Grep all but ip blocks - cat $i-iptables-blocklist.html | grep -v \< | grep -v \: | grep -v \; | grep -v \# | grep [0-9] > $i.txt - # Consolidate - cat $i.txt >> $IP_BLACKLIST_TMP -done - sort $IP_BLACKLIST_TMP -n | uniq > $IP_BLACKLIST rm $IP_BLACKLIST_TMP wc -l $IP_BLACKLIST @@ -41,6 +29,5 @@ do ipset add blacklist $ip done -# save IPtable rules -iptables-save > /etc/iptables/rules.v4 -ip6tables-save > /etc/iptables/rules.v6 \ No newline at end of file +ipset save > /etc/ipset.up.rules +iptables-save > /etc/iptables.up.rules diff --git a/setup/blacklist.sh b/setup/blacklist.sh index bc4922ee..d8e341d0 100644 --- a/setup/blacklist.sh +++ b/setup/blacklist.sh @@ -7,13 +7,13 @@ source setup/functions.sh # load our functions source /etc/mailinabox.conf # load global vars -echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections -echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections apt_install -y ipset ipset create blacklist hash:net iptables -I INPUT -m set --match-set blacklist src -j DROP cp conf/blacklist/blacklist /etc/cron.daily/blacklist chmod a+x /etc/cron.daily/blacklist time /etc/cron.daily/blacklist -apt_install -y iptables-persistent +iptables-save > /etc/iptables.up.rules +sed -i -e "\$apre-up ipset restore < /etc/ipset.up.rules" /etc/network/interfaces +sed -e "\$apost up iptables-restore < /etc/iptables.up.rules" /etc/network/interfaces echo "Blacklist has been installed. It will run daily automatically." \ No newline at end of file