From 739884ecc71ddce1c10f546ed1cd4348298513fb Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 20 Mar 2020 08:49:09 +0100 Subject: certificate-renew-issued: support auto-export with given passphrases --- certificate-renew-issued | 10 ++++++++++ global-config | 4 ++++ 2 files changed, 14 insertions(+) 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")); + } } diff --git a/global-config b/global-config index 22fbf87..46c07b8 100644 --- a/global-config +++ b/global-config @@ -123,3 +123,7 @@ "v3ry-s3cr3t"; "4n0th3r-s3cr3t"; } +:global CertIssuedExportPass { + "cert1-cn"="v3ry-s3cr3t"; + "cert2-cn"="4n0th3r-s3cr3t"; +} -- cgit v1.2.3-54-g00ecf