aboutsummaryrefslogtreecommitdiffstats
path: root/certificate-renew-issued
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-06-24 13:30:36 +0200
committerGravatar Christian Hesse <mail@eworm.de>2019-06-24 13:39:45 +0200
commite9cdf947855880c0b7299ed7e2dd1770f71c5cfb (patch)
tree4af05ab95ea732fc214d98be3ec54aa5b82b4c5f /certificate-renew-issued
parent5101d57d52e60a3c10b974217af70166a3145c45 (diff)
add script 'certificate-renew-issued'
Diffstat (limited to 'certificate-renew-issued')
-rw-r--r--certificate-renew-issued14
1 files changed, 14 insertions, 0 deletions
diff --git a/certificate-renew-issued b/certificate-renew-issued
new file mode 100644
index 0000000..e7241f2
--- /dev/null
+++ b/certificate-renew-issued
@@ -0,0 +1,14 @@
+#!rsc
+# RouterOS script: certificate-renew-issued
+# Copyright (c) 2019 Christian Hesse <mail@eworm.de>
+#
+# renew locally issued certificates
+
+:foreach Cert in=[ / certificate find where issued expires-after<3w ] do={
+ :local CertVal [ / certificate get $Cert ];
+ / certificate issued-revoke $Cert;
+ / certificate set name=($CertVal->"name" . "-revoked-" . [ / system clock get date ]) $Cert;
+ / 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");
+}