How do we check the expiration date of an SSL certificate including root certificate on Linux with bash shell?
You could do something like this:
openssl s_client -connect THESITE:443 </dev/null 2>/dev/null \
|awk '/BEGIN CERT/,/END CERT/' |tee /tmp/asdf
to extract the certificate itself…
then, to inspect the certificate,
openssl x509 -text -in /tmp/asdf |grep -A2 Validity
Validity
Not Before: Feb 5 14:32:26 2020 GMT
Not After : Apr 5 21:02:01 2022 GMT…
Hope this helps.
1 Like
@vocatan thanks it worked since we store it in file I can grep them in shell variables too.