How Do I Whitelist Hosts/IP Addresses In Postfix?

How Do I Whitelist Hosts/IP Addresses In Postfix?

If you are not recieving emails from a sender to Postfix, this could be due to issues with the senders SPF record being incomplete, or malformed. If you really need to get emails from the sender one way would be to whitelist the ip or host address of the sender.

To whitelist a server, create a file, /etc/postfix/rbl_override where you will list all IP addresses or host names (one per line!) that you want to whitelist:

To whitelist a ip/host on Postfix create/edit the following file:
/etc/postfix/rbl_override
 
Add the ip/host you wish to whitelist, one line at a time:

x.x.x.x OK
x.x.x.x OK
mail.exampledomain.com OK

After you’ve created/modified that file, you must postmap the file with this command:
postmap /etc/postfix/rbl_override

Next open Postfix config file /etc/postfix/main.cf and search for the smtpd_recipient_restrictions parameter.
Add the following entry after variable  reject_unauth_destination, but before the first blacklist.
check_client_access hash:/etc/postfix/rbl_override

An example entry:

smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, check_client_access hash:/etc/postfix/rbl_override, check_policy_service unix:private/spfcheck

Last thing to do is  restart Postfix using the following command in order for the changes to take effect:

/etc/init.d/postfix restart (Centos/RHEL 6 and Ubuntu)
systemctl restart postfix (Centos / RHEL 7)

jim has written 83 articles

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>