Home arrow JavaScript arrow Using Mod_Security to Protect Your Server
JAVASCRIPT

Using Mod_Security to Protect Your Server


In this conclusion to a five-part series on securing your web server, we focus on mod_security. This article is excerpted from chapter four of Securing Ajax Applications: Ensuring the Safety of the Dynamic Web, written by Christopher Wells (O'Reilly, 2007; ISBN: 0596529317). Copyright © 2007 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

Author Info:
By: O'Reilly Media
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
October 09, 2008
TABLE OF CONTENTS:
  1. · Using Mod_Security to Protect Your Server
  2. · Actions
  3. · PHP
  4. · Application Server Hardening

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Using Mod_Security to Protect Your Server
(Page 1 of 4 )

Installation 

You can get the mod_security packages using apt:

  apt-get install libapache2-mod-securit y
  a2enmod mod-security
  /etc/init.d/apache2 force-reload

The file /etc/httpd/conf.d/mod_security.conf should now exist.

Basic configuration

mod_security.conf contains an example mod_security configuration. The example configuration has a lot of stuff in it that we may not need, so I recommend trimming the file down a bit and starting with the basics:

contains an example configuration. The example configuration has a lot of stuff in it that we may not need, so Irecommend trimming the file down a bit and starting with the basics:

  <IfModule mod_security.c>
     
# Turn the filtering engine On or Off
      SecFilterEngine On 

      # Make sure that URL encoding is valid
     
SecFilterCheckURLEncoding On

      # Unicode encoding check
      SecFilterCheckUnicodeEncoding Off

      # Only allow bytes from this range
      SecFilterForceByteRange 0 255

      # Only log actionable requests
      SecAuditEngine RelevantOnly 

      # The name of the audit log file
      SecAuditLog /var/log/apache2/audit_log 

      # Debug level set to a minimum
      SecFilterDebugLog /var/log/apache2
/modsec_debug_log
      SecFilterDebugLevel 0

      # Should mod_security inspect POST payloads
     
SecFilterScanPOST On

      # By default log and deny suspicious requests
      # with HTTP status 500
      SecFilterDefaultAction "deny,log,status:500" 

      # Add custom secfilter rules here

  </IfModule>

From here, we can look at what actions we can configure.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks
- Dynamic jQuery Styling

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials