How to Install and Use testssl.sh in Linux to Audit TLS Encryption and Cipher Flaws

Securing network services requires rigorous validation of transport layer encryption. While basic tools like curl or openssl s_client can confirm whether a web server responds over HTTPS, they do not provide comprehensive audits of supported cryptographic cipher suites, protocol weaknesses, certificate chains, or known TLS vulnerabilities. testssl.sh is a widely acclaimed, open-source command-line tool designed to perform in-depth TLS/SSL vulnerability assessments on any port.

Because testssl.sh is implemented as a pure POSIX shell script leveraging a tailored OpenSSL build, it requires zero external compilation or library dependencies, making it ideal for Linux servers, container images, and continuous security testing pipelines.

Key Security Checks Performed by testssl.sh

When pointed at an endpoint, testssl.sh performs an extensive security evaluation:

  • Protocol Support: Detects SSLv2, SSLv3, TLS 1.0, TLS 1.1, TLS 1.2, and modern TLS 1.3.
  • Cipher Suite Evaluation: Lists server cipher preference order, Forward Secrecy (FS) support, and flags insecure 64-bit or RC4 ciphers.
  • Vulnerability Auditing: Tests for historic and modern exploits including Heartbleed, CCS Injection, Ticketbleed, ROBOT, CRIME, BREACH, POODLE, DROWN, LOGJAM, and BEAST.
  • Certificate Validation: Verifies signature algorithms (SHA-1 vs SHA-256), SANs, OCSP stapling, certificate transparency, and expiration timelines.
  • HTTP Security Headers: Audits HSTS (HTTP Strict Transport Security), HPKP, and security cookie flags.

Installing testssl.sh on Linux

You can install testssl.sh either via your distribution’s package manager or directly from the official Git repository to ensure access to the latest vulnerability databases:

# Method 1: Ubuntu / Debian
sudo apt update
sudo apt install testssl.sh -y

# Method 2: Git Clone (Recommended for latest cipher lists)
sudo apt install git bsdmainutils openssl -y
git clone --depth 1 https://github.com/drwetter/testssl.sh.git
cd testssl.sh
chmod +x testssl.sh

Common Command Flags and Options

The table below summarizes standard scanning flags available in testssl.sh:

Flag Description Primary Use Case
-U, --vulnerable Vulnerability scan only Quickly tests for high-impact CVEs without auditing full cipher lists.
-p, --protocols Protocol check Verifies which TLS/SSL versions are negotiated by the target host.
-e, --each-cipher Per-cipher suite scan Tests every individual cipher suite supported by the remote endpoint.
-S, --server-defaults Server defaults Displays default cipher, TLS extensions, and certificate parameters.
--jsonfile <file> JSON export Saves structured audit results for CI/CD automation or dashboard ingestion.
--fast Fast mode Skips time-consuming per-cipher checks to deliver accelerated results.

Running Security Scans with testssl.sh

1. Performing a Standard Full Audit

To run a comprehensive assessment against a web server on standard HTTPS port 443:

./testssl.sh https://example.com

The script displays colour-coded findings: green signifies secure parameters, yellow warns of sub-optimal settings, and red flags urgent security vulnerabilities.

2. Scanning Non-Standard Ports and STARTTLS Services

You can target custom ports and protocols that upgrade to TLS using STARTTLS (such as SMTP, IMAP, or LDAP):

# Custom port
./testssl.sh example.com:8443

# SMTP with STARTTLS
./testssl.sh -t smtp mail.example.com:25

3. Exporting Audit Reports to JSON and HTML

For compliance tracking or automated reporting in CI/CD pipelines, export findings simultaneously into multiple formats:

./testssl.sh --htmlfile report.html --jsonfile report.json https://example.com

Frequently Asked Questions

Does testssl.sh send exploit payloads that could crash production servers?

No. testssl.sh relies on non-destructive handshake negotiations and malformed client hellos specifically designed to probe for vulnerable server responses without causing denial-of-service conditions.

Why does testssl.sh warn about OpenSSL compatibility?

Some distribution-supplied OpenSSL binaries disable older ciphers (such as SSLv2 or RC4) during compilation. While testssl.sh works with system OpenSSL, using the bundled helper binaries under bin/ enables full legacy cipher detection.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.