mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
check-certificates: use $ParseKeyValueStore
This commit is contained in:
@ -8,19 +8,11 @@
|
|||||||
:global CertRenewUrl;
|
:global CertRenewUrl;
|
||||||
:global CertRenewPass;
|
:global CertRenewPass;
|
||||||
|
|
||||||
|
:global ParseKeyValueStore;
|
||||||
:global SendNotification;
|
:global SendNotification;
|
||||||
:global UrlEncode;
|
:global UrlEncode;
|
||||||
:global WaitForFile;
|
:global WaitForFile;
|
||||||
|
|
||||||
:local GetIssuerCN do={
|
|
||||||
:foreach IssuerI in=$1 do={
|
|
||||||
:if ([ :pick $IssuerI 0 3 ] = "CN=") do={
|
|
||||||
:return [ :pick $IssuerI 3 99 ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
:return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
:local FormatExpire do={
|
:local FormatExpire do={
|
||||||
:global CharacterReplace;
|
:global CharacterReplace;
|
||||||
:return [ $CharacterReplace [ $CharacterReplace [ :tostr $1 ] "w" "w " ] "d" "d " ];
|
:return [ $CharacterReplace [ $CharacterReplace [ :tostr $1 ] "w" "w " ] "d" "d " ];
|
||||||
@ -76,7 +68,7 @@
|
|||||||
"Name: " . ($CertVal->"name") . "\n" . \
|
"Name: " . ($CertVal->"name") . "\n" . \
|
||||||
"CommonName: " . ($CertNewVal->"common-name") . "\n" . \
|
"CommonName: " . ($CertNewVal->"common-name") . "\n" . \
|
||||||
"Fingerprint: " . ($CertNewVal->"fingerprint") . "\n" . \
|
"Fingerprint: " . ($CertNewVal->"fingerprint") . "\n" . \
|
||||||
"Issuer: " . [ $GetIssuerCN ($CertNewVal->"issuer") ] . "\n" . \
|
"Issuer: " . ([ $ParseKeyValueStore ($CertNewVal->"issuer") ]->"CN") . "\n" . \
|
||||||
"Validity: " . ($CertNewVal->"invalid-before") . " to " . ($CertNewVal->"invalid-after") . "\n" . \
|
"Validity: " . ($CertNewVal->"invalid-before") . " to " . ($CertNewVal->"invalid-after") . "\n" . \
|
||||||
"Expires in: " . [ $FormatExpire ($CertNewVal->"expires-after") ]);
|
"Expires in: " . [ $FormatExpire ($CertNewVal->"expires-after") ]);
|
||||||
:log info ("The certificate " . ($CertVal->"name") . " has been renewed.");
|
:log info ("The certificate " . ($CertVal->"name") . " has been renewed.");
|
||||||
@ -100,7 +92,7 @@
|
|||||||
"Name: " . ($CertVal->"name") . "\n" . \
|
"Name: " . ($CertVal->"name") . "\n" . \
|
||||||
"CommonName: " . ($CertVal->"common-name") . "\n" . \
|
"CommonName: " . ($CertVal->"common-name") . "\n" . \
|
||||||
"Fingerprint: " . ($CertVal->"fingerprint") . "\n" . \
|
"Fingerprint: " . ($CertVal->"fingerprint") . "\n" . \
|
||||||
"Issuer: " . ($CertVal->"ca") . [ $GetIssuerCN ($CertVal->"issuer") ] . "\n" . \
|
"Issuer: " . ($CertVal->"ca") . ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN") . "\n" . \
|
||||||
"Validity: " . ($CertVal->"invalid-before") . " to " . ($CertVal->"invalid-after") . "\n" . \
|
"Validity: " . ($CertVal->"invalid-before") . " to " . ($CertVal->"invalid-after") . "\n" . \
|
||||||
"Expires in: " . $ExpiresAfter);
|
"Expires in: " . $ExpiresAfter);
|
||||||
:log warning ("The certificate " . ($CertVal->"name") . " " . $State . \
|
:log warning ("The certificate " . ($CertVal->"name") . " " . $State . \
|
||||||
|
Reference in New Issue
Block a user