Repository navigation
Conversation
… Apache HttpClient 5.6+ With hostname_verification=NONE the remote driver is supposed to skip TLS hostname verification. On Apache HttpClient 5.6 or newer it does not: connections to a server whose certificate does not name the URL host fail during the handshake with "No subject alternative DNS name matching <host> found". The driver creates its DefaultClientTlsStrategy with a HostnameVerifier but without a HostnameVerificationPolicy and relies on the default. Up to HttpClient 5.5 that default was CLIENT, so the NoopHostnameVerifier was the only check. Since 5.6 a strategy with a verifier defaults to BOTH (and one without a verifier to BUILTIN); either policy enables the JSSE endpoint identification during the handshake, and the verifier has no influence on that check. Set the policy explicitly: CLIENT with NoopHostnameVerifier for NONE, and BOTH with the default verifier for STRICT, which matches the current HttpClient default. The three-argument constructor exists since HttpClient 5.4, so the fix also compiles against the current dependency. The new SslHostnameVerificationTest passes on HttpClient 5.5 with and without the fix; it only fails on 5.6 or newer without it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes CALCITE-7796.
This PR sets the hostname verification policy explicitly using the three-argument constructor that exists since HttpClient 5.4:
NONEusesHostnameVerificationPolicy.CLIENTwithNoopHostnameVerifier, so no hostname check runs.STRICT(the default) usesHostnameVerificationPolicy.BOTHwith the default verifier. This keeps the HttpClient verifier that ran before and additionally enables the JSSE check, which is what HttpClient 5.6 does by default.I didn't update the httpclient5 in this PR, since the fix compiles and behaves the same on 5.5 (where there is no bug). I verified
SslHostnameVerificationTestagainst both versions locally.