Skip to content

Restricting WHM access to operator IPs without locking yourself out

How to constrain WHM/cPanel admin access by IP range using Host Access Control, with the safety procedure for the day your office IP changes.

WHM’s login portal is internet-facing by default. Anyone with a working password and 2FA token can log in. Adding an IP allowlist for the admin ports — 2086, 2087 — narrows the attack surface to actual operator networks. The trap is that this is also the most common cause of operator lockout at 03:00 when a residential ISP rotates an IP.

What’s happening

cPanel exposes Host Access Control at WHM > Security Center > Host Access Control, which writes to /etc/hosts.allow and /etc/hosts.deny. The allowlist applies per-daemon — cpaneld, whostmgrd, webmaild, sshd. Combined with CSF rules on the same ports, you get two layers of enforcement.

How to verify

cat /etc/hosts.allow
cat /etc/hosts.deny
csf -l | grep -E "2086|2087"
grep -E "2086|2087" /etc/csf/csf.conf
last -i | grep root | head

If /etc/hosts.deny has cpaneld: ALL but /etc/hosts.allow does not list any IPs, you have locked everyone out — including operators.

The fix

  1. List your management networks: office IP(s), VPN egress, on-call cell tethering range if used. Document each in the password manager.
  2. Add to /etc/hosts.allow via WHM > Security Center > Host Access Control:
    cpaneld : 203.0.113.0/24 198.51.100.5
    whostmgrd : 203.0.113.0/24 198.51.100.5
    webmaild : ALL
    Webmail stays open (customers need it). Admin services are locked.
  3. Add the deny last: cpaneld : ALL : DENY and whostmgrd : ALL : DENY. Order matters: allows first, then deny-all.
  4. Mirror in CSF: WHM access control is at the application layer; CSF gives you network-layer enforcement. In csf.allow, add the same management IPs for ports 2086/2087.
  5. Test from a phone tethering connection before relying on this. Confirm WHM rejects from a non-allowed IP, and confirm SSH still works from your management IP.
  6. Lockout recovery procedure: console access via the host provider (almost every IaaS provides serial/console), or edit /etc/hosts.allow from a Rescue Mode. Document the path.
  7. DYNDNS for office IPs that rotate: if your office has a dynamic IP with a dyndns entry, CSF’s csf.dyndns file can refresh that automatically. WHM’s Host Access Control does not natively support hostnames — it wants IPs.
  8. Quarterly drill: a fire drill where one operator confirms they can log in via the documented lockout recovery path. Untested recovery is unrecovery.

Stack Harbor maintains WHM IP allowlists across managed fleets under cPanel/WHM management.