Repository navigation
Trust ca_cert_data in the websocket client - #2794
Open
Yohan-Senadheera wants to merge 1 commit into
Open
Yohan-Senadheera wants to merge 1 commit into
Yohan-Senadheera wants to merge 1 commit into
Conversation
Configuration.ca_cert_data is passed to urllib3 for REST calls, but create_websocket only used ssl_ca_cert and fell back to the certifi bundle. Exec, attach and port-forward then failed certificate verification when the cluster CA was given only as data. Build an SSL context with the CA data (and ssl_ca_cert, the client certificate and assert_hostname) and pass it to websocket-client. Signed-off-by: Yohan Senadheera <yohansenadheera@gmail.com>
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Yohan-Senadheera The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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.
What type of PR is this?
/kind bug
What this PR does / why we need it:
Configuration.ca_cert_dataworks for REST calls, because it is passed to urllib3. The websocket client ignores it:create_websocketonly readsssl_ca_certand otherwise trusts the certifi bundle. So with the cluster CA given only as data,list_namespaced_podworks but exec, attach and port-forward fail withCERTIFICATE_VERIFY_FAILED.websocket-client has no option for CA data, so when
ca_cert_datais set this builds an SSL context with it and passes it in. The context also loadsssl_ca_cert, the client certificate andassert_hostname, since websocket-client skips those options when a context is given.Tested against a kind cluster with only
ca_cert_dataset (no CA file):CERTIFICATE_VERIFY_FAILEDThe new unit tests fail on master and pass here. All
kubernetes/streamtests pass.Which issue(s) this PR fixes:
None filed.
Does this PR introduce a user-facing change?