ingress-nginx: Whitelist-source-range not working properly with PROXY protocol
BUG REPORT
NGINX Ingress controller version: 0.25.0
Kubernetes version (use kubectl version): 1.13.6
- Cloud provider or hardware configuration: AWS + ELB
- OS (e.g. from /etc/os-release): Debian GNU/Linux 9 (stretch)
- Kernel (e.g.
uname -a): 4.9.0-7-amd64 - Install tools: helm
- Others:
The configuration is simple: AWS, ELB in front of Nginx
Kubernetes installed with KOPS
Installed with helm with this configuration:
"use-proxy-protocol": "true" "whitelist-source-range": "<list of offices ips>"
What happened: I updated a nginx-ingress on a test cluster from v0.24.1 to 0.25.0 with helm. With version 0.24.1 work fine, with 0.25.0 I get 403 if I try to access the dashboard.
What you expected to happen: Nothing, only the update of nginx
How to reproduce it (as minimally and precisely as possible): Update the nginx-ingress
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 30 (8 by maintainers)
I can confirm this issue. It appears that 0.25.0 is matching the wrong IP against the whitelist when using the PROXY protocol. It matches the load balancer IP against cidrs defined by the ingress annotation. Afterwards, it logs the correct client ip though.
This is a redacted part of our logs with 0.25.0:
If my Ingress is annotated with
nginx.ingress.kubernetes.io/whitelist-source-range=<REAL CLIENT IP>/32, this is the result. If I update the annotation tonginx.ingress.kubernetes.io/whitelist-source-range=<LOAD BALANCER IP>/32, it allows access (but for every client, since it’s the load balancer’s IP).Our setup is not unusual, it’s a TCP HAProxy with PROXY protocol enabled in front of nginx-ingress. This issue might break white- and blacklists for everyone running a similiar setup.
Edit: Our Helm values for the
stable/nginx-ingressChart; Chart version 1.11.4:@aledbf knock knock… sorry to bother you but we are growing 👯♂
yeah, we are getting this also.
I did no investigation because I did not have the time, but the new version (0.25.0) I get 403’d but the old version works fine(0.24.0).
Maybe the end of the week.
To those affected by this issue, please use the image
quay.io/kubernetes-ingress-controller/nginx-ingress-controller:dev(current master) that contains the refactoring #4557I’m ashamed to admit it, but at least from my side this issue does not apply anymore as well, but not because of #4557 but rather because I finally added
externalTrafficPolicy: Localto my Helm values. Classic “didn’t fully read the docs” on my side, sorry.That being said something changed regarding that from 0.24.x to 0.25.x because it worked before. Just as an interesting tidbit. I guess it should have not worked in the first place.
I’ve the same symptoms on my side. What could I provide to help you ?
I’m using OVH Manages Kubernetes with an HAProxy in front of the nginx-ingress-controller.
Confirm that it work with
0.24.1version.@aledbf hi, have you tried reproducing this with the Helm Chart config (https://github.com/kubernetes/ingress-nginx/issues/4305#issuecomment-516442084) and HAProxy config (https://github.com/kubernetes/ingress-nginx/issues/4305#issuecomment-519393468) I shared?
This issue is still present for us and prevents us from updating to 0.25.1 and therefore incorporating the CVE patches.
Hi @aledbf are you able to reproduce this with a static HAProxy configuration? I posted my Helm Chart values above, this is a minimal snippet for HAProxy that mirrors our setup:
(our setup works pre 0.25.0 and stops working when updating to 0.25.0 without any other changes)