Code: Alles auswählen
nano /root/blocklist-mail.sh
#!/bin/sh
cd /etc/fail2ban
wget https://lists.blocklist.de/lists/mail.txt
chmod +x /root/blocklist-mail.sh
nano /etc/fail2ban/filter.d/ip-blacklist.conf
# Fail2Ban configuration file
#
# List of blocked ip addresses
[Definition]
# Option: failregex
# Notes : Detection of blocked ip addresses.
# Values: TEXT
#
failregex = <HOST>.*]
# Option: ignoreregex
# Notes : Regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
#############
nano /etc/fail2ban/jail.local
[blocklistmail]
enabled = true
port = smtp,465,submission,imap2,imaps,pop3,pop3s
filter = ip-blacklist
logpath = /etc/fail2ban/mail.txt
findtime = 15552000
maxretry = 0
bantime = 86400
service fail2ban restart
crontab -e
*/35 * * * * /root/blocklist-mail.sh
Code: Alles auswählen
Running tests
=============
Use failregex filter file : ip-blacklist, basedir: /etc/fail2ban
Use log file : /etc/fail2ban/mail.txt
Use encoding : ANSI_X3.4-1968
Results
=======
Failregex: 0 total
Ignoreregex: 0 total
Date template hits:
Lines: 12427 lines, 0 ignored, 0 matched, 12427 missed
[processed in 0.44 sec]