Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(tls): print a warning if a system certificate can't be loaded #25023

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,6 @@ pub enum RootCertStoreLoadError {
UnknownStore(String),
#[error("Unable to add pem file to certificate store: {0}")]
FailedAddPemFile(String),
#[error("Unable to add system certificate to certificate store: {0}")]
FailedAddSystemCert(String),
#[error("Failed opening CA file: {0}")]
CaFileOpenError(String),
}
Expand Down Expand Up @@ -675,11 +673,19 @@ pub fn get_root_cert_store(
"system" => {
let roots = load_native_certs().expect("could not load platform certs");
for root in roots {
root_cert_store
.add(rustls::pki_types::CertificateDer::from(root.0))
.map_err(|e| {
RootCertStoreLoadError::FailedAddSystemCert(e.to_string())
})?;
if let Err(err) = root_cert_store
.add(rustls::pki_types::CertificateDer::from(root.0.clone()))
{
log::error!(
"{}",
colors::yellow(&format!(
"Unable to add system certificate to certificate store: {:?}",
err
))
);
let hex_encoded_root = faster_hex::hex_string(&root.0);
log::error!("{}", colors::gray(&hex_encoded_root));
}
}
}
_ => {
Expand Down