Displaying 1 result from an estimated 1 matches for "import_blacklist".
2016 Sep 21
1
ipset and blacklisting
...ervice ipset save
I use three scripts:
access_log_ips.sh
#!/bin/bash
##############################################
cp /root/blacklist /root/blacklist.old
sed -e 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*$/\1/' -e t -e d
/var/log/httpd/access_log | sort | uniq > blacklist
exit 0
import_blacklist.sh
#!/bin/bash
##############################################
sed s/,/\\n/g /root/blacklist |while read i; do ipset add blacklist $i
/usr/sbin/ipset save blacklist
# rm -f /root/blacklist.old
done
and most importantly so I don't ban myself,
ipset_whitelist.sh
#!/bin/bash
################...