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!

disable/enable a modsecurity rule thru ssh

Discussion in 'EasyApache' started by niceboy, Aug 4, 2018.

Tags:
  1. niceboy

    niceboy Active Member

    Joined:
    Sep 29, 2011
    Messages:
    40
    Likes Received:
    0
    Trophy Points:
    56
    cPanel Access Level:
    Root Administrator
    Is it possible to enable/disable a modsecurity rule(One of my custom rule) thru ssh? If yes, how to do it?

    thanks.
     
  2. dalem

    dalem Well-Known Member
    PartnerNOC

    Joined:
    Oct 24, 2003
    Messages:
    2,741
    Likes Received:
    76
    Trophy Points:
    203
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    edit
    /etc/apache2/conf.d/modsec/modsec2.user.con

    remove or comment out rule

    then restart Apache
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

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

    I recommend using the following WHM API 1 functions if you want to edit or remove a rule via the command line:

    WHM API 1 Functions - modsec_edit_rule - Developer Documentation - cPanel Documentation
    WHM API 1 Functions - modsec_remove_rule - Developer Documentation - cPanel Documentation

    Command line examples are available under the "Examples" section. You can review all Mod_Security WHM API 1 functions at:

    WHM API 1 Sections - ModSecurity - Developer Documentation - cPanel Documentation

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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