Repository navigation
fix(transport): reload_tls_config reaches the acceptor's certificate - #208
Merged
yeoleobun merged 1 commit intoOct 16, 2026
Merged
Conversation
create_acceptor built the rustls ServerConfig with a clone of the ReloadableCertResolver and kept the original for reload_tls_config. ReloadableCertResolver::clone creates a new lock with a copy of the certificate, so a reload replaced the certificate of the stored resolver while the acceptor kept answering handshakes with the one it started with. The reload logged success and had no effect on the wire. Wrap the resolver in one Arc and hand that Arc to both the ServerConfig and the listener, so a reload is seen by the next handshake. Add a regression test that serves a TLS listener, records the certificate a client is presented, reloads, connects again and expects the new certificate. It fails on main and passes with this change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Fixes #207.
Problem
reload_tls_configreports success but the listener keeps presentingthe certificate it started with.
create_acceptor(src/transport/tls.rs) builds the rustlsServerConfigwithArc::new(resolver.clone())and returnsArc::new(resolver)as the handle stored incert_resolver.ReloadableCertResolver::clonecreates a freshRwLockwith a copy ofthe
CertifiedKey, so the acceptor and the stored handle are tworesolvers. A reload writes to the stored one; handshakes read from the
acceptor's copy.
Fix
Create one
Arc<ReloadableCertResolver>and give that sameArctowith_cert_resolverand to the caller. Nothing else changes:ReloadableCertResolver, itsCloneimpl andreload_tls_configstayas they are.
Test
test_reload_tls_config_reaches_handshakeinsrc/transport/tests/test_tls_reload.rs: serves aTlsListenerConnectionwith certificate A, connects with a rustls client whose verifier records
the presented end-entity certificate, calls
reload_tls_configwithcertificate B, connects again and expects B.
On
mainthe test fails at the second assertion (A is presented again);with this change it passes. The existing resolver tests in that file
keep passing (they call
reloadon a resolver directly and so never sawthe problem).
Checks
cargo fmt --check,cargo test --lib(441 tests).