Tips WHM/Cpanel: WHM Access Restriction for Certain IP
One of the common problems while managing WHM/CPanel based hosting is blacklist access into WHM/CPanel due to CPHulk plugins. CPHulk activated by default on WHM (if you choose Yes while initial setup) and serves as a blacklisted software just like Fail2ban or Denyhost to prevent logon services from spammers/crackers.
The problem is that CPHulk can’t often decide which access is normal and which aren’t. Consequently, due to so many failures, even our valid IP could be blacklisted or could not be logged in as root. Why? Because cracker will try to select a random password, and after a few logins attempt CPHulk will automatically reject root login.
Modify WHM Access Limit
In addition to closing the recommended port, there is easier way to anticipate this kind of problem, by modifying the WHM access limit/WHM login page access protection.
To do so, run the following procedure :
- Firstly, login to WHM login page, enter your user name and password.
- In the Security Center group menu, click Host Access Control menu.
- On the Daemon, select Whostmgrd daemon. It is a daemon application for WHM. We can also choose to protect SSH (SSHD) daemon or CPaneld daemon for CPanel.
- In the Access List, enter the IP or IP range that allows accessing. Write down the full subnet.
For example, to network segment 220.127.116.11/29 means to enter the IP 18.104.22.168/255.255.255.248. Configure it as 22.214.171.124/29 will not work because WHM will only accept full network subnet. If you asked, why using 126.96.36.199/255.255.255.248 and not 188.8.131.52/255.255.255.248 instead, then you should take the IP subnet course.
- In the Action section select “Allow”.
- Then, do the same thing to another IP segment which will be allowed.
- At the bottom, Select Daemon = Whostmgrd, Access List = ALL and Action = Deny. Means that other than registered IP will not be allowed.
- Lastly, click the “Save Host Access List” when finished.
- Now you can perform WHM access from the allowed IP and from outside registered IP list.
For those who are accustomed to dealing with Linux servers, the above process basically does limit access by adding a rule in the file /etc/hosts.allow