diff options
author | Christian Hesse <mail@eworm.de> | 2019-07-31 21:04:06 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-07-31 21:04:06 +0200 |
commit | 70798de8f05e88e39fbcd70078b91b2ec07e9c83 (patch) | |
tree | 2b86e02ea741618e4b69e510971eccd47ba88e5f | |
parent | acce2322c347deb75c38337a725ead30320a9f6e (diff) |
check-certificates: fix renewing certificate in place
-rw-r--r-- | check-certificates | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/check-certificates b/check-certificates index 75ff938..d28ef86 100644 --- a/check-certificates +++ b/check-certificates @@ -45,23 +45,27 @@ :local CertNew [ / certificate find where common-name=($CertVal->"common-name") fingerprint!=[ :tostr ($CertVal->"fingerprint") ] expires-after>3w ]; :local CertNewVal [ / certificate get $CertNew ]; - / ip service set certificate=($CertNewVal->"name") [ find where certificate=($CertVal->"name") ]; + :if ($Cert != $CertNew) do={ + :log debug ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced."); - :do { - / ip ipsec identity set certificate=($CertNewVal->"name") [ / ip ipsec identity find where certificate=($CertVal->"name") ]; - / ip ipsec identity set remote-certificate=($CertNewVal->"name") [ / ip ipsec identity find where remote-certificate=($CertVal->"name") ]; - } on-error={ - :log debug ("Setting IPSEC certificates failed. Package 'security' not installed?"); - } + / ip service set certificate=($CertNewVal->"name") [ find where certificate=($CertVal->"name") ]; - :do { - / ip hotspot profile set ssl-certificate=($CertNewVal->"name") [ / ip hotspot profile find where ssl-certificate=($CertVal->"name") ]; - } on-error={ - :log debug ("Setting hotspot certificates failed. Package 'hotspot' not installed?"); - } + :do { + / ip ipsec identity set certificate=($CertNewVal->"name") [ / ip ipsec identity find where certificate=($CertVal->"name") ]; + / ip ipsec identity set remote-certificate=($CertNewVal->"name") [ / ip ipsec identity find where remote-certificate=($CertVal->"name") ]; + } on-error={ + :log debug ("Setting IPSEC certificates failed. Package 'security' not installed?"); + } - / certificate remove $Cert; - / certificate set $CertNew name=($CertVal->"name") + :do { + / ip hotspot profile set ssl-certificate=($CertNewVal->"name") [ / ip hotspot profile find where ssl-certificate=($CertVal->"name") ]; + } on-error={ + :log debug ("Setting hotspot certificates failed. Package 'hotspot' not installed?"); + } + + / certificate remove $Cert; + / certificate set $CertNew name=($CertVal->"name"); + } $SendNotification ("Certificate renewed") \ ("A certificate on " . $Identity . " has been renewed.\n\n" . \ |