About OpenSSL
OpenSSL is an open-source implementation of the SSL and TLS protocols. It includes several code libraries and utility programs, one of which is the command-line openssl program. The openssl program is a useful tool for troubleshooting secure TCP connections to a remote server. In addition to testing basic connectivity, openssl enables you to send raw protocol commands for additional testing.Installing the openssl program
Linux and macOS include the openssl program by default. On Microsoft Windows, however, you must download and install openssl. To do this, follow these steps:- Use your web browser to visit https://github.com/openssl/openssl/wiki/Binaries.
- Click the OpenSSL for Windows hyperlink that includes Pre-compiled Win32/64 libraries without external dependencies.
- Download the most recent OpenSSL version for your PC architecture:
- If you have a 32-bit computer, select a file whose name ends in win32.zip. For example, at the time this article is written, the newest version is openssl-1.0.2d-i386-win32.zip.
- If you have a 64-bit computer, select a file whose name ends in win64.zip. For example, at the time this article is written, the newest version is openssl-1.0.2d-x64_86-win64.zip.
- Extract the .zip file to a folder (you can use any folder, and you can name the folder anything you want).
- After you extract the files, the folder contains the openssl.exe file and supporting files.
- To run openssl, open a command prompt window, use the cd command to change to the folder where you extracted the files in step 5, and then type
openssl.
Using the openssl program to troubleshoot
To troubleshoot a secure connection using the openssl program, you must know at least two things:- The remote server name or IP address.
- The port number for the network application you want to test.
Establishing a connection
To open a connection to a remote server, open a terminal window on your computer, and then type the following command. Replace example.com with the domain name (or IP address) of the server, and replace port with the TCP port number of the protocol you want to test:- The server accepts the connection. If this happens, openssl may display some text from the server, or simply await further input. You can then send raw commands appropriate for the protocol you are testing.
- The server rejects the connection. If this happens, you receive a message such as connect: Connection timed out or connect:errno=110. If you receive this message, confirm you are using the correct server and port number. If you are, then the server is not accepting secure connections on the specified port.
Troubleshooting SSL certificates
You can use the openssl program to test and verify SSL certificates. For example, you can check whether a certificate is signed by a valid Certificate Authority (CA) or is self-signed. You can also examine the certificate’s validity, expiration date, and much more. To do this, type the following command. Replace example.com with your own domain name:If this were a self-signed certificate, openssl would display the following lines: