-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix Request.isSecure() when proxy offloads TLS and then sends PROXY-V2 information to the backend #14194
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
base: jetty-12.1.x
Are you sure you want to change the base?
Fix Request.isSecure() when proxy offloads TLS and then sends PROXY-V2 information to the backend #14194
Conversation
…2 information to the backend Signed-off-by: Ludovic Orban <lorban@bitronix.be>
* Added test to show how to forward V2.Tag information in ProxyHandler.Reverse. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
| } | ||
|
|
||
| proxyEndPoint = new ProxyEndPoint(endPoint, local, remote, tlvs, client == 0 ? null : EndPoint.SslSessionData.from(null, null, sslCipher, null)); | ||
| proxyEndPoint = new ProxyEndPoint(endPoint, local, remote, tlvs, (client & PP2_CLIENT_SSL) == 0 ? null : EndPoint.SslSessionData.from(null, null, sslCipher, null)); |
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.
I think this should be reverted, because client == 2 or client == 4 also mean that the connection was secured.
| public static final int TYPE_SSL = 0x20; | ||
| public static final int CLIENT_SSL = 0x01; | ||
| public static final int SUBTYPE_SSL_VERSION = 0x21; | ||
| public static final int SUBTYPE_SSL_CIPHER = 0x23; |
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.
Those constants are already declared in ProxyV2ConnectionFactory although private. If we have to duplicate them, I'd very much prefer that the duplication is in test code.
I'm also not fond of the fact that those constant names don't exactly match the ones defined in the spec (all the same but with the PP2_ prefix).
|
|
||
| List<V2.Tag.TLV> tlvs = List.of(); | ||
| if (secure) | ||
| tlvs = List.of(new V2.Tag.TLV(V2.Tag.TLV.TYPE_SSL, new byte[]{V2.Tag.TLV.CLIENT_SSL})); |
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.
My version used to test both 1 (PP2_CLIENT_SSL) and 2 (PP2_CLIENT_CERT_CONN) as the PROXY protocol specification chapter 2.2.6 (The PP2_TYPE_SSL type and subtypes) states that the client connected over SSL/TLS only when PP2_CLIENT_SSL (bit 0) is 1.
* Renamed constants adding PP2_ prefix as per the specification. * Improved test case. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixes #14134