I needed to inspect an HTTPS site's current certs and wanted to do it from the command line. Here are a couple of commands that I used that worked quite well.
curl -i --verbose https://[server URL]
cURL will report come certificate information in its versbose output when connecting to an HTTPS URL.
openssl s_client -showcerts -connect [server domain name]:443
I like this method, becase OpenSSL will report a lot of details about the certificates, including the full CA chain, if available.
openssl x509 -in [PEM file] -text
I recently wanted to change the configuration on a server, moving the TLS termination from a Tomcat server to NGINX. I neeed to extract the certificate and private key from the PKCS12 store it was in. Here's how I did that:
openssl pkcs12 -in ./[pkcs12 file] -clcerts -nokeys -out public.crt
openssl pkcs12 -in ./[pkcs12 files] -nocerts -nodes -out private.rsa