Closed
Description
What happened:
Enabling ModSecurity with OWASP CRS brings this warning log over and over again:
ModSecurity: Warning. Matched "Operator `Rx' with parameter `^[\d.:]+$' against variable `REQUEST_HEADERS:Host' (Value: `127.0.0.1:10246' ) [file "/etc/nginx/owasp-modsecurity-crs/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf"] [line "718"] [id "920350"] [rev ""] [msg "Host header is a numeric IP address"] [data "127.0.0.1:10246"] [severity "4"] [ver "OWASP_CRS/3.3.2"] [maturity "0"] [accuracy "0"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol"] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "capec/1000/210/272"] [tag "PCI/6.5.10"] [hostname "127.0.0.1"] [uri "/is-dynamic-lb-initialized"] [unique_id "1660057088"] [ref "o0,15v46,15"]
The responsible piece of code triggering it seems to be this one: https://github.com/kubernetes/ingress-nginx/blob/main/internal/nginx/main.go#L62-L78
What you expected to happen:
The warning log should not be there.
NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):
$ export POD_NAMESPACE=ingress-nginx
$ export POD_NAME=$(kubectl get pods -n $POD_NAMESPACE -l app.kubernetes.io/name=ingress-nginx --field-selector=status.phase=Running -o jsonpath='{.items[0].metadata.name}')
$ kubectl exec -it $POD_NAME -n $POD_NAMESPACE -- /nginx-ingress-controller --version
-------------------------------------------------------------------------------
NGINX Ingress controller
Release: v1.3.0
Build: 2b7b74854d90ad9b4b96a5011b9e8b67d20bfb8f
Repository: https://github.com/kubernetes/ingress-nginx
nginx version: nginx/1.19.10
-------------------------------------------------------------------------------
Kubernetes version (use kubectl version
):
$ kubectl version
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.10-eks-84b4fe6", GitCommit:"cc6a1b4915a99f49f5510ef0667f94b9ca832a8a", GitTreeState:"clean", BuildDate:"2022-06-09T18:24:04Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
How was the ingress-nginx-controller installed:
$ helm ls -A | grep -i ingress
ingress-nginx ingress-nginx 8 2022-08-18 11:58:41.0436789 +0200 CEST deployeingress-nginx-4.2.0 1.3.0
How to reproduce this issue:
Just deploy the latest Ingress via Helm and override the values with these ones:
controller:
config:
enable-modsecurity: "true"
enable-owasp-modsecurity-crs: "true" # See https://coreruleset.org/
Anything else we need to know:
N/A