mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-30 22:59:23 +02:00
certificate-renew-issued: support auto-export with given passphrases
This commit is contained in:
parent
f50e416e49
commit
739884ecc7
2 changed files with 14 additions and 0 deletions
|
@ -4,6 +4,10 @@
|
||||||
#
|
#
|
||||||
# renew locally issued certificates
|
# renew locally issued certificates
|
||||||
|
|
||||||
|
:global CertIssuedExportPass;
|
||||||
|
|
||||||
|
:global MkDir;
|
||||||
|
|
||||||
:foreach Cert in=[ / certificate find where issued expires-after<3w ] do={
|
:foreach Cert in=[ / certificate find where issued expires-after<3w ] do={
|
||||||
:local CertVal [ / certificate get $Cert ];
|
:local CertVal [ / certificate get $Cert ];
|
||||||
/ certificate issued-revoke $Cert;
|
/ certificate issued-revoke $Cert;
|
||||||
|
@ -11,4 +15,10 @@
|
||||||
/ certificate add name=($CertVal->"name") common-name=($CertVal->"common-name") \
|
/ certificate add name=($CertVal->"name") common-name=($CertVal->"common-name") \
|
||||||
key-usage=($CertVal->"key-usage") subject-alt-name=($CertVal->"subject-alt-name");
|
key-usage=($CertVal->"key-usage") subject-alt-name=($CertVal->"subject-alt-name");
|
||||||
/ certificate sign ($CertVal->"name") ca=($CertVal->"ca");
|
/ 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"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,3 +123,7 @@
|
||||||
"v3ry-s3cr3t";
|
"v3ry-s3cr3t";
|
||||||
"4n0th3r-s3cr3t";
|
"4n0th3r-s3cr3t";
|
||||||
}
|
}
|
||||||
|
:global CertIssuedExportPass {
|
||||||
|
"cert1-cn"="v3ry-s3cr3t";
|
||||||
|
"cert2-cn"="4n0th3r-s3cr3t";
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue