20080316 Sunday March 16, 2008

Postfix whitelist

I had some spam blacklist checking working pretty well with postfix, then an important client got themselves blacklisted. I won't mention names, but they are a big government organization, and while the people we interfaced with daily very trying to be helpful, their IT folks took absolutely no interest in getting themselves off the blacklist ("...they should know we don't spam..." was the attitude).

So I had to dig around for ways to create a postfix whitelist. First, create the file: /etc/postfix/whitelist. Then add your entries as follows:

mailserver.example.com    OK

Next, run the following command:

postmap hash:/etc/postfix/whitelist

Lastly, edit /etc/postfix/main.cf. Go to the smtpd_recipient_restrictions section and add "check_client_access hash:/etc/postfix/whitelist". Below is an example of what it might look like for a minimal set of rules to do whitelist and blacklist checking:

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_client_access hash:/etc/postfix/whitelist, reject_rbl_client psbl.surriel.com,reject_rbl_client bl.spamcop.net,permit

After that, just needed to reboot Postfix and everything was working.

The first time I tried this, I did it without running the postmap command, and I was unable to connect to at all via my mail client, so don't forget that part.

Posted by rickg ( Mar 16 2008, 03:53:59 PM PDT ) Permalink Comments [0]