Blacklisting in Postfix

If you happen to be running your own Postfix mail server and you are wanting to add a little filtering to the incoming mail, then here’s some advice that will get you up and running in no time…

1. Copy the blacklist sa-blacklist.current.reject to a sensible spot…

/etc/postfix/sender_restrictions seams reasonable.

2. Update, adding the line:

smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender_restrictions

3. Create the access table hash:

sudo postmap /etc/postfix/sender_restrictions

4. Have the master daemon reread

sudo postfix reload

You are now rejecting envelope senders from the blacklisted domains, they will be rejected with a 554 error. If you would like to test this without actually rejecting mails, you can add `warn_if_reject, ‘ before the `check_sender_access’ token, messages that would be rejected will be logged with a `reject_warning’.

%d bloggers like this: