Here’s the scenario; you’re using Plesk, you have it configured with Postfix, you have the mail server settings configured to query Spamcop, Spamhaus or whatever RBL you chose. Inevitably, “high paying customer” will come along and say “Hey, my important client John Doe is trying to send me a super uber critical l33t business deal email and it’s being rejected by this Spamcop thing; fix it or I’m taking my hosting elsewhere.” You do the reserach, find out their client hosts his mail with some spam happy hosting provider that doesn’t do anything with abuse reports so their whole network is blacklisted. You can’t tell high paying customer too bad, but you also don’t want to stop using your RBL’s and expose your other customers to the excess spam, so best option is to whitelist the sender’s blacklisted IP. Here’s how:
- Create the plain text file /etc/postfix/rbl_override with your favorite text editor.
- Add a comment line first for why you’re adding the respective IP’s your adding, then add one IP address per line that you want to whitelist followed by an OK. It will look something like this:
# Whitelisting the following - customer domain.com - 11/15/2013 18.104.22.168 OK
- From the /etc/postfix/ directory, run: postmap hash:rbl_override
- Edit /etc/postfix/main.cf and make the following line:
smtpd_recipient_restrictions = permit_mynetworks, check_client_access pcre:/var/spool/postfix/plesk/no_relay.re, permit_sasl_authenticated, reject_unauth_destination
smtpd_recipient_restrictions = permit_mynetworks, check_client_access hash:/etc/postfix/rbl_override, check_client_access pcre:/var/spool/postfix/plesk/no_relay.re, permit_sasl_authenticated, reject_unauth_destination
- Now restart postfix; typically “/etc/rc.d/init.d/postfix restart” if you’re on CentOS/RHEL/Scientific, or perhaps “postfix restart” if you’re on another distro.