aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-01-20 14:38:11 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-01-20 14:38:11 +0100
commite135ca1238f85afd8d9a10d2feb8fcfa3931bbfd (patch)
tree0eb1c9b01f323c0ca4c69e5ffa669e08d879a124
parentc980699dd709a61d0409f0beb31a1dbfa58d995e (diff)
certificate-renew-issued: handle error when creating directory
-rw-r--r--certificate-renew-issued15
1 files changed, 9 insertions, 6 deletions
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;
}