HackBlue

Tools · Cryptography and passwords in practice · 18 / 20

Auditing a server’s TLS configuration with testssl.sh

Run testssl.sh against your own server, read protocol, cipher, certificate, and header results, and fix the common findings with a modern nginx configuration.

10 min read · practice only with authorization

What testssl.sh checks

testssl.sh is an open-source script that connects to a TLS service and reports supported protocol versions, cipher suites and their order, forward secrecy, certificate details and chain, OCSP stapling, HSTS and other headers, and known vulnerabilities such as Heartbleed or ROBOT. It runs locally and does not send results anywhere.

Running it

Clone the repository and point it at a host and port you own. Use --severity to filter or --jsonfile to save results.

Snippet
git clone --depth 1 https://github.com/testssl/testssl.sh.git && cd testssl.sh
./testssl.sh https://lab.internal
./testssl.sh --protocols --server-defaults --headers lab.internal:443
./testssl.sh --severity MEDIUM --jsonfile lab.json lab.internal:443
./testssl.sh --starttls smtp mail.lab.internal:25

Lab: weak, then modern

Configure a lab nginx with TLS 1.0 and 1.1 enabled and a broad cipher list, then scan. Note the findings. Replace the TLS block with a modern profile like the one below, based on Mozilla’s intermediate guidance, reload, and scan again. Compare: no legacy protocols, forward-secret AEAD ciphers only, HSTS present.

Snippet
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
ssl_prefer_server_ciphers off;
ssl_session_tickets off;
ssl_stapling on; ssl_stapling_verify on;
add_header Strict-Transport-Security "max-age=63072000" always;

Reading the results

Prioritize: expired or mismatched certificates and incomplete chains break clients; legacy protocols and non-forward-secret ciphers weaken security; missing HSTS allows downgrade to HTTP on first visit. The Mozilla SSL Configuration Generator produces tested configurations for many servers if you need a starting point.

Diagram

Legacy versus modern TLS configuration

What testssl.sh flags and what it likes.

Legacy

Protocols. TLS 1.0, 1.1, 1.2

Ciphers. CBC and RSA key exchange allowed

HSTS. Missing

Modern

Protocols. TLS 1.2 and 1.3

Ciphers. ECDHE with AES-GCM or ChaCha20-Poly1305

HSTS. max-age of two years

Check yourself

1. Which protocol versions should a modern public server typically offer?

2. Which header tells browsers to always use HTTPS for a site?

3. Which testssl.sh option tests a mail server that upgrades to TLS?