Skip to content

Commit

Permalink
Show path when fail to load the certificate
Browse files Browse the repository at this point in the history
When we try to load the mTLS certificate but it is missing, a generic
error is shown: "No such file or directory".

This commit introduces an error! log showing the full path of the
missing certificate.

Signed-off-by: Alberto Planas <[email protected]>
  • Loading branch information
aplanas committed Jun 22, 2022
1 parent b834667 commit c181a6b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ pub(crate) async fn run_encrypted_payload(
)?;

optional_unzip_payload(&unzipped, config)?;

// there may also be also a separate init script
match config.payload_script.as_str() {
"" => {
Expand Down Expand Up @@ -517,7 +516,16 @@ async fn main() -> Result<()> {
let ssl_context;
if config.mtls_enabled {
let keylime_ca_cert =
crypto::load_x509(Path::new(&config.keylime_ca_path))?;
match crypto::load_x509(Path::new(&config.keylime_ca_path)) {
Ok(t) => Ok(t),
Err(e) => {
error!(
"Certificate not installed: {}",
config.keylime_ca_path
);
Err(e)
}
}?;

cert = match &agent_data {
Some(data) => match data.get_mtls_cert()? {
Expand Down

0 comments on commit c181a6b

Please sign in to comment.