mirror of
https://github.com/nymurbd/MikroTik-scripts.git
synced 2025-07-22 03:44:49 +02:00
check-certificates: make the function return a status
This commit is contained in:
parent
46110661e0
commit
922dde3ff0
1 changed files with 8 additions and 1 deletions
|
@ -34,6 +34,8 @@
|
||||||
:global UrlEncode;
|
:global UrlEncode;
|
||||||
:global WaitForFile;
|
:global WaitForFile;
|
||||||
|
|
||||||
|
:local Return false;
|
||||||
|
|
||||||
:foreach Type in={ ".pem"; ".p12" } do={
|
:foreach Type in={ ".pem"; ".p12" } do={
|
||||||
:local CertFileName ([ $UrlEncode $Name ] . $Type);
|
:local CertFileName ([ $UrlEncode $Name ] . $Type);
|
||||||
:do {
|
:do {
|
||||||
|
@ -57,10 +59,14 @@
|
||||||
:foreach CertInChain in=[ /certificate/find where name~("^" . $CertFileName . "_[0-9]+\$") common-name!=$Name !(common-name=[]) ] do={
|
:foreach CertInChain in=[ /certificate/find where name~("^" . $CertFileName . "_[0-9]+\$") common-name!=$Name !(common-name=[]) ] do={
|
||||||
$CertificateNameByCN [ /certificate/get $CertInChain common-name ];
|
$CertificateNameByCN [ /certificate/get $CertInChain common-name ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:set Return true;
|
||||||
} on-error={
|
} on-error={
|
||||||
$LogPrintExit2 debug $0 ("Could not download certificate file " . $CertFileName) false;
|
$LogPrintExit2 debug $0 ("Could not download certificate file " . $CertFileName) false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:return $Return;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local FormatInfo do={
|
:local FormatInfo do={
|
||||||
|
@ -106,7 +112,8 @@ $WaitFullyConnected;
|
||||||
}
|
}
|
||||||
$LogPrintExit2 info $0 ("Attempting to renew certificate " . ($CertVal->"name") . ".") false;
|
$LogPrintExit2 info $0 ("Attempting to renew certificate " . ($CertVal->"name") . ".") false;
|
||||||
|
|
||||||
$CheckCertificatesDownloadImport ($CertVal->"common-name");
|
:local ImportSuccess false;
|
||||||
|
:set ImportSuccess [ $CheckCertificatesDownloadImport ($CertVal->"common-name") ];
|
||||||
|
|
||||||
:local CertNew [ /certificate/find where common-name=($CertVal->"common-name") fingerprint!=[ :tostr ($CertVal->"fingerprint") ] expires-after>$CertRenewTime ];
|
:local CertNew [ /certificate/find where common-name=($CertVal->"common-name") fingerprint!=[ :tostr ($CertVal->"fingerprint") ] expires-after>$CertRenewTime ];
|
||||||
:local CertNewVal [ /certificate/get $CertNew ];
|
:local CertNewVal [ /certificate/get $CertNew ];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue