Testing of SSL connection could be easily done using openssl command. This powerful tool can check both SSL and TLS connection. Certificate chain can be also checked. It is very useful especially for testing newly installed SSL certificate.
Verification could be done using s_client command in openssl. As an example we will use www.sslshopper.com, test.rebex.net and gmail.com. Here is a list of the most common s_client command’s variations:
To test http SSL connection type:
openssl s_client -connect www.sslshopper.com:443 -CApath /etc/ssl/certs/
Additionally path to certificates has been added (to prevent broken chain issues).
To test FTPS connection use this command (thanks for test FTPS server at rebex.net):
openssl s_client -connect test.rebex.net:990 -CApath /etc/ssl/certs/
To test FTP(TLS):
openssl s_client -connect test.rebex.net:21 -starttls ftp -CApath /etc/ssl/certs/
To test SMTPS:
openssl s_client -connect smtp.gmail.com:465 -CApath /etc/ssl/certs/
SMTP(TLS):
openssl s_client -connect smtp.gmail.com:587 -starttls smtp -CApath /etc/ssl/certs/
POP3:
openssl s_client -connect pop.gmail.com:995 -CApath /etc/ssl/certs/
IMAP:
openssl s_client -connect imap.gmail.com:993 -CApath /etc/ssl/certs/