How To Block an Entire TLD in Postfix

Published Date Author: , Posted September 13th, 2016 at 2:14:33pm

Step 1. Execute the following two commands:
postconf -e smtpd_sender_restrictions=pcre:/etc/postfix/rejected_domains
postconf -e reject_unauth_destinations=pcre:/etc/postfix/rejected_domains

If that doesn’t work, you may hand-edit main.cf and add/edit these lines:

1
2
smtpd_sender_restrictions=pcre:/etc/postfix/rejected_domains
reject_unauth_destinations=pcre:/etc/postfix/rejected_domains
smtpd_sender_restrictions=pcre:/etc/postfix/rejected_domains
reject_unauth_destinations=pcre:/etc/postfix/rejected_domains

Step 2. Create the regex filter file:

vim /etc/postfix/rejected_domains

1
2
/\.top$/           REJECT No spam allowed from the .top TLD
/\.stream$/           REJECT No spam allowed from the .stream TLD
/\.top$/           REJECT No spam allowed from the .top TLD
/\.stream$/           REJECT No spam allowed from the .stream TLD

Step 3. Signal Postfix to reread the config:

postfix reload

NOTE: Do NOT use the postmap command for the rejected_domains file, postmap is only for hash or lmdb files.

No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.