aboutsummaryrefslogtreecommitdiffstats
path: root/certificate-renew-issued
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-03-20 08:49:09 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-03-20 09:26:12 +0100
commit739884ecc71ddce1c10f546ed1cd4348298513fb (patch)
tree64e9f5a3ddfe65a4a9f1265af58e7a90674e4257 /certificate-renew-issued
parentf50e416e49a9f390408268a5c173b4e99ec81c0f (diff)
certificate-renew-issued: support auto-export with given passphrases
Diffstat (limited to 'certificate-renew-issued')
-rw-r--r--certificate-renew-issued10
1 files changed, 10 insertions, 0 deletions
diff --git a/certificate-renew-issued b/certificate-renew-issued
index 3dc50d3..32da774 100644
--- a/certificate-renew-issued
+++ b/certificate-renew-issued
@@ -4,6 +4,10 @@
#
# renew locally issued certificates
+:global CertIssuedExportPass;
+
+:global MkDir;
+
:foreach Cert in=[ / certificate find where issued expires-after<3w ] do={
:local CertVal [ / certificate get $Cert ];
/ certificate issued-revoke $Cert;
@@ -11,4 +15,10 @@
/ certificate add name=($CertVal->"name") common-name=($CertVal->"common-name") \
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"));
+ }
}