From e135ca1238f85afd8d9a10d2feb8fcfa3931bbfd Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 20 Jan 2021 14:38:11 +0100 Subject: certificate-renew-issued: handle error when creating directory --- certificate-renew-issued | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'certificate-renew-issued') diff --git a/certificate-renew-issued b/certificate-renew-issued index 0a9ca85..2eeaba0 100644 --- a/certificate-renew-issued +++ b/certificate-renew-issued @@ -19,12 +19,15 @@ key-usage=($CertVal->"key-usage") subject-alt-name=($CertVal->"subject-alt-name"); / certificate sign ($CertVal->"name") ca=($CertVal->"ca"); :if ([ :typeof ($CertIssuedExportPass->($CertVal->"common-name")) ] = "str") do={ - $MkDir "cert-issued"; - / certificate export-certificate ($CertVal->"name") type=pkcs12 \ - file-name=("cert-issued/" . $CertVal->"common-name") \ - export-passphrase=($CertIssuedExportPass->($CertVal->"common-name")); - $LogPrintExit info ("Issued a new certificate for \"" . $CertVal->"common-name" . \ - "\", exported to \"cert-issued/" . $CertVal->"common-name" . ".p12\".") false; + :if ([ $MkDir "cert-issued" ] = true) do={ + / certificate export-certificate ($CertVal->"name") type=pkcs12 \ + file-name=("cert-issued/" . $CertVal->"common-name") \ + export-passphrase=($CertIssuedExportPass->($CertVal->"common-name")); + $LogPrintExit info ("Issued a new certificate for \"" . $CertVal->"common-name" . \ + "\", exported to \"cert-issued/" . $CertVal->"common-name" . ".p12\".") false; + } else={ + $LogPrintExit warning ("Failed creating directory, not exporting certificate.") false; + } } else={ $LogPrintExit info ("Issued a new certificate for \"" . $CertVal->"common-name" . "\".") false; } -- cgit v1.2.3-70-g09d2