mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-21 03:02:09 +00:00
46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
# 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 |