I would like to get the days until a cert expires. Extracting the dates is easy with openssl
> cat cert | openssl x509 -noout -enddate
notAfter=Jun 8 17:07:09 2021 GMT
Unfortunately parsing the date Jun 8 17:07:09 2021 GMT
and finding the days until today is not so straight forward. The goal would be to have
> cat cert | openssl x509 -noout -enddate | ...some commands...
15
Meaning 15 days until the cert expires.
I am aware of the openssl -checkend
option, but that is just a boolean and I want the number of days.