1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-21 03:02:09 +00:00

somes code fixes and lines added for fixes

This commit is contained in:
ChiefGyk 2016-06-29 10:18:56 -04:00
parent 022752d0bb
commit 4f0096c3c2
2 changed files with 8 additions and 14 deletions

View File

@ -7,7 +7,6 @@ list="chinese nigerian russian lacnic exploited-servers"
BLACKLISTS=( BLACKLISTS=(
"http://www.projecthoneypot.org/list_of_ips.php?t=d&rss=1" # Project Honey Pot Directory of Dictionary Attacker IPs "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://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://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://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 "http://cinsscore.com/list/ci-badguys.txt" # C.I. Army Malicious IP List
@ -21,16 +20,6 @@ do
grep -Po '(?:\d{1,3}\.){3}\d{1,3}(?:/\d{1,2})?' $IP_TMP >> $IP_BLACKLIST_TMP grep -Po '(?:\d{1,3}\.){3}\d{1,3}(?:/\d{1,2})?' $IP_TMP >> $IP_BLACKLIST_TMP
done 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 sort $IP_BLACKLIST_TMP -n | uniq > $IP_BLACKLIST
rm $IP_BLACKLIST_TMP rm $IP_BLACKLIST_TMP
wc -l $IP_BLACKLIST wc -l $IP_BLACKLIST
@ -40,3 +29,7 @@ egrep -v "^#|^$" $IP_BLACKLIST | while IFS= read -r ip
do do
ipset add blacklist $ip ipset add blacklist $ip
done done
# save IPtable rules
ipset save blacklist > /etc/ipset/blacklist
iptables-save > /etc/iptables.up.rules

View File

@ -12,14 +12,15 @@ if [[ $EUID -ne 0 ]]; then
echo echo
exit exit
fi fi
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-get update apt-get update
apt-get install -y ipset apt-get install -y ipset
mkdir /etc/ipset
ipset create blacklist hash:net ipset create blacklist hash:net
iptables -I INPUT -m set --match-set blacklist src -j DROP iptables -I INPUT -m set --match-set blacklist src -j DROP
cp blacklist /etc/cron.daily/blacklist cp blacklist /etc/cron.daily/blacklist
chmod a+x /etc/cron.daily/blacklist chmod a+x /etc/cron.daily/blacklist
time /etc/cron.daily/blacklist time /etc/cron.daily/blacklist
apt-get install -y iptables-persistent iptables-save > /etc/iptables.up.rules
sed -e "\$apost up ipset restore < /etc/ipset/blacklist" /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." echo "Blacklist has been installed. It will run daily automatically."