How to Test TLS Renegotiation and Session Resumption with testssl.sh
Use the -R flag to test secure renegotiation (RFC 5746) and the -S flag to verify session resumption capabilities including session IDs, tickets, and TLS 1.3 0-RTT.
testssl.sh is an open-source TLS/SSL scanner that automates comprehensive security assessments. When you need to test TLS renegotiation and session resumption capabilities, the tool provides dedicated command-line options that inspect protocol extensions and handshake behavior according to RFC standards.
Testing TLS Renegotiation with the -R Flag
The -R or --renegotiation option initiates a targeted assessment of secure renegotiation support. According to the testssl.sh source code, the implementation resides in testssl.sh between lines 18014 and 18048, where the script inspects the ServerHello for the renegotiation_info extension and attempts a renegotiation handshake to verify secure client-initiated renegotiation. The command-line option parser defines this flag at lines 21574-21575, as documented in doc/testssl.1.md at line 250.
Running the Renegotiation Test
./testssl.sh -R example.com
Understanding the Output
The results display a security grade (A-F) for Secure Renegotiation and a separate status line for Secure Client-Initiated Renegotiation. If the server lacks the renegotiation_info extension, the script emits a warning stating "Secure renegotiation is not supported" as implemented around lines 17998-18014 in the source.
Testing Session Resumption via Server Defaults (-S)
Session resumption capabilities are evaluated as part of the Server Defaults section, invoked with the -S or --server-defaults flag. This check reports support for session ID resumption, session ticket (RFC 5077) resumption, and TLS 1.3 0-RTT early data, as documented in doc/testssl.1.md at lines 188-191.
Implementation Details
The underlying logic is handled by the sub_session_resumption() function defined at lines 7030-7045 in testssl.sh. This function executes openssl s_client -reconnect and parses the "New" versus "Reused" session markers to determine resumption functionality for each mechanism.
Command Syntax
./testssl.sh -S example.com
Resumption Capabilities Explained
The output lists three specific resumption mechanisms:
- Session ID: Traditional resumption using server-stored session state
- Session Ticket: Stateless resumption using encrypted tickets
- TLS 1.3 0-RTT: Early data transmission in TLS 1.3 handshakes
Manual Verification with utils/resume.sh
For ad-hoc debugging without running the full test suite, the repository includes utils/resume.sh. This helper script performs two sequential OpenSSL connections—one to obtain a session identifier and a second to reuse it—printing "New" or "Reused" to confirm functionality as shown in lines 3-19.
./utils/resume.sh example.com
Summary
- Use
-Rto test RFC 5746 compliant secure renegotiation; the script checks for therenegotiation_infoextension between lines 18014-18048 oftestssl.sh - Use
-Sto evaluate session resumption via thesub_session_resumption()function at lines 7030-7045, which tests session IDs, tickets, and TLS 1.3 0-RTT usingopenssl s_client -reconnect - Run
utils/resume.shfor lightweight, manual session resumption verification using direct OpenSSL calls - Consult the manual at
doc/testssl.1.md(lines 188-191, 250) for official documentation of these flags
Frequently Asked Questions
What is the difference between the -R and -S flags in testssl.sh?
The -R flag specifically tests TLS renegotiation security according to RFC 5746, checking for the renegotiation_info extension and secure client-initiated renegotiation. The -S flag runs Server Defaults checks, which include session resumption capabilities (session IDs, tickets, and TLS 1.3 0-RTT) but do not test renegotiation vulnerability.
How does testssl.sh detect session resumption support?
The tool uses the sub_session_resumption() function (lines 7030-7045 in testssl.sh) to execute openssl s_client -reconnect. It examines the session markers in the OpenSSL output—specifically looking for "New" versus "Reused" indicators—to determine if the server successfully resumes sessions via IDs, tickets, or TLS 1.3 mechanisms.
Can I test session resumption without running the full testssl.sh scan?
Yes. The repository provides utils/resume.sh, a standalone helper script that performs lightweight session resumption checks. It executes two sequential OpenSSL connections to obtain and then reuse a session, providing immediate "New" or "Reused" feedback without the overhead of a complete TLS assessment.
Where is the renegotiation check implemented in the source code?
The renegotiation test is implemented in testssl.sh between lines 18014 and 18048, where the script inspects the ServerHello for the renegotiation_info extension. The command-line option parser defines -R, --renegotiation at lines 21574-21575, as documented in doc/testssl.1.md at line 250.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →