Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    13

    Thumbs up HOW TO : ModSecurity

    Install or Update to version 1.9.3 all same
    Hello,
    Open Source Web Application Firewall
    ModSecurity at work

    ModSecurity is an open source intrusion detection and prevention engine for web applications (or a web application firewall). Operating as an Apache Web server module or standalone, the purpose of ModSecurity is to increase web application security, protecting web applications from known and unknown attacks.


    wget http://www.web4host.net/tools/modsecurity-apache1.sh
    chmod 755 modsecurity-apache1.sh
    sh modsecurity-apache1.sh

    Apache 2.x
    Code:
    wget http://www.web4host.net/tools/modsecurity-apache2.sh
    chmod 755 modsecurity-apache2.sh
    sh modsecurity-apache2.sh
    edit httpd.conf
    Code:
    nano -w /etc/httpd/conf/httpd.conf
    find mod_security then past this after

    Code:
    <IfModule mod_security.c>
    # Only inspect dynamic requests
    # (YOU MUST TEST TO MAKE SURE IT WORKS AS EXPECTED)
    #SecFilterEngine DynamicOnly
    
    SecFilterEngine On
    
    # Reject requests with status 500
    SecFilterDefaultAction "deny,log,status:500"
    
    # Some sane defaults
    SecFilterScanPOST On
    SecFilterCheckURLEncoding On
    SecFilterCheckCookieFormat On
    SecFilterCheckUnicodeEncoding Off
    SecFilterNormalizeCookies On
    # enable version 1 (RFC 2965) cookies
    SecFilterCookieFormat 1
    
    SecServerResponseToken Off
    
    #If you want to scan the output, uncomment these
    #SecFilterScanOutput On
    #SecFilterOutputMimeTypes "(null) text/html text/plain"
    
    # Accept almost all byte values
    SecFilterForceByteRange 1 255
    
    # Server masking is optional
    #fake server banner - NOYB used - no one needs to know what we are using
    SecServerSignature "Power MOD by web4host.net"
    
    #SecUploadDir /tmp
    #SecUploadKeepFiles Off
    
    # Only record the interesting stuff
    SecAuditEngine RelevantOnly
    SecAuditLog logs/audit_log
    
    # You normally won't need debug logging
    SecFilterDebugLevel 0
    SecFilterDebugLog logs/modsec_debug_log
    
    #Use one rules - Remove # to active Rules
    # V1.0
    #Include /etc/modsecurity/mini1.conf
    # V2.0
    #Include /etc/modsecurity/mini2.conf
    # V3.0
    #Include /etc/modsecurity/mini3.conf
    # V4.0
    #Include /etc/modsecurity/mini.conf
    # V5.0
    #Include /etc/modsecurity/mini.conf
    </IfModule>
    Search for ‘AddModule’ string, and make sure that AddModule mod_security.c

    Do a safe apache restart

    Code:
    /sbin/service httpd restart
    Remove # to active Rules (V1.0=low load / V5.0=more load)

    if you want update mini rules

    Code:
    wget http://www.web4host.net/tools/modsecurity-rule.sh
    chmod 755 modsecurity-rule.sh
    ./modsecurity-rule.sh
    If you use APF with big black list your server load gone higher then normal, use KISS and you will see stable & normal load

  2. #2
    Senior Member
    Join Date
    Apr 2008
    Location
    USA
    Posts
    535
    Nice how to.

    If you are receiving the error for mod_security, access denied with error code 403 then you can disable the mod_security for that account by adding a simple code in his .htaccess:

    SecFilterEngine Off
    SecFilterScanPOST Off

  3. #3
    Senior Member
    Join Date
    Oct 2009
    Posts
    827
    Use the below in httpd.conf in your cirtualhost.

    In cpanel server .htaccess does not disable mod_security

    <IfModule mod_security2.c>

    SecRuleEngine off
    </IfModule>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.