Filter incoming emails by IP

Operating System & Version
CentOS 7.9
cPanel & WHM Version
102.0.25

martin MHC

Well-Known Member
Sep 14, 2016
317
71
78
UK
cPanel Access Level
Root Administrator
How could I filter incoming emails by IP so that emails from a certain IP address are always blocked .

I have previously used the Firewall system ( ConfigServer Security & Firewall - csf v14.17 ) to manually list and block emails from this address but reviewing this I suspect this doesn't work as the firewall blocks server access rather than any message delivery.

WHM already has "block email by Country" and "block email by domain" filters but there doesn't appear to be a way I can find of doing this on a per IP basis?

Would this be something that can be done with Spam assassin on a server wide (Rather than account) level? And how can server wide Spam Assassin be implemented with this? I can read only documentation on SpamAssassin on the account level rather than the server wide level.

Also, to extend this while I write -- Ideally I'd like Spam assassin to do a blacklist lookup on a received mail from IP, and if the IP appears in multiple (say 3) blacklists then the message is not delivered. Any ideas how I could do this?

Cheers


PS I have read this post: How to filter incoming e-mail messages by IP address but this is cpanel account level rather than server wide filtering.
 
Last edited by a moderator:

martin MHC

Well-Known Member
Sep 14, 2016
317
71
78
UK
cPanel Access Level
Root Administrator
Typical, now I've written this I have found in Exim Manager --> blacklist search that there is an option of manually blacklisting IPs here (Access List) .

I think this is what I'm looking for; stating "IP addresses from which SMTP connections are dropped unconditionally ".

Any comments on adding nuance to droppping only IPs that appear in x number of blacklists would be appreciated.
 
  • Like
Reactions: cPRex