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!

ModSecurity add & remove rule for a domain

Discussion in 'Security' started by Volt55, Sep 16, 2018.

Tags:
  1. Volt55

    Volt55 Member

    Joined:
    Feb 20, 2017
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    Hi. I have multiple domains on my server protected with ModSecurity tools.

    I use a rule (Default HTTP policy: restricted_extensions rule 900240) in ModSecurity that I wish to remove for a single domain BUT replace it with another rule that is very similar and allows access to a certain file extension.

    I have copied the new rule and created my variant for the single domain. How can I achieve this?
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,896
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Volt55,

    The ModSecurity Domain Manager feature will allow you to completely enable or disable ModSecurity on account, but it doesn't allow an individual cPanel user to configure specific rules per domain. I recommend using a third-party plugin such as ConfigServer ModSecurity Control if you'd like to easily configure individual ModSecurity rules per account:

    ConfigServer ModSecurity Control (cmc)

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    201
    Likes Received:
    47
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    I haven't tried the plugins Michael is referring to, but you can select for a domain in your custom rule by adding the following type of SecRule to your new rule:
    Code:
    SecRule SERVER_NAME "thedomain.com" "t:lowercase"
    To exempt a domain, you can use:
    Code:
    SecRule SERVER_NAME "!@streq thedomain.com" "t:lowercase"
    You might run into issues with editing an existing rule, so you may want to create your own custom rule for the existing one and disable the existing rule.
     
    cPanelMichael likes 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