

Specifically, you might want to check if a certificate is allowed to be used as a certificate authority. Similar to the previous one-liner, piping output between multiple OpenSSL commands makes it easy to inspect specific certificate extensions and allows you to view the SANs associated with a certificate: $ echo | openssl s_client -connect :443 2>/dev/null | openssl x509 -noout -ext subjectAltNameĪnother common set of extensions include the basic constraints and key usage of a certificate.
#Universal type client 6 download verification
The SAN is even used when there aren’t multiple values because the use of a certificate’s common name for verification is deprecated. The SAN of a certificate allows multiple values (e.g., multiple FQDNs) to be associated with a single certificate. One of the most common is the subject alternative name (SAN). X509 extensions allow for additional fields to be added to a certificate. Note: If you receive a default SSL certificate in place of the server certificate, check out this explanation of SNI (Server Name Indication). $ echo | openssl s_client -connect :443 2>/dev/null | openssl x509 -noout -dates # A valid certificate that hasn’t expired yet Below are examples for both a valid and an expired certificate. By piping the output into x509, you can obtain the certificate’s validity period by using the -dates flag. You already saw how s_client establishes a connection to a server in the previous example. There are plenty of monitoring tools to keep an eye on this and ensure that it doesn’t happen to you, but what if you just want to quickly check a certificate’s expiration date from the command line? OpenSSL has you covered.Ĭhecking the expiration date of a certificate involves a one-liner composed of two OpenSSL commands: s_client and x509. Complimentary course: Deploying containerized applicationsĮvery sysadmin has experienced the embarrassment that follows from allowing a certificate for a public-facing website to expire.A practical introduction to container terminology.Supported Elliptic Curve Point Formats: uncompressed:ansiX962_compressed_prime:ansiX962_compressed_char2

Verification error: self signed certificate Peer certificate: C = US, ST = California, L = San Francisco, O = BadSSL, CN = *. Verify error:num=18:self signed certificate In this output, you can clearly see that the verification failed with an error: “self-signed certificate.” $ echo | openssl s_client -connect :443 -briefĭepth=0 C = US, ST = California, L = San Francisco, O = BadSSL, CN = *. Supported Elliptic Curve Point Formats: uncompressedĬontrast the above output with the example below.

Peer certificate: C = US, ST = North Carolina, L = Raleigh, O = "Red Hat, Inc.", OU = Information Technology, CN = *. $ echo | openssl s_client -connect :443 -brief Without this, you would need to press Ctrl+C to quit the connection. Appending an echo to the one-liner sends a newline and immediately terminates the connection. Note that the "Verification" is output as "OK."īy default, openssl s_client will read from standard input for data to send to the remote server. The -brief flag excludes some of the more verbose output that OpenSSL would normally display. The example below shows a successfully verified certificate chain sent by a server () after a connection on port 443. One of the most common troubleshooting steps that you’ll take is checking the basic validity of a certificate chain sent by a server, which can be accomplished by the openssl s_client command. While many articles focus on the generation of certificate signing requests (CSRs) or self-signed certificates, this article will spend some time reviewing OpenSSL commands and one-liners beyond the certificate generation process. In this article, I demonstrate some of the most common commands that I use daily. The OpenSSL toolkit is the fundamental utility that any systems administrator must know if they are responsible for maintaining TLS-protected applications. Transport layer security (TLS) is an important part of any security strategy, and applications beyond web servers increasingly take advantage of the protections offered by public-key cryptography.
