Extract a certificate chain with OpenSSL

Boris HUISGEN
Boris HUISGEN
Extract a certificate chain with OpenSSL

The openssl command makes it possible to retrieve the certificate chain from a host.

The following command retrieves the full chain and saves it into a file:

$ echo | openssl s_client -connect my.host.com:443 -showcerts 2>&1 |  \
    sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > fullchain.pem
Boris HUISGEN
Boris HUISGEN
Blog owner
  • #openssl