Author Topic: Fighting Spam: Block entire TLD (Top Level Domain) with Postfix  (Read 265 times)

0 Members and 1 Guest are viewing this topic.

100% tested with CWP7Pro + Centos 7.9.2009

1. Write the tlds to be blocked to the sender_blacklist file. (/etc/postfix/sender_blacklist)
/\.asia$/ REJECT All Domain
/\.bg$/ REJECT All Domain
/\.bid$/ REJECT All Domain
/\.biz$/ REJECT All Domain
/\.br$/ REJECT All Domain
/\.buzz$/ REJECT All Domain

2. Get root access on your server;
# cd /etc/postfix
# postmap hash:/etc/postfix/sender_blacklist
# systemctl restart postfix.service

3. open the file (/etc/postfix/;

# rules restrictions
smtpd_client_restrictions = reject_unknown_client, check_client_access hash:/etc/postfix/sender_blacklist
smtpd_helo_restrictions =
smtpd_sender_restrictions = pcre:/etc/postfix/sender_blacklist
smtpd_recipient_restrictions = check_policy_service inet:, permit_sasl_authenticated, permit_mynetworks, check_client_access hash:/etc/postfix/sender_whitelist, check_client_access hash:/etc/postfix/sender_blacklist, reject_unauth_destination, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_rbl_client, reject_rbl_client

save and exit.

4. And the end;
# systemctl restart postfix.service

Goodbye, spam mails ...  ;)