Removing IP Block from WHM cPHulk

If you are locked out of your website due to the cPHulk blocking your IP address there is an easy way to unblock yourself.

This post describes how you can do this from your servers command line.

Getting ready to reset the block

This post uses a method to remove the IP block by using the command line. If you are blocked from accessing your server you will either need to get a new IP or use your hosts rescue console.  This will let you access the command line either way.

To access your server from another IP address you can use public wifi, a friends house, or log in via another server. All of these will have a different public IP which shouldn’t be blocked. This will let you log into the server and reset your IP block.

What If I can’t get on the server

If you are unable to get onto the server and reset your block another option available is waiting. By default, the cPHulk blocks only last 24 hours so if waiting is an option you can wait.

During this period it is recommended to try and not log onto the server again in case your block is extended.

If after 24 hours of the last access time you still cannot access the server your ban you may want to consider contacting your hosting company. If they manage your server they may be able to help you reset the block or give further suggestions.

Resetting the cPHulk block

First you will need to check if you have definitely been blocked by cPHulk. This can be done by checking the iptables rules for the cPHulk ruleset. This can be checked by running the following command.

iptables -L cphulk -n --line-numbers

This lists all the iptable rules for the cPHulk ruleset. If there are a lot of addresses here you can filter it down to just the address you believe has been blocked by using grep. The first number on each line shows the rule number that each row belongs to. This number is important later if you want to delete the rule.

iptables -L cphulk -n --line-numbers | grep 192.168.0.1

Here I am looking to see if my IP address 192.168.0.1 is being blocked by cPHulk. If you see the IP you are looking for then this will confirm you are being blocked. This line will have the details of when the block will end.

If you want to go ahead and remove the block immediately you can run the following command.

iptables -D cphulk <line number>

Above <line number> needs to be replaced with the line number you obtained running the first command.

As soon as the iptable rule has been deleted you should be able to access the server. If this doesn’t work then you may want to see if your IP address appears multiple times.

Hopefully this has helped you unblock your IP address, if this doesn’t work I suggest contact your hosting company or posting a comment below.

 

 

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.