简体   繁体   中英

Postfix: block incoming mail based on recipient email and sender IP address

I am running a shared hosting environment (web + email). Some of the domains being hosted have elected to use third-party spam filtering and some have not.

In order for the spam filtering on these domains to be effective, the server should reject any messages that did not originally go through the spam filter servers. Ie they did not arrive from specific IP addresses, and don't contain specific headers.

How can I block incoming mail for these specific domains , unless the mail arrives from the spam filtering servers?

I obviously can't add firewall rule(s), because some of our hosted domains don't use the filtering service. Firewall rules blocking port 25 etc would stop their email arriving.

It needs to be a filter based on 1) the email recipient domain name, and 2) a specific list of IP addresses. For example, if domain is in a list of filtered domains, then check IP address. If IP address is NOT in list of spam filtering servers, reject the message.

Can anyone point me in the right direction?

Thanks!

I'm looking at doing this right now. Does this suggestion help: use postfix restriction classes. Put mail domains that need restricting to your spam filter servers in a separate class, then handle it differently. See http://permalink.gmane.org/gmane.mail.postfix.user/148366 and http://www.postfix.org/RESTRICTION_CLASS_README.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM