aboutsummaryrefslogtreecommitdiffstats
path: root/check-certificates
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-01-09 17:34:08 +0100
committerGravatar Christian Hesse <mail@eworm.de>2019-01-09 17:34:08 +0100
commite51daf276182dbd733f8eeec6122230790744e7b (patch)
treed190185ad74b6aa033d4ea2d74e1ed8e07fca3d4 /check-certificates
parent57d93aa7016439356dffd81ffa1600f360594d67 (diff)
check-certificates: show issuer CN only
Diffstat (limited to 'check-certificates')
-rw-r--r--check-certificates13
1 files changed, 11 insertions, 2 deletions
diff --git a/check-certificates b/check-certificates
index f0a466e..72a6fa8 100644
--- a/check-certificates
+++ b/check-certificates
@@ -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" . \