Check date in Subject/OU in a Certificate.

Anthony Wood anthony.wood at sol1.com.au
Thu Nov 4 01:05:44 CET 2021


Hi Mikael, 

The server should send the subject in a header which you can get and maybe build a check on. 

e.g. the HEAD command (libwww-perl package) 

$ /usr/bin/HEAD -s https://google.com/ | grep Client-SSL-Cert-Subject 
Client-SSL-Cert-Subject: /CN=www.google.com 

or just straight perl: 
$ perl -MLWP::UserAgent -le'print foreach LWP::UserAgent->new->get("https://atlassian.com")->headers->{"client-ssl-cert-subject"}' 
/C=AU/ST=New South Wales/L=Sydney/O=Atlassian Pty Ltd/CN=*.atlassian.com 

If the date is in YYYY-MM-DD format you could grab it, convert it to an epoch time and calculate the seconds left with: 

$ perl -MTime::Local -MLWP::UserAgent -le'LWP::UserAgent->new->get("https://your.vendor.com")->headers->{"client-ssl-cert-subject"} =~ /(\d{4})\-(\d\d)\-(\d\d)/ and print timelocal(0,0,0,$2,$1,$0) - time' 

cheers, 
Woody 


From: "Mikael Janeld" <Mikael.janeld at tietoevry.com> 
To: "help" <help at monitoring-plugins.org> 
Sent: Wednesday, 3 November, 2021 8:00:03 PM 
Subject: Check date in Subject/OU in a Certificate. 



Hi, 



We have a vendor/application that stamps the expire date for a license in the Subject/OU field in a certificate and I am trying to found a way that we can use OP5 to monitor that. 



I have checked the “check_https_certificate” but it only checks when the certificates expires and in the application certificate the certificate expire date and the license expire date are different. 



I hope there is a way to solve this, either with “check_https_certificate” check or if we can use another check that can do this or maybe create a new check for this, can you help me with that or point me to a way that I can solve it? 



Med vänlig hälsning / Best regards, 

Mikael Janeld , VMware & Windows Specialist 

TietoEVRY, Financial Services - Card Acquiring 
email [ mailto:mikael.janeld at tietoevry.com | mikael.janeld at tietoevry.com ] , mobile +46 (0)73 236 5240 
Ekensbergsvägen 113, Solna 



Tieto and EVRY are joining forces. 

[ http://www.tietoevry.com/ | www.tietoevry.com ] 

[ https://twitter.com/tietoevry | Twitter ] | [ https://www.facebook.com/tietoevry/ | Facebook ] | [ https://www.linkedin.com/company/tietoevry/ | LinkedIn ] 

Please note: The information contained in this message may be legally privileged, 
confidential and protected from disclosure. If you received this in error, please notify 
the sender immediately and delete the message from your computer. Thank you. 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20211104/24854b0f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 9718 bytes
Desc: image001.jpg
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20211104/24854b0f/attachment-0001.jpg>


More information about the Help mailing list