routeros-scripts/certificate-renew-issued

15 lines
636 B
Text
Raw Normal View History

2019-06-24 11:30:36 +00:00
#!rsc
# RouterOS script: certificate-renew-issued
2020-01-01 16:00:39 +00:00
# Copyright (c) 2019-2020 Christian Hesse <mail@eworm.de>
2019-06-24 11:30:36 +00:00
#
# 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");
}