Skip to content

Commit

Permalink
Fix: crash when client_cert dir is not available.
Browse files Browse the repository at this point in the history
Instead of crashing openvasd when client certificates are configured but
not available openvasd instead logs a warning and assumes that no client
certficiates are available.
  • Loading branch information
nichtsfrei committed Apr 8, 2024
1 parent bc4e49c commit 527040c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rust/openvasd/src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,17 @@ pub fn config_to_tls_paths(
Some(x) => x,
None => return Ok(Some((key_path.to_path_buf(), certs.to_path_buf(), vec![]))),
};
let client_certs = std::fs::read_dir(client_certs)?;
let client_certs = match std::fs::read_dir(client_certs) {
Ok(x) => x,
Err(e) => {
tracing::warn!(
client_certs = ?client_certs,
error = ?e,
"unable to load client certificates, continuing without them"
);
return Ok(Some((key_path.to_path_buf(), certs.to_path_buf(), vec![])));
}
};
let client_certs = client_certs
.filter_map(|x| {
let entry = x.ok()?;
Expand Down

0 comments on commit 527040c

Please sign in to comment.