As stated in the NGINX ingress controller documentation, you have to enable the ModSecurity module in the ConfigMap for it to work and it starts by default in DetectionOnly mode with recommended configuration
As for the OWASP ruleset, you can set this annotation:
nginx.ingress.kubernetes.io/enable-owasp-core-rules: "true"
Or you can include it in the nginx.ingress.kubernetes.io/modsecurity-snippet
annotation. It’s important to notice that those annotations can’t be used together, as only the second one (snippet) will be read if you do so.
A simple example would be:
nginx.ingress.kubernetes.io/modsecurity-snippet: |
SecRuleEngine On
SecDebugLog /tmp/modsec_debug.log
Include /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf