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!

csf.conf not rotating csf.deny entires?

Discussion in 'Security' started by Scott Galambos, Jul 13, 2018.

Tags:
  1. Scott Galambos

    Scott Galambos Active Member

    Joined:
    Jul 13, 2016
    Messages:
    38
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    I have a problem I think. I'm running cPanel 72.0.7. I have mod_security2 blocking wp-login.php hack attempts. It works fine. Entires are added to /etc/csf.deny automatically per the rule.

    Problem is when my csf.deny hits the DENY_IP_LIMIT (set to 2000) defined in csf.conf, it does not rotate and remove the old entries automatically. I start to get flooded because its not blocking. As per the comment is it not suppose to remove old entries?

    "if the limit is reached, the entries will be rotated so that the oldest
    entries (i.e. the ones at the top) will be removed and the latest is added."

    Any idea?
     
    #1 Scott Galambos, Jul 13, 2018
    Last edited: Jul 13, 2018
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,309
    Likes Received:
    393
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You might try setting it to another number, 1500 for example, save and restart. Then add an IP manually, to block it. When you save that, you should see output removing 500 items from the list.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. fuzzylogic

    fuzzylogic Well-Known Member

    Joined:
    Nov 8, 2014
    Messages:
    85
    Likes Received:
    46
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    My idea is that you have misinterpreted the observation that an ip was not added to the cfs.deny list when you expected it to be.
    If you have the cfs settings...
    LF_MODSEC = 5
    LF_MODSEC_PERM = 1
    You may expect 5 hits from your modsec wp-login.php rule to be enough to satisfy the conditions to be added to the cfs.deny list.
    That is not necessarily the case.

    cfs uses the lfd to parse apache error_log lines for the line fragment "Access denied with code 40*"
    If 5 lines with that fragment are present for a particular ip then it is added to the cfs.deny list.

    For Modsecurity to write that line in the apace error_log either the ruleset default action must be set to log...
    Code:
    SecDefaultAction "phase:1,log,auditlog,pass"
    Note the word log.

    Or the rule in question must override the default action by including "log" in its actions.
    Code:
    SecRule REQUEST_FILENAME "@endsWith wp-login.php" \
            "msg:'wp-login rule is being hit',\
            id:1111111,\
            log,\
            deny"
     
    cPanelMichael and Infopro like 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