Matty9191 / ssl-cert-check

Send notifications when SSL certificates are about to expire.
GNU General Public License v2.0
721 stars 286 forks source link

Fails to get certificate details (OpenSSL 1.1.1) #57

Open tlhackque opened 5 years ago

tlhackque commented 5 years ago

At least with OpenSSL 1.1.1b, ssl-cert-check reports blanks for the certificate details. (issuer, common name,)

Apparently, OpenSSL changed the default format for printing names. e.g.

openssl x509 -in ww.pem -issuer -noout -inform pem
issuer=C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3

instead of

issuer=/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3

To fix: Where you currently have, e.g.:

CERTISSUER=$(${OPENSSL} x509 -in ${CERTFILE} -issuer -noout -inform ${CERTTYPE} | 

you now need

CERTISSUER=$(${OPENSSL} x509 -nameopt compat -in ${CERTFILE} -issuer -noout -inform ${CERTTYPE} | 

and so on for the other x509 commands.

It's harmless to include -nameopt compat on the commands that get other items, so you can just do a global replace of OPENSSL} x509 with OPENSSL} x509 -nameopt compat.