Skip to main content

Postfix Blacklist

Please use fail2ban

make a list of ip addresses in /etc/postfix/ example vim /etc/postfix/blacklist

convert that to a db with postmap /etc/postfix/backlist

and finally add this restriction to your main.cf

smtpd_recipient_restrictions = permit_mynetworks,
permit_sasl_authenticated, reject_unknown_reverse_client_hostname,
reject_unauth_destination, check_client_access cidr:/etc/postfix/blacklist

unfortunately this will not stop postfix from logging the attemps so finally add a iptables drop all command to stop the flood

iptables -A INPUT -s IP-ADDRESS-TO-BLOCK-GOES-HERE -j DROP