Block entire TLDs with Postfix.

Situation:
Your mail server has become busy processing SPAM messages from all the new top level domains. Almost all the email coming from the new .top .xyz .link .party domains are SPAMMY. None of your clients send email from any of these domains and it’s not expected that any of their clients would either.

Solution:
Block all the TLDs that are being used for sending spam messages.

Create /etc/postfix/reject_domains and add the following lines:

/\.top$/ REJECT We reject all .top domains
/\.xyz$/ REJECT We reject all .xyz domains
/\.link$/ REJECT We reject all .link domains
/\.party$/ REJECT We reject all .party domains

In /etc/postfix/main.cf add the following:

smtpd_sender_restrictions =
        check_sender_access pcre:/etc/postfix/reject_domains

Once you are happy with the changes you’ve made:

sudo postfix reload

Summary:
Blocking a whole TLD is mostly not recommended but it is an effective way to quickly stop spam messages from ending up being processed by the server.

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *