In order to download the certificate, you need to use the client built into openssl like so:
echo -n | openssl s_client -connect $HOST:$PORTNUMBER -servername $SERVERNAME \
| openssl x509 > /tmp/$SERVERNAME.cert
That will save the certificate to /tmp/$SERVERNAME.cert
.
The -servername
is used to select the correct certificate when multiple are presented, in the case of SNI.
You can use -showcerts
if you want to download all the certificates in the chain. But if you just want to download the server certificate, there is no need to specify -showcerts
. The x509
at the end will strip out the intermediate certs, you will need to use sed -n '/-----BEGIN/,/-----END/p'
instead of the x509 at the end.
echo -n
gives a response to the server, so that the connection is released
openssl x509
removes information about the certificate chain and connection details. This is the preferred format to import the certificate into other keystores.
Related Posts:
- How to generate a self-signed SSL certificate using OpenSSL?
- Generating a self-signed cert with openssl that works in Chrome 58
- How to install OpenSSL in windows 10?
- SSL Error: unable to get local issuer certificate
- curl: (60) SSL certificate problem: unable to get local issuer certificate
- curl: (60) SSL certificate problem: unable to get local issuer certificate
- What is .crt and .key files and how to generate them?
- NET::ERR_CERT_REVOKED in Chrome, when the certificate is not actually revoked
- Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- What exactly is cacert.pem for?
- OpenSSL: unable to verify the first certificate for Experian URL
- How to disable cURL SSL certificate verification
- Getting error in Curl – Peer certificate cannot be authenticated with known CA certificates
- How do you sign a Certificate Signing Request with your Certification Authority?
- Java Keytool error after importing certificate , “keytool error: java.io.FileNotFoundException & Access Denied”
- Displaying a remote SSL certificate details using CLI tools
- How to view all ssl certificates in a bundle?
- Is there a reason to use an SSL certificate other than Let’s Encrypt’s free SSL?
- Does each subdomain need it’s own SSL certificate?
- Best location to keep SSL certificates and private keys on Ubuntu servers?
- Openssl : error “self signed certificate in certificate chain”
- “ssl module in Python is not available” when installing package with pip3
- Received fatal alert: handshake_failure through SSLHandshakeException
- Convert .pem to .crt and .key
- Received fatal alert: handshake_failure through SSLHandshakeException
- HTTPS connection Python
- SSL_ERROR_BAD_CERT_DOMAIN
- CFNetwork SSLHandshake failed iOS 9
- Caused by: java.security.UnrecoverableKeyException: Cannot recover key
- SSL CA cert (path? access rights?)
- “The underlying connection was closed: An unexpected error occurred on a send.” With SSL Certificate
- Unable to establish SSL connection upon wget on Ubuntu 14.04 LTS
- urllib and “SSL: CERTIFICATE_VERIFY_FAILED” Error
- Python requests SSL error – certificate verify failed
- WordPress wp-admin https redirect loop
- Howto force SSL for all requests?
- Local version of a WordPress site – SSL/HTTPS enforced?
- Images causing Mixed Content with SSL
- bloginfo() and get_template_directory_uri() with SSL?
- Favicon causes mixed content warning over SSL
- Enabling SSL on wordpress results in 404
- SSL setup: wp-login css doesn’t load over httpS
- Divert http to https with WordPress on IIS
- WordPress : To load all asset files coming from HTTP to HTTPS?
- XML asset fails to load using https
- Search and replace http:// links to https:// to get the green padlock
- I changed my site from HTTPS back to HTTP and now it is broken- Cannot access Admin panel on HTTP URL
- un-loading https
- How to set up HTTPS WordPress from Install Step?
- wp_remote_get – curl error 28 connection timed out – using SANS in URL
- SSL certificate error on Google Chrome , IE [closed]
- How do I set up a local version of my https wordpress site for testing and development using MAMP
- WordPress + SSL + Varnish + Pound
- Jetpack “Connect to WordPress” serving insecure content under HTTPS
- Website access with http and https
- How to force non SSL on just one page?
- Need ideas for HTTPS multiple domain solution
- Redirect the whole blog to SSL but not the RSS feed (under Nginx)
- How to control SSL in WordPress for automatically changing http to https?
- Site not reachable due to change from HTTP to HTTPS [closed]
- All content is HTTPS, but browsers warn of HTTP mixed content [closed]
- How do I handle SSL properly when WP is behind a reverse proxy?
- Hi do I change Media files that still show as http after installing ssl
- Errors on a single host using wp_remote_get() unless sslverify is set to false
- How to keep WP from using https to get to wordpress.org?
- SSL doesn’t work on certain pages – what is wrong?
- WordPress site shown as Not Secure on Chrome when SSL certificate is valid
- Self signed certificate issue with WooCommerce rest api connection
- ERR_TOO_MANY_REDIRECTS on wordpress page [closed]
- Disable WordPress accessing WordPress.org to check for updates
- How to protect login via SSL but not the rest of the dashboard
- The REST API request failed due to an error. cURL error 60: SSL certificate problem: certificate has expired
- Do I install WordPress from my Cpanel on https or http, if my website has valid certificate?
- SSL not working fine, Home url not matching with site url wordpress errors
- Website Migration (with https) to a new domain(http)
- How to move my local wordpress to https?
- Why does WordPress uses HTTPS for JS, CSS on EC2
- ERR_SSL_PROTOCOL_ERROR
- WordPress – SSL not working – browser console error “Mixed Content” and “Failed to load resource”
- Implications of not completing all tasks when switching to HTTPS
- Update not working after installing up SSL
- Front-end pages messed up due to HTTPS
- How to send user data from one website to another
- How come all my http URLs are turned to https?
- site on subdomain is redirecting to main site after installing wildcard ssl cert on both
- Forcing SSL (Bad Theme coding)
- How to switch static files back to using HTTP instead of HTTPS?
- WordPress Insecure Content
- SSL certificate breaks CSS (in combination with W3TC)
- I would like to add ssl certificate to my already existing wordpress site
- My WordPress site SSL is in red crossed color and can’t load at first time?
- SSL/HTTPS Redirect Loop
- Adding SSL certificate to the front end of my site
- iHow to redirect all http traffic to https now that a SSL certificate is added?
- WordPress stuck at Step 1 of setup behind nginx reverse proxy
- Issue when site move from ssl domain to new domain without ssl
- How do I view the details of a digital certificate .cer file?
- SSL Certificate Location on UNIX/Linux
- Wildcard SSL certificate for second-level subdomain
- Changing my URL in General Settings cause the site to crash