feat: Allow use of system default TLS trusted root by omitting the trusted_root client config parameter. (#192)

This commit is contained in:
Peter Neumark 2022-09-14 16:55:38 +02:00 committed by GitHub
parent 064bdcab8e
commit 187f4f0335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -296,11 +296,6 @@ impl Config {
.as_ref()
.and(tls_config.pkcs12_password.as_ref())
.ok_or_else(|| anyhow!("Missing `pkcs12` or `pkcs12_password`"))?;
} else {
tls_config
.trusted_root
.as_ref()
.ok_or_else(|| anyhow!("Missing `trusted_root`"))?;
}
Ok(())
}

View File

@ -42,7 +42,11 @@ impl Transport for TlsTransport {
.build()?;
Some(TlsConnector::from(connector))
}
None => None,
None => {
// if no trusted_root is specified, allow TlsConnector to use system default
let connector = native_tls::TlsConnector::builder().build()?;
Some(TlsConnector::from(connector))
},
};
let tls_acceptor = match config.pkcs12.as_ref() {