cPanel comes with a great feature called brute force protection. The problem is, if you mis-type your password 5x in a row or if you have multiple people in the office, like we do, that try to get into various services and they combine to have 5 missed passwords in a row (ssh, mail, and whm logins all quality) then you will lock yourself out of your system. Here are some tips & tricks that will help you regain access.
Gaining Initial Access
The easiest and quite possibly ONLY way to get back into your system is by logging in from a different IP address. Sometimes you can do this by re-initializing your modem/router if you are on a DHCP assigned address from your ISP. This is usually the case for residential service from DSL companies like AT&T (no other choices, huh? we feel sorry for your), Comcast, or Roadrunner. If you are on a business class like and have static IP addresses assigned then your public-facing IP won’t change. You can try to do a One-To-One NAT to give yourself a different static IP, but that assumes you have more than one and you have one that is not being used. You can try tethering your phone, assuming you have a smart phone. You can also try to hop on a neighbors open wifi network if you have wireless. You can also drag your laptop to the local Starbucks and try from there. If you are wired you have a lot less choices, either call your IPP (hosting company) and ask them to reset brute force protection OR call your ISP and have them assign you a new static IP (if you have only one, chances are you don’t have servers mapped).
To summarize : get on a different network!
- Try resetting your modem/router if you are on a DHCP address from your ISP.
- Assign your PC a different static IP if you have a static IP group.
- Tether your phone.
- Jump on the neighbor’s network. (ask first)
- Bring your laptop to a public WiFi hot spot.
- Call your ISP for a new IP.
- Call your IPP and ask them to reset cPanel brute force.
Cleaning Out Specific Blocked Entries
If you can gain SSH access you can clean out the errant entries in the cphulkd database that drives brute force protection, entering your IP address in the where clause to find and remove your blocked IP:
# mysql mysql> use cphulkd; mysql> select * from brutes where ip LIKE '%<your-ip-or-start-of-ip-address>%'; check the returned list to make sure what you think is your blocked IP is actually on the list. mysql> delete from brutes where ip LIKE '%<your-ip-or-start-of-ip-address>%'; mysql> quit
After making any changes make sure you restart cpHulkd:
# /usr/local/cpanel/etc/init/stopcphulkd # /usr/local/cpanel/etc/init/startcphulkd
Cleaning Out ALL Blocked Entries
This will reset the “good guys” and the “bad guys”, but if you need a quick fix, don’t want to disable brute force protection, and aren’t comfortable with MySQL command line then go to the brute force protection interface in cPanel and click the “flush db” button.
Make Sure You Don’t Get Blocked Again
Login to cPanel and go to the brute force protection interface. Look for the trusted IP list link. Add your IPs to that list.
Also Running APF?
You will need to stop the apf process from running:
# service apf stop
Then add your good IPs to the whitelist:
# vi /etc/apf/allow_hosts.rules