Skip to content

fix(http_config): fix client cert rotation when no CA is configured#908

Merged
roidelapluie merged 1 commit into
prometheus:mainfrom
machine424:ttlsco
May 20, 2026
Merged

fix(http_config): fix client cert rotation when no CA is configured#908
roidelapluie merged 1 commit into
prometheus:mainfrom
machine424:ttlsco

Conversation

@machine424
Copy link
Copy Markdown
Member

@machine424 machine424 commented May 19, 2026

#707 started using tlsRoundTripper even when no CA is configured,
enabling client cert/key hot-reloading. However, RoundTrip() still
unconditionally called updateRootCA on every transport rebuild. With
no CA data it returned false, and the code called
settings.CA.Description() on nil, panicking (prometheus/prometheus#16622).
#792 fixed the panic by returning an error instead, but every rebuild
still failed with "unable to use specified CA cert: none configured",
so cert rotation never actually worked without a CA.

Skip the updateRootCA call when settings.CA is nil so transport
rebuilds succeed and client cert rotation works without a CA as
#707 intended.

See prometheus/prometheus@a116078 for a reproducer on Prometheus

@machine424 machine424 requested a review from roidelapluie May 19, 2026 22:34
enabling client cert/key hot-reloading. However, RoundTrip() still
unconditionally called updateRootCA on every transport rebuild. With
no CA data it returned false, and the code called
settings.CA.Description() on nil, panicking (prometheus/prometheus#16622).
still failed with "unable to use specified CA cert: none configured",
so cert rotation never actually worked without a CA.

Skip the updateRootCA call when settings.CA is nil so transport
rebuilds succeed and client cert rotation works without a CA as

See prometheus/prometheus@a116078
for a reproducer on Prometheus

Signed-off-by: Ayoub Mrini <ayoubmrini424@gmail.com>
@roidelapluie roidelapluie merged commit 0f3c348 into prometheus:main May 20, 2026
8 checks passed
machine424 added a commit to machine424/prometheus that referenced this pull request May 20, 2026
Make sure it doesn't panic AND doesn't perma-fail.

Point prometheus/common to a patched version that
contains prometheus/common#908

Add TestClientTLSCertRotationWithoutCAFile (backported from
prometheus#18727) to verify the fix end-to-end.
machine424 added a commit to machine424/prometheus that referenced this pull request May 20, 2026
Make sure it doesn't panic AND doesn't perma-fail.

Point prometheus/common to a patched version that
contains prometheus/common#908

Add TestClientTLSCertRotationWithoutCAFile (backported from
prometheus#18727) to verify the fix end-to-end.
machine424 added a commit to machine424/prometheus that referenced this pull request May 20, 2026
Make sure it doesn't panic AND doesn't perma-fail.

Point prometheus/common to a patched version that
contains prometheus/common#908

Add TestClientTLSCertRotationWithoutCAFile (backported from
prometheus#18727) to verify the fix end-to-end.
machine424 added a commit to machine424/prometheus that referenced this pull request May 20, 2026
Make sure it doesn't panic AND doesn't perma-fail.

Point prometheus/common to a patched version that
contains prometheus/common#908

Add TestClientTLSCertRotationWithoutCAFile (backported from
prometheus#18727) to verify the fix end-to-end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants