mirror of
https://github.com/fabriziosalmi/patterns.git
synced 2025-12-17 17:55:48 +00:00
This commit modifies the script to output two files: - waf_maps.conf (for http block) - waf_rules.conf (for server block) to avoid conflicts and provide more flexibility. This update should fix the bugged nginx rules integration on existing setups: https://github.com/fabriziosalmi/patterns/issues/8
1.0 KiB
1.0 KiB
Nginx WAF Configuration
This directory contains Nginx WAF configuration files generated from OWASP rules. You can include these files in your existing Nginx configuration to enhance security.
Usage
- Include the
waf_maps.conffile in yournginx.confinside thehttpblock:http { include /path/to/waf_patterns/nginx/waf_maps.conf; # ... other http configurations ... } - Include the
waf_rules.conffile in yourserverblock:server { # ... other server configurations ... include /path/to/waf_patterns/nginx/waf_rules.conf; } - Reload Nginx to apply the changes:
sudo nginx -t && sudo systemctl reload nginx
Notes
- The rules use
mapdirectives for efficient pattern matching. The maps are defined in thewaf_maps.conffile. - The rules (if statements) are defined in the
waf_rules.conffile. - Blocked requests return a
403 Forbiddenresponse by default. - You can enable logging for blocked requests by uncommenting the
access_logline.