check-certificates: fix renewing certificate in place

This commit is contained in:
Christian Hesse 2019-07-31 21:04:06 +02:00
parent acce2322c3
commit 70798de8f0

View file

@ -45,6 +45,9 @@
:local CertNew [ / certificate find where common-name=($CertVal->"common-name") fingerprint!=[ :tostr ($CertVal->"fingerprint") ] expires-after>3w ]; :local CertNew [ / certificate find where common-name=($CertVal->"common-name") fingerprint!=[ :tostr ($CertVal->"fingerprint") ] expires-after>3w ];
:local CertNewVal [ / certificate get $CertNew ]; :local CertNewVal [ / certificate get $CertNew ];
:if ($Cert != $CertNew) do={
:log debug ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced.");
/ ip service set certificate=($CertNewVal->"name") [ find where certificate=($CertVal->"name") ]; / ip service set certificate=($CertNewVal->"name") [ find where certificate=($CertVal->"name") ];
:do { :do {
@ -61,7 +64,8 @@
} }
/ certificate remove $Cert; / certificate remove $Cert;
/ certificate set $CertNew name=($CertVal->"name") / certificate set $CertNew name=($CertVal->"name");
}
$SendNotification ("Certificate renewed") \ $SendNotification ("Certificate renewed") \
("A certificate on " . $Identity . " has been renewed.\n\n" . \ ("A certificate on " . $Identity . " has been renewed.\n\n" . \