diff options
author | Christian Hesse <mail@eworm.de> | 2019-07-17 16:28:22 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-07-18 13:50:01 +0200 |
commit | beb2e70097d187fbdeb1bf25cf0994babd8266fe (patch) | |
tree | f942492598fc7270f988c22ce5f53d972607f866 | |
parent | 047c0989d880ae0cdec00469dd3d9746cb9d5e01 (diff) |
check-certificates: use $ParseKeyValueStore
-rw-r--r-- | check-certificates | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/check-certificates b/check-certificates index ca5ffe3..75ff938 100644 --- a/check-certificates +++ b/check-certificates @@ -8,19 +8,11 @@ :global CertRenewUrl; :global CertRenewPass; +:global ParseKeyValueStore; :global SendNotification; :global UrlEncode; :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={ :global CharacterReplace; :return [ $CharacterReplace [ $CharacterReplace [ :tostr $1 ] "w" "w " ] "d" "d " ]; @@ -76,7 +68,7 @@ "Name: " . ($CertVal->"name") . "\n" . \ "CommonName: " . ($CertNewVal->"common-name") . "\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" . \ "Expires in: " . [ $FormatExpire ($CertNewVal->"expires-after") ]); :log info ("The certificate " . ($CertVal->"name") . " has been renewed."); @@ -100,7 +92,7 @@ "Name: " . ($CertVal->"name") . "\n" . \ "CommonName: " . ($CertVal->"common-name") . "\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" . \ "Expires in: " . $ExpiresAfter); :log warning ("The certificate " . ($CertVal->"name") . " " . $State . \ |