mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-14 17:27:23 +01:00
added dialog and blocks for korea as well as China
This commit is contained in:
46
conf/blacklist
Normal file
46
conf/blacklist
Normal file
@@ -0,0 +1,46 @@
|
||||
# I found this script somewhere a long time ago and modified it
|
||||
#!/bin/bash
|
||||
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
|
||||
BLACKLISTS=(
|
||||
# Project Honey Pot Directory of Dictionary Attacker IPs
|
||||
"http://www.projecthoneypot.org/list_of_ips.php?t=d&rss=1"
|
||||
# TOR Exit Nodes
|
||||
"http://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=1.1.1.1"
|
||||
# BruteForceBlocker
|
||||
"http://danger.rulez.sk/projects/bruteforceblocker/blist.php"
|
||||
# Spamhaus
|
||||
"http://www.spamhaus.org/drop/drop.lasso"
|
||||
# C.I. Army
|
||||
"http://cinsscore.com/list/ci-badguys.txt"
|
||||
# OpenBL.org
|
||||
"http://www.openbl.org/lists/base.txt"
|
||||
# Autoshun
|
||||
"http://www.autoshun.org/files/shunlist.csv"
|
||||
# Blocklist.de
|
||||
"http://lists.blocklist.de/lists/all.txt"
|
||||
# Malware Domain List
|
||||
"https://www.malwaredomainlist.com/hostslist/ip.txt"
|
||||
# ZeusTracker
|
||||
"https://zeustracker.abuse.ch/blocklist.php?download=ipblocklist"
|
||||
)
|
||||
for i in "${BLACKLISTS[@]}"
|
||||
do
|
||||
curl "$i" > $IP_TMP
|
||||
grep -Po '(?:\d{1,3}\.){3}\d{1,3}(?:/\d{1,2})?' $IP_TMP >> $IP_BLACKLIST_TMP
|
||||
done
|
||||
|
||||
sort $IP_BLACKLIST_TMP -n | uniq > $IP_BLACKLIST
|
||||
rm $IP_BLACKLIST_TMP
|
||||
wc -l $IP_BLACKLIST
|
||||
|
||||
ipset flush blacklist
|
||||
egrep -v "^#|^$" $IP_BLACKLIST | while IFS= read -r ip
|
||||
do
|
||||
ipset add blacklist $ip
|
||||
done
|
||||
|
||||
ipset save > /etc/ipset.up.rules
|
||||
iptables-save > /etc/iptables.up.rules
|
||||
7
conf/china
Normal file
7
conf/china
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
curl http://www.okean.com/antispam/iptables/rc.firewall.china > /tmp/china.sh
|
||||
chmod +x /tmp/china.sh
|
||||
source /tmp/china.sh
|
||||
rm -f /tmp/china.sh
|
||||
ipset save > /etc/ipset.up.rules
|
||||
iptables-save > /etc/iptables.up.rules
|
||||
53
conf/dialog.sh
Executable file
53
conf/dialog.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
CHOICE_HEIGHT=4
|
||||
BACKTITLE="Do you want to block China and/or Korea?"
|
||||
TITLE="Country Block"
|
||||
MENU="A lot of spam originates from Korea and China. If you don't plan on having to ever have those countries connect to your server you may block them. \
|
||||
This will update weekly, and block all IP blocks to those countries \
|
||||
Choose one of the following options:"
|
||||
|
||||
OPTIONS=(1 "China"
|
||||
2 "Korea"
|
||||
3 "China and Korea")
|
||||
|
||||
CHOICE=$(dialog --clear \
|
||||
--backtitle "$BACKTITLE" \
|
||||
--title "$TITLE" \
|
||||
--menu "$MENU" \
|
||||
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
||||
"${OPTIONS[@]}" \
|
||||
2>&1 >/dev/tty)
|
||||
|
||||
clear
|
||||
case $CHOICE in
|
||||
1)
|
||||
echo "Bombing China"
|
||||
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
|
||||
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
|
||||
cp china /etc/cron.weekly/china
|
||||
chmod +x /etc/cron.weekly/china
|
||||
time /etc/cron.weekly/china
|
||||
apt-get install -y iptables-persistent
|
||||
;;
|
||||
2)
|
||||
echo "Starting the Korean war again"
|
||||
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
|
||||
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
|
||||
cp korea /etc/cron.weekly/korea
|
||||
chmod +x /etc/cron.weekly/korea
|
||||
time /etc/cron.weekly/korea
|
||||
apt-get install -y iptables-persistent
|
||||
;;
|
||||
3)
|
||||
echo "Blocking almost 1/3 of the world"
|
||||
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
|
||||
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
|
||||
cp sinokorea /etc/cron.weekly/sinokorea
|
||||
chmod +x /etc/cron.weekly/sinokorea
|
||||
time /etc/cron.weekly/sinokorea
|
||||
apt-get install -y iptables-persistent
|
||||
;;
|
||||
esac
|
||||
7
conf/korea
Normal file
7
conf/korea
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
curl http://www.okean.com/antispam/iptables/rc.firewall.korea > /tmp/korea.sh
|
||||
chmod +x /tmp/korea.sh
|
||||
source /tmp/korea.sh
|
||||
rm -f /tmp/korea.sh
|
||||
ipset save > /etc/ipset.up.rules
|
||||
iptables-save > /etc/iptables.up.rules
|
||||
7
conf/sinokorea
Normal file
7
conf/sinokorea
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
curl http://www.okean.com/antispam/iptables/rc.firewall.sinokorea > /tmp/sinokorea.sh
|
||||
chmod +x /tmp/sinokorea.sh
|
||||
source /tmp/sinokorea.sh
|
||||
rm -f /tmp/sinokorea.sh
|
||||
ipset save > /etc/ipset.up.rules
|
||||
iptables-save > /etc/iptables.up.rules
|
||||
Reference in New Issue
Block a user