Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Blocking IPs fail

Discussion in 'Security' started by panit, Mar 22, 2018.

Tags:
  1. panit

    panit Member

    Joined:
    Aug 14, 2013
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    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>
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,711
    Likes Received:
    1,791
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. panit

    panit Member

    Joined:
    Aug 14, 2013
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    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?
     
  4. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    669
    Likes Received:
    223
    Trophy Points:
    43
    Location:
    Spain
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,711
    Likes Received:
    1,791
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. panit

    panit Member

    Joined:
    Aug 14, 2013
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice