mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
check-certificates: show issuer CN only
This commit is contained in:
parent
57d93aa701
commit
e51daf2761
1 changed files with 11 additions and 2 deletions
|
@ -10,6 +10,14 @@
|
|||
|
||||
:global SendNotification;
|
||||
|
||||
:local GetIssuerCN do={
|
||||
:foreach IssuerI in=$1 do={
|
||||
:if ([ :pick $IssuerI 0 3 ] = "CN=") do={
|
||||
:return $IssuerI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:foreach Cert in=[ / certificate find where !revoked ] do={
|
||||
:local CertName [ / certificate get $Cert name ];
|
||||
:local ExpiresAfter [ / certificate get $Cert expires-after ];
|
||||
|
@ -48,10 +56,11 @@
|
|||
|
||||
:local InvalidBefore [ / certificate get $CertNew invalid-before ];
|
||||
:local InvalidAfter [ / certificate get $CertNew invalid-after ];
|
||||
:local Issuer [ / certificate get $CertNew issuer ];
|
||||
:local Issuer [ $GetIssuerCN [ / certificate get $CertNew issuer ] ];
|
||||
:set CommonName [ / certificate get $CertNew common-name ];
|
||||
:set FingerPrint [ / certificate get $CertNew fingerprint ];
|
||||
|
||||
|
||||
$SendNotification ("Certificate renewed") \
|
||||
("A certificate on " . $Identity . " has been renewed.\n\n" . \
|
||||
"Certificate Name: " . $CertName . "\n" . \
|
||||
|
@ -63,7 +72,7 @@
|
|||
} on-error={
|
||||
:local InvalidBefore [ / certificate get $Cert invalid-before ];
|
||||
:local InvalidAfter [ / certificate get $Cert invalid-after ];
|
||||
:local Issuer [ / certificate get $Cert issuer ];
|
||||
:local Issuer [ $GetIssuerCN [ / certificate get $Cert issuer ] ];
|
||||
|
||||
$SendNotification ("Certificate warning!") \
|
||||
("A certificate on " . $Identity . " is about to expire.\n\n" . \
|
||||
|
|
Loading…
Reference in a new issue