Skip to content

Commit 30a2741

Browse files
authored
Only enable native roots if CA override not specified (#1007)
1 parent 1807534 commit 30a2741

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

client/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,13 @@ impl ClientOptions {
607607
/// Passes it through if TLS options not set.
608608
async fn add_tls_to_channel(&self, mut channel: Endpoint) -> Result<Endpoint, ClientInitError> {
609609
if let Some(tls_cfg) = &self.tls_cfg {
610-
let mut tls = tonic::transport::ClientTlsConfig::new().with_native_roots();
610+
let mut tls = tonic::transport::ClientTlsConfig::new();
611611

612612
if let Some(root_cert) = &tls_cfg.server_root_ca_cert {
613613
let server_root_ca_cert = Certificate::from_pem(root_cert);
614614
tls = tls.ca_certificate(server_root_ca_cert);
615+
} else {
616+
tls = tls.with_native_roots();
615617
}
616618

617619
if let Some(domain) = &tls_cfg.domain {

0 commit comments

Comments
 (0)