Skip to content

Commit

Permalink
respect the webpki-roots feature on the OAuth & OIDC clients
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Wilken <[email protected]>
  • Loading branch information
ewilken committed Sep 28, 2024
1 parent 05eee2e commit f5c33fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion kube-client/src/client/auth/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,19 @@ impl Gcp {
// Current TLS feature precedence when more than one are set:
// 1. rustls-tls
// 2. openssl-tls
#[cfg(feature = "rustls-tls")]
#[cfg(all(feature = "rustls-tls", not(feature = "webpki-roots")))]
let https = hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.map_err(Error::NoValidNativeRootCA)?
.https_only()
.enable_http1()
.build();
#[cfg(all(feature = "rustls-tls", feature = "webpki-roots"))]
let https = hyper_rustls::HttpsConnectorBuilder::new()
.with_webpki_roots()
.https_only()
.enable_http1()
.build();
#[cfg(all(not(feature = "rustls-tls"), feature = "openssl-tls"))]
let https =
hyper_openssl::HttpsConnector::new().map_err(Error::CreateOpensslHttpsConnector)?;
Expand Down
8 changes: 7 additions & 1 deletion kube-client/src/client/auth/oidc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,19 @@ impl Refresher {
.install_default()
.unwrap();

#[cfg(feature = "rustls-tls")]
#[cfg(all(feature = "rustls-tls", not(feature = "webpki-roots")))]
let https = hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.map_err(|_| errors::RefreshInitError::NoValidNativeRootCA)?
.https_only()
.enable_http1()
.build();
#[cfg(all(feature = "rustls-tls", feature = "webpki-roots"))]
let https = hyper_rustls::HttpsConnectorBuilder::new()
.with_webpki_roots()
.https_only()
.enable_http1()
.build();
#[cfg(all(not(feature = "rustls-tls"), feature = "openssl-tls"))]
let https = hyper_openssl::HttpsConnector::new()?;

Expand Down

0 comments on commit f5c33fe

Please sign in to comment.