-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Switch to rely on Netty for Hostname Verification #15824
Conversation
@michaeljmarshall:Thanks for your contribution. For this PR, do we need to update docs? |
2 similar comments
@michaeljmarshall:Thanks for your contribution. For this PR, do we need to update docs? |
@michaeljmarshall:Thanks for your contribution. For this PR, do we need to update docs? |
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.
Lgtm
/pulsarbot rerun-failure-checks |
1 similar comment
/pulsarbot rerun-failure-checks |
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.
Lgtm
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.
LGTM
I have a quest:
If a subjectAltName extension of type dNSName is present, that MUST
be used as the identity. Otherwise, the (most specific) Common Name
field in the Subject field of the certificate MUST be used. Although
the use of the Common Name is existing practice, it is deprecated and
Certification Authorities are encouraged to use the dNSName instead.
Do your changes follow up on this rule?
There are 2 test failures:
I debugged and fixed the first one. The test was invalid. One observation is that when the handshake fails because of hostname verification, the client will keep on retrying for some time. Here's an example log: https://gist.github.com/lhotari/8455fc155e0c7526398f36e9bd0bd88c |
I got both failing tests fixed. I pushed my change to my fork and I'm running tests there: lhotari#72 |
@michaeljmarshall I'll rebase this PR and include my changes to fix the tests. I hope this is fine. |
@michaeljmarshall It seems that when you opened the PR you didn't grant access to others for collaborating in the PR. I pushed changes to my fork in master...lhotari:use-netty . one way to make your branch to match the changes:
|
@lhotari thank you for finding and fixing those tests! I just gave maintainers access to collaborate. If you’re no longer available to push, I’ll get the commits in soon. |
037d982
to
9bb660e
Compare
* Switch to relying on Netty for Hostname Verification - Add "subjectAltName = DNS:localhost, IP:127.0.0.1" to unit test certs Co-authored-by: Lari Hotari <lhotari@apache.org> (cherry picked from commit aa7700d)
* Switch to relying on Netty for Hostname Verification - Add "subjectAltName = DNS:localhost, IP:127.0.0.1" to unit test certs Co-authored-by: Lari Hotari <lhotari@apache.org> (cherry picked from commit aa7700d)
* Switch to relying on Netty for Hostname Verification - Add "subjectAltName = DNS:localhost, IP:127.0.0.1" to unit test certs Co-authored-by: Lari Hotari <lhotari@apache.org> (cherry picked from commit aa7700d)
* Switch to relying on Netty for Hostname Verification - Add "subjectAltName = DNS:localhost, IP:127.0.0.1" to unit test certs Co-authored-by: Lari Hotari <lhotari@apache.org> (cherry picked from commit aa7700d)
@michaeljmarshall Please provide a correct documentation label for your PR. |
- add 2 suppressions. - CVE-2023-37475 is a false positive - CVE-2023-4586 is about Netty hostname verification and that is already covered in Pulsar code base with apache#15824 changes.
Motivation
Currently, we perform hostname verification for the Java Client and the Proxy Java Client using a custom Pulsar hostname verifier. In order to simplify the code, I propose that we refactor these clients so they rely on a Netty, its SslHandler, and the JVM, to perform the hostname verification.
When
HTTPS
is configured as the endpoint verification algorithm, it uses RFC 2818 to perform hostname verification. This is defined by theJava Security Standard Algorithm Names
documentation for JDK versions 8, 11, and 17. Here are the official docs:Modifications
HTTPS
for endpoint verification and remove unnecessary custom hostname verification logic.DirectProxyHandler
class so that it configures the SslHandler to perform hostname verification and so that the proxy handler itself does not perform that verification.HttpClient
used by the HTTP Lookup Client code in the Java Client. Currently, it defaults to being always enabled.Verifying this change
There are tests that already cover the changes, and I performed integration testing on a minikube cluster with Cert-Manager created certs.
Does this pull request potentially affect one of the following parts:
This change deprecates support for CN matching in the Pulsar Java Client. A future change should remove this support from the Pulsar Admin Client, which relies on Pulsar's verifier that still supports CN matching.
Documentation
There is no need for documentation. This is an internal change.
doc-not-needed