Allow Email Access from specific IP only, block everyone else

USA_Webmaster

Well-Known Member
Dec 10, 2015
48
5
8
USA
cPanel Access Level
Root Administrator
How do I disable email access to a specific email account (or cPanel primary domain emails) from every IP address in the world except for the one I whitelist?

I check server logs and I see Temporary Block for 1800 seconds [LF_SMTPAUTH] lfd alerts because people from other parts of the world are trying to access my email account.

---

Is there something similar I could do email account(s) for a primary domain on a cPanel account? Allow email account access to whitelisted IPs, block / deny everyone else?

Normally, for a website, I could just add .htaccess file to a directory and copy / paste code below to very top:

Code:
order deny,allow
allow from 192.168.0.420
deny from all

ErrorDocument 403 https://mywebsite.com
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,112
662
263
Houston
cPanel Access Level
DataCenter Provider
Hi @USA_Webmaster

Host access control may provide the control you'd like. Located at WHM>>Security Center>>Host Access Control you can block webmail access for everyone but a few addresses. You also can create IP tables rules to block by port but I would be concerned about the effectiveness of this as you could affect your ability to receive mail.