yum install fail2ban
/etc/fail2ban/jail.conf добавляем строки:
[postfix-ban]
enabled = true
filter = postfix
action = iptables-multiport[name=PFIX, port="smtp,smtps", protocol=tcp]
logpath = /var/log/maillog
maxretry = 3
bantime = 7200
[dovecot-ban]
enabled = true
filter = dovecot
action = iptables-multiport[name=DCOT, port="pop3,pop3s,imap,imaps", protocol=tcp]
logpath = /var/log/maillog
findtime = 300
maxretry = 10
bantime = 1800
[sasl-ban]
enabled = true
filter = sasl
action = iptables-multiport[name=SASL, port="smtp,smtps", protocol=tcp]
logpath = /var/log/maillog
findtime = 300
maxretry = 10
bantime = 1800