panit

Active Member
Aug 14, 2013
35
1
58
cPanel Access Level
Reseller Owner
I'm a hosting reseller on a dedicated server. The server was recently upgraded and now runs apache 2.4, CloudLinux and cpanel 68.0.33. Prior to the upgrade, blocking an IP via the IP Deny Manager would work. Now it doesn't. What IP's are entered are added to the .htaccess file but the IP still gets through.

My host has not been able to resolve this issue. I read on the web that the new Reserved should be used so I tried that - still didn't work. If I add the IP to the servers CSF the IP will be blocked. Below are some of the variations I've tried to block an IP using the .htaccess file of the account. Does anyone know of a reason for this not working?

Code:
<RequireAll>
Require all granted
Require not ip 171.25.193.27
</RequireAll>

Order Allow,Deny
Deny from 171.25.193.27
Allow from all

<Files "*">
order deny,allow
deny from 171.25.193.27
</files>
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,216
463
Hello,

Could you ask your hosting provider to let us know of any output to /usr/local/cpanel/logs/error_log when using the "IP Blocker" option to add a new blocked IP? Also, what are the permissions/ownership values on the account's .htaccess file?

Thank you.
 

panit

Active Member
Aug 14, 2013
35
1
58
cPanel Access Level
Reseller Owner
There aren't any errors in that log and the permissions are -rw-r--r--.

I tried adding my own IP via IP Deny Manager to test for errors and found that I wasn't blocked. But I noticed that cpanel only adds the line deny from IP# to the .htaccess file. So I removed all of the <files>, order... and allow from statements, leaving only deny from statements and all of the blocking started working.

As a test, I added this:

deny from my IP

order deny, allow
deny from some other IP
allow from all

The above allowed me to view the site. Changing the above to the following blocked me again.

deny from my IP
deny from some other IP

Are those commands no longer valid? Or is there some module that needs to be installed in this version of apache/cpanel that isn't done automatically?
 

rpvw

Well-Known Member
Jul 18, 2013
1,101
458
113
UK
cPanel Access Level
Root Administrator
You might like to try the apache 2.4 method eg
Code:
<RequireAll>
   Require all granted
   Require not ip 10.252.46.165
</RequireAll>
That should block access from 10.252.46.165 and allow everyone else.

I have had mixed success using these newer formats (but it was probably my fault for getting syntax wrong)

More details from Access Control - Apache HTTP Server Version 2.4
 

panit

Active Member
Aug 14, 2013
35
1
58
cPanel Access Level
Reseller Owner
This appears to be working now. There was a notice in WHM saying a reboot was needed to apply changes from the last update. Once that was done, the problem went away. No way to know if it was due to some setting in cpanel not being applied or just something hung up on the server, though the latter is probably correct. My thanks for the help and apologies for wasting time on this.