-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modsecurity log dosent use $request_id from nginx when modsec blocks (403) #11288
Comments
This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/remove-kind bug
|
/triage needs-information |
I will try to see if I can do that
We use hostports on controller and have haproxy in front of the cluster |
thanks for updating.
|
I would test in stages ;
|
/kind support |
if you meant to say you can reproduce on minikube, then please do this. From your minikube cluster, copy/paste the output of commands here in one single post;
|
You can actually reduce he clutter here by deleting less informative posts and posting all that important minikube info in the original issue-description |
Also, the controller v1.10.x is using nginx v1.25 (it was v1.21 earlier) so have to check if any upstream nginx changes impacted your log_format or nginx_vars or mosec config etc |
Thanks. I asked for those command outputs so I can reproduce. I suspect that if there is a genuine problem and if it is caused by the controller, then maybe the upgrade of the inernal component nginx (stating that nginx is a component of the controller) from v1.21 to v1.25 has introduced changes that are related. |
I will se what I can do, some of this commands extract information that might be sesitive for us, but parts of it I might be able to anonymize |
Im stuck at the moment, I cant reproduce it in minkube. One differense between minikube and our kluster is that we use containerd (ver 1.7.10) and not docker, unfortunately I dont seem to have the knowlege to run minikube on containerd. |
Deleted most of my "clutter" post and closing this issue unresolved |
@husa570 we can do a zoom session if you think you are ok with that way to make progress |
Thanks but this was another deadend. Minkube worked as expected
The request
And the log, everything works as expected
|
The modsecurity log dosent have the same transaction_id (unique_id in the log) as the nginx log (request_id)
I have rename all "sensitive internal" info below
I have tested custom error pages in this cluster earlier (about a year ago) but after that we hade upgraded the ingress so that config is (hopefully) gone.
The ingress have the annotation
and the config in the controller have
modsecurity_transaction_id "$request_id";
set under location / for that ingressNginx log with request_id=eeb4c975-6097-4bc8-9456-e22ae7c866ce
Modsec log with unique_id=0cb9025a0230b70127cc25f7591ef443
The interesting part of annotions. In the ingress I have comment out some rule examples
kubectl exec -it -n ingress-nginx ingress-nginx-controller-8kgrl -- /nginx-ingress-controller --version
The nginx config for the ingress
kubectl exec -it -n ingress-nginx ingress-nginx-controller-8kgrl -- cat /etc/nginx/nginx.conf
Kubernetes version:
kubectl version
Client Version: v1.28.4
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.0
Environment:
** :
kubectl get nodes -o wide
helm ls -A | grep -i ingress
helm -n ingress-nginx get values ingress-nginx
Current State of the controller:
kubectl describe ingressclasses
kubectl -n ingress-nginx describe pod ingress-nginx-controller-8kgrl
kubectl -n ingress-nginx describe svc
kubectl get -n ingress-nginx all,ing -o wide
kubectl -n echo describe ingress waf-ingress
The text was updated successfully, but these errors were encountered: