Browse - Computer Tips - How can I avoid the annoying spam attempts away from my Postfix logs?
Product: Postfix, fail2ban
Q. How can I avoid the annoying spam attempts away from my Postfix logs?
A. You can use fail2ban to stop an IP-address from contacting
you after a few spamming attempts.
dnf install fail2ban
Ensure you have /etc/fail2ban/filter.d/postfix.conf
If you don't put this in there:
failregex = reject: RCPT from (.*)\[<HOST>\]: 554
Add this to /etc/fail2ban/jail.conf
enabled = true
filter = postfix
action = iptables-multiport[name=postfix, port="smtp,submission", protocol=tcp]
logpath = /var/log/postfix
maxretry = 3
systemctl start fail2ban
Look at the iptables changes:
Clear iptables stuff and restart fail2ban:
systemctl restart fail2ban
Also handy for ssh, dovecot, ftpd, etc