ssl cert expiration
Posted on 2010-01-09
I am trying to find a concept to check the local cert store on a server and output expiry dates maybe even some logic that evaluates the current date and determines how many days are left to expiration.
I am thinking of using certutil
The output is formatted as below.
================ Certificate 24 ================
Serial Number: 198b11d13f9a8ffe69a0
Issuer: CN=Root Authority, OU=Company OU, OU=Copyright (c) Company.
NotBefore: 9/30/1900 11:00 PM
NotAfter: 1/1/2012 11:00 PM
Subject: CN=cert CN, OU=Cert Corporation,OU=Company Intermediate CA, OU=Copyright (c)Company.
I want to be able to have a script that will go through the output read the not after date and if the "not after" date is x number of days I want to report the info in the line starting subject and then indicate how many days are left to expiry.
Subject: CN=cert CN has "x" days until expiration.
Can anyone help me.