Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Apr 2003
    Posts
    20

    Default How to disable mod_security2 rule for one domain?

    Hello,

    I'm getting this error message:
    Code:
    Not Acceptable
    
    An appropriate representation of the requested resource /admin/index.php could not be found on this server.
    And I've been told that I have to add this in .htaccess:
    Code:
    <IfModule mod_security.c>
       SecFilterEngine Off
       SecFilterScanPOST Off
    </IfModule>
    Which is impossible now.

    I've tried to add it in httpd.conf but didn't solve the problem.

    How can I solve this? OR Disable mod_sec on one domain?
    Regards,
    Khalid

  2. #2
    Member
    Join Date
    Mar 2004
    Location
    India
    Posts
    6

    Post

    Code:
    <IfModule mod_security.c>
    SecRuleEngine Off
    </IfModule>
    this will work ...
    Impossible = "I" "m" "Possible".

  3. #3
    Member
    Join Date
    Apr 2004
    Posts
    10

    Default

    Quote Originally Posted by bidhata View Post
    Code:
    <IfModule mod_security.c>
    SecRuleEngine Off
    </IfModule>
    this will work ...
    This does not seem to work after a while. Instead, we used this method to disable it for specific domains:

    The only way to bypass mod_security2 in Apache 2 is to manually edit httpd.conf. However, as cPanel autogenerates this, one must directly edit the httpd template files that cPanel uses to generate the httpd.conf. Namely, in /var/cpanel/templates/apache2/vhost.default

    Add the following line before the </VirtualHost> closing tag


    Code:
    [&#37; IF vhost.servername == 'domain.com' || vhost.servername == 'domain2.com' -%]
    ## CUSTOM RULE BY POLURNET.COM TO BYPASS MOD_SECURITY2 FOR SPECIFIC DOMAINS
    <IfModule mod_security2.c>
    SecRuleEngine Off
    </IfModule>
    [% END -%]

    After adding this, you must also remember to re-generate the template (run /usr/local/cpanel/bin/build_apache_conf) and restart Apache/httpd, otherwise changes won't take effect.

  4. #4
    Member
    Join Date
    Aug 2002
    Posts
    1,120

    Default

    Just create a directory:

    mkdir -p /usr/local/apache/conf/userdata/std/2/username/domain.com

    Then create a file:

    /usr/local/apache/conf/userdata/std/2/username/domain.com/mod_security.conf

    In that file add:

    <IfModule mod_security.c>
    SecRuleEngine Off
    </IfModule>


    Save it.

    Then run:

    /scripts/ensure_vhost_includes --user=username

  5. #5
    Member
    Join Date
    Apr 2007
    Posts
    8

    Default

    Any new/simple way to disable mod_security2 for just one domain .. after 2 years of this thread was started ??

    I'm using cPanel 11.24.4-S35075 - WHM 11.24.2 - X 3.9
    Apache2 / suPHP / mod_security2

    I found a comment on a blog:

    SecRule SERVER_NAME “domain.com” phase:1,nolog,allow,ctl:ruleEngine=off

    this should be added to modsec2.conf ?

    For now, to solve the problem one website had with a flash uploader I have removed the rule marked with red, on the bellow code

    #spam bots
    SecRule HTTP_User-Agent "DTS Agent"
    SecRule HTTP_User-Agent "POE-Component-Client"
    SecRule HTTP_User-Agent "WISEbot"
    SecRule HTTP_User-Agent "^Shockwave Flash"
    SecRule HTTP_User-Agent "Missigua"


    10x

  6. #6
    Registered User
    Join Date
    Jan 2011
    Posts
    2

    Default Re: How to disable mod_security2 rule for one domain?

    Thanks that helped me with a similar issue.

  7. #7
    Member This forum account has been confirmed by cPanel staff to represent a vendor.
    Join Date
    Apr 2008
    Posts
    80

    Default Re: How to disable mod_security2 rule for one domain?

    SecRule SERVER_NAME “domain.com” phase:1,nolog,allow,ctl:ruleEngine=off

    this should be added to modsec2.conf ?
    Close, make sure you anchor the end otherwise you may match on something else, and escape your "."s:

    SecRule SERVER_NAME "\.example\.com$" "phase:1,nolog,noauditlog,allow,ctl:ruleEngine=Off"

    https://www.atomicorp.com/wiki/index...ity_per_domain

    And dont auditlog.
    Michael Shinn
    Prometheus Global - home of gotroot.com and Atomicorp and
    Secure Your Server Now with Atomic Secured Linux!

Similar Threads & Tags
Similar threads

  1. How to disable mod_security2 for one folder
    By casey in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-20-2009, 12:09 AM
  2. Rules for mod_security2
    By casey in forum cPanel and WHM Discussions
    Replies: 20
    Last Post: 05-29-2008, 05:36 AM
  3. Replies: 2
    Last Post: 02-06-2008, 02:33 PM
  4. mod_security2 rules
    By mikeyman in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 02-06-2008, 11:28 AM
  5. mod_security2 - how to disable it via .htaccess ?
    By WebHostDog in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 10-25-2007, 05:35 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube