Checking remote host TLS / SSL Version with nmap / openssl

Checking SSL / TLS version support of a remote server from the command line in Linux.

Method 1: openssl s_client

The simplest way to check support for a given version of SSL / TLS is via openssl s_client . openssl is installed by default on most Unix systems

openssl s_client -connect www.google.co.uk:443 -tls1_2
openssl s_client -connect www.google.co.uk:443 -tls1_1
openssl s_client -connect www.google.co.uk:443 -tls1

If the protocol is supported you will see the remote host certificate and other information.

Here is a sample output for the bbc.co.uk.

# openssl s_client -connect www.bbc.co.uk:443 -tls1
CONNECTED(00000003)
depth=2 C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
verify return:1
depth=1 C = BE, O = GlobalSign nv-sa, CN = GlobalSign Organization Validation CA - SHA256 - G2
verify return:1
depth=0 C = GB, ST = London, L = London, O = British Broadcasting Corporation, CN = *.bbc.co.uk
verify return:1
---
Certificate chain
 0 s:/C=GB/ST=London/L=London/O=British Broadcasting Corporation/CN=*.bbc.co.uk
   i:/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Organization Validation CA - SHA256 - G2
 1 s:/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Organization Validation CA - SHA256 - G2
   i:/C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIHXTCCBkWgAwIBAgIMblZony7dXuzKtlfuMA0GCSqGSIb3DQEBCwUAMGYxCzAJ
BgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTwwOgYDVQQDEzNH
bG9iYWxTaWduIE9yZ2FuaXphdGlvbiBWYWxpZGF0aW9uIENBIC0gU0hBMjU2IC0g
RzIwHhcNMTkwMzA3MTAyMTA0WhcNMjAwNjE1MTcwMTA2WjBwMQswCQYDVQQGEwJH
QjEPMA0GA1UECBMGTG9uZG9uMQ8wDQYDVQQHEwZMb25kb24xKTAnBgNVBAoTIEJy
aXRpc2ggQnJvYWRjYXN0aW5nIENvcnBvcmF0aW9uMRQwEgYDV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GbrN0xce5Rl
oXmmzwC1ufFzwj0MujO8PKQ=
-----END CERTIFICATE-----
subject=/C=GB/ST=London/L=London/O=British Broadcasting Corporation/CN=*.bbc.co.uk
issuer=/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Organization Validation CA - SHA256 - G2
---
No client certificate CA names sent
---
SSL handshake has read 3536 bytes and written 331 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : ECDHE-RSA-AES128-SHA
    Session-ID: 2FA52934A3A9AB504922B601AB3E69A9DB4BEB8523D85BFECD87E7BE814A44A6
    Session-ID-ctx:
    Master-Key: 437D68A3885E08628EE98E59C2D5858C26CDC355E764CE56DFADC881A5A85AB0DBB178E2BF592CC2A1576A7C78A7939E
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1554465108
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
---
closed

If the protocol is not supported you’ll see a message like this:

# openssl s_client -connect www.abort-retry-fail.com:443 -tls1
CONNECTED(00000003)
write:errno=104
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 0 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : 0000
    Session-ID:
    Session-ID-ctx:
    Master-Key:
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1554465422
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
---

Method 2: nmap

Our prefered method. First make sure nmap is installed, if it isn’t run apt-get install nmap . Once installed you can use commands to check the SSL / TLS version using the ssl-enum-ciphers script. This script will let you scan a target and list all SSL protocols and ciphers that are available on that server.

nmap --script ssl-enum-ciphers -p 443 www.bbc.co.uk

The ssl-enum-ciphers script will check SSL / TLS version support, cipher support and provide a grade. See sample output below:

# nmap --script ssl-enum-ciphers -p 443 www.bbc.co.uk

Starting Nmap 6.47 ( http://nmap.org ) at 2019-04-05 13:14 BST
Nmap scan report for www.bbc.co.uk (212.58.249.210)
Host is up (0.0038s latency).
Other addresses for www.bbc.co.uk (not scanned): 212.58.244.68
rDNS record for 212.58.249.210: bbc-vip148.lbh.bbc.co.uk
PORT    STATE SERVICE
443/tcp open  https
| ssl-enum-ciphers:
|   SSLv3: No supported ciphers found
|   TLSv1.0:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA - strong
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA - strong
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA - strong
|       TLS_RSA_WITH_AES_128_CBC_SHA - strong
|       TLS_RSA_WITH_AES_256_CBC_SHA - strong
|     compressors:
|       NULL
|   TLSv1.1:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA - strong
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA - strong
|       TLS_RSA_WITH_3DES_EDE_CBC_SHA - strong
|       TLS_RSA_WITH_AES_128_CBC_SHA - strong
|       TLS_RSA_WITH_AES_256_CBC_SHA - strong
|     compressors:
|       NULL
|   TLSv1.2: No supported ciphers found
|_  least strength: strong

Nmap done: 1 IP address (1 host up) scanned in 1.76 seconds

You May Also Like