How to Implement ModSecurity
OWASP Core Rule Set in Nginx
If you were securing Nginx with Mod Security then you would like to have
OWASP core rule set (CRS) activated to protect from following threats.
HTTP protocol violation protection
Common web attacks
Bots, crawlers, malicious activity protection
Trojan protection
Information leakage protection
Cross Site Scripting attacks
SQL injection attacks
ModSecurity is open source Web Application Firewall (WAF) and by default,
it’s configured to detect only. That means you need to enable the necessary
configuration (as following) in order to start protecting your websites.
1. Download ModSecurity CRS
2. Download latest CRS zip file from the following link and transferred to
the server
https://github.com/SpiderLabs/owasp-modsecurity-
crs/zipball/master
3. unzip the file
unzip SpiderLabs-owasp-modsecurity-crs-2.2.9-26-gf16e0b1.zip
4. Copy following to nginx conf folder
modsecurity_crs_10_setup.conf.example
base_rules
5. Configure Nginx to Integrate OWASP ModSecurity CRS.
Since you have decided to use OWASP CRS, you need to merge the conf file
included in SpiderLabs OWASP CRS, which you just copied
(modsecurity_crs_10_setup.conf.example ) under nginx folder.
Nginx doesn’t support multiple ModSecurityConfig directives like Apache so
you need to put all rules conf together in a single file.