postfix / smtpd – disable relay to specific domains

/etc/postfix/main.cf

make sure you have included this:

 hash:/etc/postfix/access,

in

smtpd_sender_restrictions = ................

Note you can also avoid receving to a specific domain if you add this also in reject_unauth_destination ruleset.

/etc/postfix/access

Have your domain listed like:

evildomain.tld   REJECT
outta.here       REJECT

Then you need to generate the actual file that postfix will use = access.db like this:

# postmap hash:/etc/postfix/access

restart postfix and that’s it.

This entry was posted in Uncategorized. Bookmark the permalink.