fix(tls): skip invalid system certificate

This commit is contained in:
Erèbe - Romain Gerard 2024-03-08 09:00:21 +01:00 committed by GitHub
parent 84d753fa25
commit 1c393afe4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -72,7 +72,10 @@ pub fn tls_connector(
// Load system certificates and add them to the root store // Load system certificates and add them to the root store
let certs = rustls_native_certs::load_native_certs().with_context(|| "Cannot load system certificates")?; let certs = rustls_native_certs::load_native_certs().with_context(|| "Cannot load system certificates")?;
for cert in certs { for cert in certs {
root_store.add(&Certificate(cert.as_ref().to_vec()))?; if let Err(err) = root_store.add(&Certificate(cert.as_ref().to_vec())) {
warn!("cannot load a system certificate: {:?}", err);
continue
}
} }
let mut config = ClientConfig::builder() let mut config = ClientConfig::builder()