-
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
Allow overriding real_ip_recursive #8366
base: main
Are you sure you want to change the base?
Conversation
Welcome @tomaspinho! |
Hi @tomaspinho. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
@tomaspinho thanks for contributing to this long pending issue. Helps a lot. Any chance that a e2e test can be added that simulates the complete event sequence from a client spoofing the ip with X-Forward-For header and the controller picking one the last "real" client_ip_address. |
It's my first time contributing to this project, so I have to learn how to run and write e2e tests. I hope to have some time this weekend to take a look at this. Thanks @longwuyuan |
@longwuyuan turns out writing the e2e test was way easier than I expected! You folks have done an amazing job here 🤩 Added an e2e test exercising both cases for the flag. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
looks like this PR was abandoned but it addresses a vital issue. Are there any chances to merge? |
✅ Deploy Preview for kubernetes-ingress-nginx ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tomaspinho The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…ving unnessary Sprintfs
@@ -790,6 +795,7 @@ func NewDefault() Configuration { | |||
ErrorLogLevel: errorLevel, | |||
UseForwardedHeaders: false, | |||
EnableRealIP: false, | |||
EnableRealIPRecursive: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be disabled by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a "problem" with this approach of a flag defaulted to true: if you set it as false on your configmap, it may or may not represent as empty (depending on the marshaller, eg using omitempty on json flag) so because it is empty it will be defaulted to...true :)
To confirm this behavior, can you add some e2e test with both EnableRealIPRecursive = true or false on the configmap, and check if the template is rendered correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rikatz ,
I've set the default to false
. My initial reasoning for it to be true
was that I think the more secure option should be enabled by default if it doesn't otherwise impact any functionality. Because the setting itself is dependent on EnableRealIp
being set to true
, the more secure configuration would be the default when EnableRealIp
would be used. This is a taste thing, and not a deal breaker for getting this merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nginx default is off, so let's set this to false.
/retest |
/triage accepted |
/ok-to-test |
What this PR does / why we need it:
Allows control over
real_ip_recursive
, fixing problem shown in issues like: #4073We are using this to fix a
X-Forwarded-For
spoofing issue we found while using AWS ALB as a service load balancer. Turns out they respect upstreamX-Forwarded-For
and don't allow us to strip/replace them, causing NGINX Ingress Controller to take the first value of the header as the defacto client IP, which can be spoofed.Types of changes
Which issue/s this PR fixes
#4073
How Has This Been Tested?
Checklist: