quic: add TLS session ticket resumption support#42734
quic: add TLS session ticket resumption support#42734bellatoris wants to merge 36 commits intoenvoyproxy:mainfrom
Conversation
This change enables TLS session ticket resumption for QUIC connections, allowing clients to resume TLS sessions without full handshakes when reconnecting across server instances. Implementation details: - Add EnvoyTlsServerHandshaker that provides custom ProofSourceHandle to intercept certificate selection and configure session ticket options - Store filter chain pointer in SSL ex_data during handshake to enable session ticket callback to access the correct transport socket factory - Delegate session ticket encryption/decryption to ServerContextImpl which uses configured session_ticket_keys - Add runtime guard envoy.reloadable_features.quic_session_ticket_support (default false) to control feature enablement The feature integrates with existing DownstreamTlsContext configuration: - Uses session_ticket_keys from TLS context for ticket encryption - Respects disable_stateless_session_resumption setting - Honors handles_session_resumption capability flag Risk Level: Low (behind runtime guard, disabled by default) Signed-off-by: Doogie Min <doogie.min@sendbird.com>
|
Hi @bellatoris, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
|
Please fix format. /wait |
Signed-off-by: Doogie Min <doogie.min@sendbird.com>
|
Please merge main. |
done |
|
@bellatoris looks like some CI checks need to be fixed |
a5c20f4 to
a290a7e
Compare
|
@nezdolik seems like they are flaky ones. except code coverage, all tests is passed. |
|
/wait Need merge of main |
|
Adding @RyanTheOptimist as a reviewer as @danzh2010 hasn't gotten to this yet. |
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
@RyanTheOptimist or @danzh2010 please review |
Signed-off-by: Doogie Min <doogie.min@sendbird.com>
|
/retest |
|
Sorry, is it my turn to review this PR or it's still WIP? |
|
@danzh2010 please review it 😄. It is ready for review. |
Signed-off-by: Doogie Min <doogie.min@sendbird.com>
- Expand EnvoyTlsServerHandshaker class comment to explain pinning rationale, ServerContext lifetime, and how it matches TCP TLS behavior - Restore original order of private members in envoy_quic_proof_source.h (zero diff against main for this file) - Add comment on CreateDownstreamTransportSocketPanics explaining why the QUIC transport socket factory is not used to create transport sockets - Swap order of expectCertChainAndPrivateKey and loadCertsIntoFactory for cleaner diff against main Signed-off-by: Doogie Min <doogie.min@sendbird.com>
The CI spelling checker accepts QUICHE (in tools/spelling/spelling_dictionary.txt) but not the possessive form QUICHE's. Rewrote the sentence to avoid it. Signed-off-by: Doogie Min <doogie.min@sendbird.com>
|
Are the comments from @danzh2010 addressed? |
Signed-off-by: Doogie Min <doogie.min@sendbird.com>
yes
done |
|
/retest |
danzh2010
left a comment
There was a problem hiding this comment.
LGTM, thanks for contributing to QUIC stack!
|
Please update the PR description with new implementation approach |
@danzh2010 Done, thank you for the review. |
Signed-off-by: Doogie Min <doogie.min@sendbird.com>
Signed-off-by: Doogie Min <doogie.min@sendbird.com>
|
Looks like current.yaml was merged incorrectly in this PR. #44287 |
|
/retest |
|
@RyanTheOptimist mind doing another pass? The code has diverged quite a bit since your last stamp. |
Signed-off-by: Doogie Min <doogie.min@sendbird.com>
|
/retest |
Commit Message: quic: add session ticket resumption support using configured session ticket keys
Additional Description:
Summary
TLS session resumption is essential for QUIC performance. Without it, every connection requires a full TLS handshake, and 0-RTT becomes meaningless since there's no session state to resume from. As noted in #42682, TLS-related data accounts for roughly 1/3 of bytes during connection establishment - session resumption eliminates most of this overhead.
Currently, Envoy's QUIC implementation does not support session resumption across workers or processes. While users can configure
session_ticket_keysorsession_ticket_keys_sds_secret_configin downstream TLS context, these settings have no effect on QUIC connections. This limitation is documented in #25418, which explicitly states that session ticket key plumbing is missing from the QUIC implementation.This PR bridges that gap by enabling QUIC to use the same session ticket keys configured for TCP TLS, allowing session resumption to work across workers and processes.
Implementation
We subclass QUICHE's
TlsServerHandshakerasEnvoyTlsServerHandshakerand install a session-ticket key callback on the shared QUICHESSL_CTX. The callback reusesServerContextImpl::sessionTicketProcess()so QUIC and TCP TLS share identical session-ticket handling (same keys, same format, same rotation semantics).Key design decisions:
Per-connection pinning of
ServerContextImpl: EachEnvoyTlsServerHandshakerholds aServerContextSharedPtrcaptured at connection creation, and storesthisin SSL ex_data. The static ticket callback retrieves the handshaker from ex_data and delegates to the pinned context'ssessionTicketProcess(). Because the shared pointer keeps the context alive, an SDS update that rotates the factory's active context does not invalidate in-flight connections — matching TCP TLS behavior where each connection is bound to theServerContextImplactive at connection creation.SSL_CTX_set_tlsext_ticket_key_cboverSSL_CTX_set_ticket_aead_method: We use the same callback mechanism as TCP TLS rather than QUICHE'sTicketCrypterinterface, soServerContextImpl::sessionTicketProcess()can be reused unchanged.Graceful fallback: If the runtime guard is toggled between
OnNewSslCtx(which installs the callback on the sharedSSL_CTX) and connection creation (which may fall back to the vanilla handshaker), the ticket callback finds a null handshaker in ex_data and returns 0 to skip ticket issuance for that connection rather than crashing.Flow
Risk Level: Low (behind runtime guard, disabled by default)
Testing: New unit tests for
EnvoyTlsServerHandshakerandEnvoyQuicProofSource; new integration coverage insds_dynamic_integration_test(SessionTicketKeysViaSds,SessionTicketKeysRemovedViaSds) and inquic_http_integration_test(SessionTicketResumptionWithStaticKeys,NoSessionTicketResumptionWithoutKeys).Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
[Optional Runtime guard:]
envoy.reloadable_features.quic_session_ticket_support(default: false)[Optional Fixes #Issue] Partially addresses #25418