cd into the extracted directory and build the module for your Apache:
At this point your Apache should be restarted and running with ModSecurity. To add the default rules, you'll need to edit the Apache config:
<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 suspicious requests
SecAuditEngine RelevantOnly
# The name of the audit log file
SecAuditLog /var/log/audit_log
# Debug level set to a minimum
SecFilterDebugLog /var/log/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"
# Prevent drop table SQL injection
SecFilter "drop[[:space:]]table"
# Only inspect dynamic requests
# (YOU MUST TEST TO MAKE SURE IT WORKS AS EXPECTED)
SecFilterEngine DynamicOnly
# Reject requests with status 403
SecFilterDefaultAction "deny,log,status:403"
SecFilterSelective SCRIPT_FILENAME "export\.php$" chain
SecFilterSelective ARG_what "\.\."
SecFilterSelective "HTTP_Via" "pinappleproxy"
</IfModule>
If all goes well Apache should happily return something along the lines of:
Ta-Da. Your Apache should now be protected from injection attacks and in my short experience, most spammers. The module config added to httpd.conf is the basic for ModSecurity to do its job. I've included the PinappleProxy-- which I find 80% of my spam load comes from.
great tutorial, thank you very much! It helped with a redhat install I was trying to do. Just for people trying, note that the lines for the httpd.conf, they may copy over as curly quotes which may cause you trouble.
Doh. Curly quotes fixed. Thanks
very easy tin install and to configure. The only one trouble was/is configuring the chroot... I keep working on it