//POP3保护
#vi /etc/fail2ban/jail.conf
[pop3]
enabled = true
filter = courierlogin
action = iptables[name=pop3, port=110, protocol=tcp]
mail-whois[name=pop3, dest=mis@um.com, sender=fail2ban@um.com]
logpath = /var/log/maillog
bantime = 3600
findtime = 300
maxretry = 5
#cat /etc/fail2ban/filter.d/courierlogin.conf
failregex = LOGIN FAILED, .*, ip=\[<HOST>\]$
//SMTP保护
#vi /etc/fail2ban/jail.conf
[smtp]
enabled = true
filter = couriersmtp
action = iptables[name=smtp, port=25, protocol=tcp]
mail-whois[name=smtp, dest=mis@um.com, sender=fail2ban@um.com]
logpath = /var/log/maillog
bantime = 3600
findtime = 300
maxretry = 5
#cat /etc/fail2ban/filter.d/couriersmtp.conf
#failregex = postfix/smtpd.* warning: unknown\[<HOST>\]: SASL LOGIN authentication failed: authentication failure$
failregex = (?i): warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication Failed(:.*)$