Skip to content

Refresh default TLS context on secret update - #13342

Merged
bneradt merged 1 commit into
apache:masterfrom
bneradt:fix-cert-secret-default-refresh
Jul 13, 2026
Merged

Refresh default TLS context on secret update#13342
bneradt merged 1 commit into
apache:masterfrom
bneradt:fix-cert-secret-default-refresh

Conversation

@bneradt

@bneradt bneradt commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Default server certificate secret updates could rebuild the TLS
contexts for CN/SAN lookups while leaving the default/no-SNI context
pointing at the old SSL_CTX. Operators could update cert material on
disk and through the secret API, but new handshakes without a more
specific match could still serve the stale certificate.

This updates runtime context refresh to cover address/default lookup
entries owned by the same ssl_multicert policy and retains the
default context while callers create new TLS sessions. This also adds
an AuTest that updates a plugin-loaded default certificate and
verifies the next no-SNI handshake sees the new certificate.

Fixes: #9562

@bneradt bneradt added this to the 11.0.0 milestone Jun 26, 2026
Copilot AI review requested due to automatic review settings June 26, 2026 18:43
@bneradt bneradt self-assigned this Jun 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread tests/gold_tests/tls/tls_secret_update_default.test.py

@moonchen moonchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 to covering the default/no-SNI context on secret updates. A couple of issues with the new refresh loop, plus some smalls.

Comment thread src/iocore/net/SSLUtils.cc Outdated
Comment thread src/iocore/net/SSLUtils.cc Outdated

QUICCertConfig::scoped_config server_cert;
SSL *ssl = SSL_new(server_cert->defaultContext());
auto default_ctx = server_cert->defaultContext();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but worth a note in the description or a follow-up issue: QUICCertConfig builds its own SSLCertLookup that only a full reload rebuilds, so secret updates still leave QUIC serving the stale default cert.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. This change updates the SSLConfig lookup used by TCP TLS; QUICCertConfig maintains a separate lookup and still requires a full reload. I’m treating QUIC secret-update support as follow-up work rather than expanding this fix into that separate lifecycle.

Comment thread src/iocore/net/P_SSLCertLookup.h Outdated
Comment thread src/iocore/net/P_SSLCertLookup.h Outdated
Comment thread src/iocore/net/P_SSLCertLookup.h
Comment thread tests/gold_tests/tls/tls_secret_update_default.test.py Outdated
Comment thread tests/gold_tests/tls/tls_secret_update_default.test.py
Copilot AI review requested due to automatic review settings July 13, 2026 15:30
@bneradt
bneradt force-pushed the fix-cert-secret-default-refresh branch from bac9ce3 to aee87a7 Compare July 13, 2026 15:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/iocore/net/P_SSLCertLookup.h
@bneradt
bneradt force-pushed the fix-cert-secret-default-refresh branch from aee87a7 to 7dc7d88 Compare July 13, 2026 15:56
Copilot AI review requested due to automatic review settings July 13, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/iocore/net/SSLUtils.cc Outdated
Copilot AI review requested due to automatic review settings July 13, 2026 16:26
@bneradt
bneradt force-pushed the fix-cert-secret-default-refresh branch from 7dc7d88 to 1b58230 Compare July 13, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread tests/gold_tests/tls/tls_secret_update_default.test.py Outdated
Comment thread tests/gold_tests/tls/tls_secret_update_default.test.py Outdated
Copilot AI review requested due to automatic review settings July 13, 2026 17:33
@bneradt
bneradt force-pushed the fix-cert-secret-default-refresh branch from 1b58230 to f9c7d12 Compare July 13, 2026 17:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread tests/tools/plugins/ssl_secret_load_test.cc
Default server certificate secret updates could rebuild the TLS
contexts for CN/SAN lookups while leaving the default/no-SNI context
pointing at the old SSL_CTX. Operators could update cert material on
disk and through the secret API, but new handshakes without a more
specific match could still serve the stale certificate.

This updates runtime context refresh to cover address/default lookup
entries owned by the same ssl_multicert policy and retains the
default context while callers create new TLS sessions. This also adds
an AuTest that updates a plugin-loaded default certificate and
verifies the next no-SNI handshake sees the new certificate.

Fixes: apache#9562
Copilot AI review requested due to automatic review settings July 13, 2026 17:51
@bneradt
bneradt force-pushed the fix-cert-secret-default-refresh branch from f9c7d12 to 319e655 Compare July 13, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread tests/gold_tests/tls/tls_secret_update_default.test.py

@moonchen moonchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that previous findings are addressed. CI is green.

@bneradt
bneradt merged commit 01ed487 into apache:master Jul 13, 2026
15 checks passed
@bneradt
bneradt deleted the fix-cert-secret-default-refresh branch July 13, 2026 21:15
@github-project-automation github-project-automation Bot moved this to For v10.2.0 in ATS v10.2.x Jul 13, 2026
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x Jul 29, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.0 Jul 29, 2026
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to 10.2.x

cmcfarlen pushed a commit that referenced this pull request Jul 29, 2026
Default server certificate secret updates could rebuild the TLS
contexts for CN/SAN lookups while leaving the default/no-SNI context
pointing at the old SSL_CTX. Operators could update cert material on
disk and through the secret API, but new handshakes without a more
specific match could still serve the stale certificate.

This updates runtime context refresh to cover address/default lookup
entries owned by the same ssl_multicert policy and retains the
default context while callers create new TLS sessions. This also adds
an AuTest that updates a plugin-loaded default certificate and
verifies the next no-SNI handshake sees the new certificate.

Fixes: #9562
(cherry picked from commit 01ed487)
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jul 29, 2026
Default server certificate secret updates could rebuild the TLS
contexts for CN/SAN lookups while leaving the default/no-SNI context
pointing at the old SSL_CTX. Operators could update cert material on
disk and through the secret API, but new handshakes without a more
specific match could still serve the stale certificate.

This updates runtime context refresh to cover address/default lookup
entries owned by the same ssl_multicert policy and retains the
default context while callers create new TLS sessions. This also adds
an AuTest that updates a plugin-loaded default certificate and
verifies the next no-SNI handshake sees the new certificate.

Fixes: apache#9562
cmcfarlen added a commit to cmcfarlen/trafficserver that referenced this pull request Jul 29, 2026
http2_max_active_streams and tls_secret_update_default used the
ssl_multicert.yaml Disk API, which the 10.2.x autest harness does not
provide -- it registers ssl_multicert.config -- so both tests threw
AttributeError at load time. Convert them to the flat
ssl_multicert.config form already used by other tests on the branch.

For tls_secret_update_default this also updates the reload touch target
and the diags.log wait condition, which looked for "ssl_multicert.yaml
finished loading"; on 10.2.x the SSL loader logs the actual filename
(ssl_multicert.config), so the reload wait would otherwise never become
ready.

These tests were backported (via apache#13386 and apache#13342) without adapting
their config-file format to the release branch.
cmcfarlen added a commit that referenced this pull request Jul 29, 2026
http2_max_active_streams and tls_secret_update_default used the
ssl_multicert.yaml Disk API, which the 10.2.x autest harness does not
provide -- it registers ssl_multicert.config -- so both tests threw
AttributeError at load time. Convert them to the flat
ssl_multicert.config form already used by other tests on the branch.

For tls_secret_update_default this also updates the reload touch target
and the diags.log wait condition, which looked for "ssl_multicert.yaml
finished loading"; on 10.2.x the SSL loader logs the actual filename
(ssl_multicert.config), so the reload wait would otherwise never become
ready.

These tests were backported (via #13386 and #13342) without adapting
their config-file format to the release branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

In what cases are updates by TSSslSecretSet() actually used?

4 participants