-
Notifications
You must be signed in to change notification settings - Fork 498
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
Proxy: proxy protocol v2 #5028
Proxy: proxy protocol v2 #5028
Conversation
1624 tests run: 1551 passed, 0 failed, 73 skipped (full report)The comment gets automatically updated with the latest test results
f4b5622 at 2023-08-31T11:16:17.856Z :recycle: |
701bfaf
to
eed7ced
Compare
Reading through the specification:
It seems that deploy will be painful... |
Yeah I think that is unfortunate. I didn't implement that part of the specification and it will in fact guess whether the header is there |
|
I think I will change to this model eventually, but as you pointed out it makes migration extremely difficult. The only alternative is probably switching to a new NLB target with a new service/deployment but I don't think I want to go through that effort if it's unnecessary
That crate was a direct inspiration for my implementation. I can't really understand how I should use it though. It returns an error if we haven't read enough bytes which is quite complicated to deal with correctly from the looks of it. There's no way to know how many bytes to read unless we are the ones parsing the
Guessing is quite straightforward: Does the magic 12 bytes exist in the first payload.
For Postgres protocol, no valid postgres message starts with 0x0D (all message tags are currently valid ascii) so this is unambiguous. We don't plan on using the information for anything security-related yet, only for some nice extra info in error logs. When we switch to a non-guessing implementation we can consider using the IP addresses as security monitoring info.
If we merge as is, we should be able to update the NLB after the fact |
Ok, so it looks like hard-switch is not convenient and guessing is the only feasible option. I'll review today. |
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.
It's hard to test it with the real NLB, so would be nice to deploy it to staging sooner.
Yeah. I did test it locally with HAProxy using protocol v2 and it did work |
57cd156
to
f4b5622
Compare
Problem
We need to log the client IP, not the IP of the NLB.
Summary of changes
Parse the proxy protocol version 2 if possible
Checklist before requesting a review
Checklist before merging