How Do You Troubleshoot the openssl Error “getaddrinfo: Servname not supported for ai_socktype”?

Problem scenario
You use the openssl command, but you receive an error.  You run a command such as this:

openssl s_client -connect http://www.continualintegration.com:80

You get a message such as this:
getaddrinfo: Servname not supported for ai_socktype
connect:errno=0

What should you do to view the SSL certificates?

Solution
Run the command without the "http://".  Here is an example of the correct syntax:

openssl s_client -connect continualintegration.com:80

For Future Reference
OpenSSL uses SSL and TLS.  If you want books on the subject, you may click on one of the links below:

A Concise Guide to SSL/TLS for DevOps: 2nd Edition
Bulletproof SSL and TLS: Understanding and Deploying SSL/TLS and PKI to Secure Servers and Web Applications
Implementing SSL / TLS Using Cryptography and PKI
Network Security with OpenSSL: Cryptography for Secure Communications

Leave a comment

Your email address will not be published. Required fields are marked *