Skip to content

Can`t disable ModSecurity logging into the nginx-ingress-controller pods #5521

@ghost

Description

NGINX Ingress controller version: 0.31.1

Kubernetes version (use kubectl version): v1.16.2

What happened:

Nginx use default config from /etc/nginx/modsecurity/modsecurity.conf:

SecAuditEngine RelevantOnly
SecAuditLog /var/log/modsec_audit.log
SecAuditLogStorageDir /var/log/audit/

And I cant rewrite it via nginx.ingress.kubernetes.io/modsecurity-snippet. I am trying different configurations but cant disable logging into container:

kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/enable-modsecurity: "true"
    nginx.ingress.kubernetes.io/modsecurity-snippet: |
      Include /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf
      SecRuleEngine On
      SecAuditEngine Off

or

kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/enable-modsecurity: "true"
    nginx.ingress.kubernetes.io/modsecurity-snippet: |
      Include /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf
      SecRuleEngine On
      SecAuditEngine Off
      SecAuditLog /dev/null
      SecAuditLogStorageDir /dev/null

or

kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/enable-modsecurity: "true"
    nginx.ingress.kubernetes.io/modsecurity-snippet: |
      Include /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf
      SecRuleEngine On
      SecAuditLog /dev/stdout
      SecAuditLogStorageDir /dev/stdout

and so on ...

The only way is to delete the file /var/log/modsec_audit.log and /var/log/audit/ dir:

rm -rf /var/log/audit/
rm /var/log/modsec_audit.log

What you expected to happen:

No logging into /var/log/modsec_audit.log and /var/log/audit/ dir

Only stdout

How to reproduce it:

Try to disable ModSecurity logging into the nginx-ingress-controller pods

/kind bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions