Sunday, May 01, 2016

Postfix - How to Whitelist Host/IP

To whitelist a host or IP address in postfix, you need to create the "/etc/postfix/rbl_override" file first. This is where you put hosts/IPs that you want to whitelist. For example, mine looks like this:
xxx.xxx.xxx.xxx OK
tony.com OK
127.0.0.1 OK

Now add the new entry and save the file. Then update the Postfix lookup table:
# postmap /etc/postfix/rbl_override


Then open /etc/postfix/main.cf and search for the "smtpd_recipient_restrictions" parameter. You will need to add "check_client_access hash:/etc/postfix/rbl_override" to "smtpd_recipient_restrictions".

Mine looks like:
smtpd_recipient_restrictions = check_client_access hash:/etc/postfix/rbl_override,
        permit_mynetworks,
        permit_sasl_authenticated,
        check_relay_domains,
        reject_unauth_destination,
        reject_rbl_client opm.blitzed.org,
        reject_rbl_client list.dsbl.org,
        reject_rbl_client sbl.spamhaus.org,
        reject_rbl_client cbl.abuseat.org,
        reject_rbl_client dul.dnsbl.sorbs.net

Restart Postfix, and you are all set!

No comments: