Fix global TLS ticket key use for certificate contexts - #13677
Open
RajaMuhammadAwais wants to merge 1 commit into
Open
RajaMuhammadAwais wants to merge 1 commit into
RajaMuhammadAwais wants to merge 1 commit into
Conversation
Contributor
|
[approve ci] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix TLS Session Ticket Key Divergence Between Certificate Contexts
Related Issue
Fixes apache/trafficserver#8734.
Summary
Traffic Server can use different TLS session-ticket encryption keys depending on which certificate context handles a connection. This makes session-ticket resumption inconsistent across SNI/IP certificate contexts and can cause a deployment that shares Session Ticket Encryption Keys (STEKs) to split into groups of servers that can resume tickets only within their own group.
This change makes default certificate contexts use the globally managed TLS session-ticket key configuration instead of generating and retaining an independent random key block for every certificate context.
Problem
The TLS session-ticket callback selects its key block as follows:
SSLTicketKeyConfig::default_global_keyblock.The certificate-context loader was creating a new random ticket-key block for every SNI/IP certificate context while enabling session tickets. These context-specific key blocks were stored in
SSLCertContext::keyblock.At the same time, the
TSSslTicketKeyUpdate()API updates the globalSSLTicketKeyConfigkey block. It does not replace the independently stored key blocks attached to existing certificate contexts.Therefore, a ticket-key update could succeed globally while connections selecting certificate contexts continued to encrypt and decrypt tickets with different, locally generated keys.
In a multi-server deployment using shared STEKs, this explains the issue's observed behavior: servers could resume sessions within subsets of the deployment but not across all servers.
Root Cause
The defect is the mismatch between these two ownership models:
TSSslTicketKeyUpdate()andSSLTicketKeyConfig::default_global_keyblock.Because the context-specific key blocks were not updated by the global API, the API and the TLS ticket callback could operate on different key material.
What Changed
This patch changes
ssl_context_enable_tickets()to perform only the SSL_CTX ticket-callback setup and ticket-option enablement. It no longer allocates a random key block during certificate-context construction.When session tickets are enabled:
SSL_CTX.SSLCertContextis stored without a private ticket key block.SSLTicketKeyConfig::default_global_keyblock.TSSslTicketKeyUpdate()now affect all default SNI/IP certificate contexts consistently.The change also removes the ticket-renewal metric increment that was previously performed once for each certificate context during context construction. Renewal metrics are now left to the actual global ticket-key configuration/update path.
Why This Is Safe
This preserves the existing global ticket-key behavior:
SSLTicketKeyConfig.TSSslTicketKeyUpdate()continue to replace the global key configuration.The patch does not change:
Files Changed
src/iocore/net/SSLUtils.ccValidation Performed
The following checks were completed on the fork branch:
Configured Traffic Server with CMake and Ninja.
Built against OpenSSL 3.0.13.
Built the main
traffic_servertarget successfully: