Repository navigation
[9.2] Revert fail-fast TLS certificate checks (#2999, #3522) - #5550
Conversation
…#3522)" This reverts commit 13c66b8. Refusing to configure TLS when tls-ca-cert-dir holds no certificates is a breaking change, and the TSC decided the fail-fast certificate checks wait for a major release. The check lives inside loadCaCertDir(), which valkey-io#2999 added, so it has to go before valkey-io#2999 can be reverted. Related to valkey-io#5506. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
…io#2999)" This reverts commit eb3f465. Refusing to configure TLS when any loaded certificate is outside its validity period breaks configurations that worked in 9.1 and earlier. An expired intermediate or root left in a tls-ca-cert-file bundle after a CA rotation is normal and harmless, since OpenSSL simply does not build chains through it, but the check walks the whole X509_STORE and rejects the configuration on the first expired entry, so a server that served traffic fine on 9.1.3 refuses to start on 9.2.0. The TSC decided these checks are a breaking change that waits for a major release, and reverted them from 9.1 in valkey-io#3572. The next release turned out to be 9.2 rather than 10.0, and the revert was never carried over, so 9.2.0 shipped them. Restore the 9.1 behavior on 9.x. unstable keeps the checks for 10.0. The alternate-certificate check that valkey-io#3717 added is removed along with the primary one, so both server certificates behave the same way on 9.x. Reported-by: Philippe <31954718+Qwarctick@users.noreply.github.com> Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Review stateReady for human review. Risk: Low. This only touches TLS config load and returns it to the 9.1 behavior. The one user-visible loss is that a tls-ca-cert-dir holding only plain-named (unhashed) files stops verifying peers for anyone who relied on that in 9.2.0. The PR description already calls this out for the 9.2.1 notes. Open findings: none. Backport: Not needed. This PR targets the 9.2 release branch and is itself the 9.x revert. 9.1 already got the same revert in #3572, and the 8.x lines predate #2999. Updated for e12d5c5 at 2026-11-23 05:15 UTC. The bot rewrites this comment on every review. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 9.2 #5550 +/- ##
==========================================
- Coverage 81.60% 81.59% -0.02%
==========================================
Files 199 199
Lines 104959 104959
==========================================
- Hits 85656 85640 -16
- Misses 19303 19319 +16
🚀 New features to boost your workflow:
|
zuiderkwast
left a comment
There was a problem hiding this comment.
Approving to unblock.
Do we want to check the leaf cert only and ignore ignored expired root and intermediate certs?
> [!CAUTION] > **Opened ready with 1 unresolved security item** (`force_ready` was set): release impact may require higher urgency or security treatment. Security classification is human-owned: settle the urgency and the Security Fixes entries (re-run the cut with them, or edit through review comments) before merging. All 4 flagged items: notes flagged low-confidence; AI triaged PRs without release-notes (confirm include/exclude); release impact may require higher urgency or security treatment; notes credited to a backport. Cuts **9.2.1** onto release line `9.2`. - Promotes the release notes into a dated section, bumps `src/version.h`, and refreshes the running contributor list. - Release notes computed over the range below (`9.2.0..9dc1926`): ``` mode: ga source_ref: 9.2 target_branch: 9.2 base: 9.2.0 @ d23684e head: 9dc1926 @ 9dc1926 ``` ###⚠️ Notes to double-check The generator flagged these notes low-confidence; confirm category and wording before merging: | PR | Category | Why flagged | |----|----------|-------------| | #5366 | Bug Fixes | explicit impact scope omitted: Linux | ###⚠️ Release impact and urgency need review Code detected release-impact terms (availability, memory safety, data integrity, access control, protocol, compatibility) in these PRs; this forces review, it is not a severity classification. The requested urgency is **MODERATE**. Confirm whether these changes require `HIGH`, `CRITICAL`, or `SECURITY`, and whether any need a hand-authored **Security Fixes** entry: <details> <summary>7 PR(s) with impact signals</summary> | PR | Title | Signal | |----|-------|--------| | [#5366](#5366) | Fix double mutex unlock when shrinking IO threads | undefined behavior or unsafe arithmetic | | [#5468](#5468) | Don't resend data to a close_asap client after an IO-thread write | server crash, assertion, or availability failure | | [#5112](#5112) | Pause rehashing of path hash payloads during background iteration | server crash, assertion, or availability failure | | [#4712](#4712) | Fix execGetKeys() dropping the first 256 keys past the static buffer | server crash, assertion, or availability failure | | [#4675](#4675) | Fix cluster bus self-forget use-after-free | memory-safety risk | | [#5452](#5452) | Ignore replica claims that would close a replicaof cycle | server crash, assertion, or availability failure | | [#3245](#3245) | Fix assertion crash in processIOThreadsReadDone when DONT_PARSE client has stale argc | server crash, assertion, or availability failure | </details> ### Triage summary - 8 PR(s) triaged into the notes - 3 PR(s) triaged out Per-PR verdicts (with reasons) are in the run's `triage-verdicts` artifact. To include a wrongly-dropped PR, label it `release-notes` and re-cut. ###⚠️ Notes credited to a backport (original PR not recovered) These notes credit the backport PR, not the change's author; confirm the original PR and correct the credit before merging: | Backport PR | Title | |-------------|-------| | [#5550](#5550) | [9.2] Revert fail-fast TLS certificate checks (#2999, #3522) | ### Wording carried from other release lines A backported change is cut once per release line, and each cut words its notes independently. To keep one commit from being described differently per branch, a note whose source PR another line already published takes that published wording verbatim (joined on the trailing `(#N)`, which always names the original source PR). Only the text is reused; the category, the `by @handle` credit, and the `(#N)` are this cut's own. - Release lines consulted: `9.1`, `9.0`, `8.1`, `8.0`, `7.2`, `7.0`, `6.2`, `6.0`, `5.0`, `4.0`, `3.2`, `3.0`, `2.8`, `2.6`, `2.4`, `2.2` - No note needed its wording replaced. *Generated by valkey-ci-agent. Review before merging into the release line.* Signed-off-by: valkeyrie-bot[bot] <3692572+valkeyrie-bot[bot]@users.noreply.github.com> Co-authored-by: valkeyrie-bot[bot] <3692572+valkeyrie-bot[bot]@users.noreply.github.com>
Fixes #5506
Since 9.2.0, valkey-server refuses to configure TLS when any certificate it loads is outside its validity period, so an expired old root left in a
tls-ca-cert-filebundle after a CA rotation stops the server from starting, even though OpenSSL would never build a chain through that cert. 9.1.3 starts fine on the same files. The checks came from #2999 and #3522, which the TSC decided were a breaking change: #3572 reverted them from 9.1 and the plan was to land them in the next major, but the next release turned out to be 9.2 rather than 10.0 and the revert was never carried over. These two commits revert them from the 9.2 branch so 9.x behaves like 9.1 again;unstablekeeps them for 10.0.AI generated details
Problem
createSSLContext()onupstream/9.2validates every certificate it loads and aborts the whole TLS configuration if any one of them is expired or not yet valid:src/tls.c:653for the server and client certificates,src/tls.c:675for the alternate server certificate,src/tls.c:719for the contents of the X509 store aftertls-ca-cert-fileandtls-ca-cert-dirare loaded.areAllCaCertsValid()atsrc/tls.c:586walks the whole store and returns false on the first expired entry.That makes a normal CA rotation fatal. A bundle that still carries the retired root alongside the current one worked on 9.1 and earlier, because OpenSSL simply does not build chains through an expired cert, and nothing in the handshake path cares that it is present. On 9.2.0 the same files stop the server from starting. From #5506, same config and same cert files on both versions:
The same applies at runtime, where
CONFIG SET tls-ca-cert-fileon such a bundle now fails and keeps the old configuration.History
unstable2026-01-28) added the checks fortls-cert-file,tls-client-cert-file,tls-ca-cert-fileandtls-ca-cert-dir, plusloadCaCertDir()to eagerly loadtls-ca-cert-dirso the CA check could see those certs at all.unstablekept it because the next release was expected to be 10.0.loadCaCertDir()to also abort whentls-ca-cert-dirholds no certificates. Both PRs are labeledbreaking-change.unstableon 2026-09-16 and 9.2.0 shipped both PRs, with no release note.Affected releases: 9.2.0 only. Not 9.1.x, where #3572 removed it, and not 8.x, which predates #2999. Target release for this revert is 9.2.1.
Fix
Two commits, in the order the dependency requires, so each can be read against a plain
git revert.Revert "Fail fast on empty CA directory at TLS config load (valkey-io/valkey#3522)"is byte-for-byte a plaingit revert 13c66b82e: no later commit touched those hunks. It has to come first because its abort lives insideloadCaCertDir(), which #2999 introduced.Revert "Fail fast on invalid certificates at TLS config load (valkey-io/valkey#2999)"conflicts with six later 9.2-only commits and is resolved by hand, per file:src/tls.cisCertValid(),loadCaCertDir(),areAllCaCertsValid()and all four call sites. Kept#include <dirent.h>and#include <limits.h>, which a plain revert drops but #2913'stlsUpdateCertInfoFromDir()still needs (src/tls.c:389,src/tls.c:397). Restored the CA block to 9.1's single combined condition, which is now character-identical toupstream/9.1:src/tls.c. Everything #3717, #4663, #4664, #4577 and #2913 added tocreateSSLContext()is untouched.src/tls.c:43#include <openssl/x509_vfy.h>is left in place even though this revert removes its last direct consumers (X509_STORE_get0_objects,X509_OBJECT_*,X509_LU_X509, and #4064'sX509_V_ERR_ERROR_IN_CERT_NOT_{BEFORE,AFTER}_FIELD). The line belongs to #3717, which is not being reverted, andssl.hpulls the header in transitively anyway, so dropping it is a cleanup outside this revert rather than part of it. Say the word and it goes; 9.1 does not have it.src/tls.c(#4064)isCertValid(), so it goes with the function.isCertValid()has no caller that is not a fail-fast abort, so there is nothing left to keep it for.tests/unit/tls.tcltest_tls_cert_rejection*procs and both tests. The plain revert conflicts because a later commit swapped[file normalize ./src/valkey-tls.so]for$::VALKEY_TLS_MODULEand./src/valkey-serverfor$::VALKEY_SERVER_BINinside the removed block. Nothing else in the repo references the certs these tests used.utils/gen-test-certs.shtests/README.mdOne call a reviewer may want to make differently:
src/tls.c:675, the alternate-certificate abort, is not from #2999. #3717 added secondary certificate support in 9.2 and copied #2999's check for the second certificate, so a plain revert of #2999 would leave it behind. Keeping it would mean the primary certificate's expiry is ignored at config load while the secondary's is fatal, on the same server, in the same function, five lines apart. That is a worse surface to explain and support than either consistent choice, so it goes with the rest. Reinstating it for 10.0 is one line and belongs with the rest of the fail-fast work thatunstablealready carries.Behavior
Every cell is a server started with
--tls-port, a validtls-cert-file/tls-key-fileunless the row says otherwise, and the listed CA configuration. The cell is the log line the server printed. Base isupstream/9.2atd23684e3, built locally; 9.1.3 and 9.2.0 are the officialvalkey/valkeyimages. Raw output is below.d23684e3/ 9.2.0tls-ca-cert-file ca.crt)Ready to accept connections tlsReady to accept connections tlsReady to accept connections tlstls-ca-cert-file)One or more loaded CA certificates are invalid. Aborting TLS configuration.Ready to accept connections tlsReady to accept connections tlstls-ca-cert-dirOne or more loaded CA certificates are invalid. Aborting TLS configuration.Ready to accept connections tlsReady to accept connections tlstls-ca-cert-dirNo CA certificates loaded from directory: <dir>Ready to accept connections tlsReady to accept connections tlstls-cert-fileServer TLS certificate is invalid. Aborting TLS configuration.Ready to accept connections tlsReady to accept connections tlstls-alt-cert-fileAlternate server TLS certificate is invalid. Aborting TLS configuration.Ready to accept connections tlstls-alt-cert-filedoes not exist in 9.1The branch column matches the 9.1.3 column in every row where 9.1.3 has a value. The base column is identical to the released 9.2.0 column in every row, so the local base build is a faithful stand-in.
The expired-CA rows use a bundle of the valid test CA plus a separately-issued expired CA with a different subject, which is the reporter's rotation case: nothing chains through the expired cert.
One capability does go away with
loadCaCertDir()Reverting #2999 removes the eager
tls-ca-cert-dirload, which means OpenSSL is back to its documented-CApathcontract: certificates in that directory are found by subject-hash symlink, not by filename. 9.2.0 accidentally made a directory of plain-named.crtfiles work for peer verification, becauseloadCaCertDir()pushed every parseable file straight into the X509 store. Verified by handshaking a client certificate against a server configured withtls-ca-cert-dironly andtls-auth-clients yes:The branch matches 9.1.3, which is the point of the revert, and
utils/gen-test-certs.shalready builds the hashedca-dir/the tests use. KeepingloadCaCertDir()just for this would keep the eager scan whose zero-cert case is exactly what #3522 then turned into an abort, so it goes.Nobody on the 9.1 to 9.2.1 path can be relying on this, but somebody on the 9.2.0 to 9.2.1 path can, and for them the regression is silent:
SSL_CTX_load_verify_locationsregisters a directory lazily, so the server starts normally and then fails every handshake withcertificate verify failed. That is the same silent-misconfiguration shape #3522 was written to prevent. It is narrow, since it needs a dir-only CA config that actually verifies peers (tls-auth-clientsnotno, ortls-cluster/tls-replication), and the capability was never documented or tested as "plain filenames work". It does mean the 9.2.1 note has to name it rather than just say the checks were reverted.The 9.1.3 alternate-certificate row is blank because 9.1 has no such config and exits before TLS setup:
Alternative considered
Warn instead of fail, as #3153 proposed. It is strictly better than aborting, and it is the shape the eventual 10.0 behavior should probably take, but it still changes what 9.2.1 logs and what operators' log scrapers see relative to 9.1, for a check the TSC decided does not belong in a minor release at all. It also leaves
loadCaCertDir()in place, which means 9.2 keeps eagerly scanningtls-ca-cert-dirat config load, a behavior change of its own that 9.1 does not have, and that is where #3522's empty-directory abort grew from.An opt-out config such as
tls-verify-cert-validity-at-load. That puts a new user-visible config into a patch release, which needs a TSC vote on its own, and 10.0 would then have to deprecate it the moment the fail-fast behavior becomes the documented default. A knob whose only purpose is to undo a change we have already decided to undo is worse than undoing the change.Neither option gets 9.2 back to the behavior its users had in 9.1, which is the actual requirement for a patch release.
Testing
No new regression test. This restores behavior that 9.1 never had a test for, on a release branch whose
unstablecounterpart deliberately asserts the opposite. A test that pins "starting with an expired CA in the bundle succeeds" would have to be deleted again when 10.0 lands the fail-fast checks. The matrix above is the evidence instead.The tests removed with #2999 were the only coverage of these paths, and they asserted exactly the aborts being removed, so there is nothing left in
tests/unit/tls.tclthat can detect this change in either direction../runtest --tls --single unit/tls --loops 3: 93 passed, 0 failed.make BUILD_TLS=moduleplus./runtest --tls-module --single unit/tls: 26 passed, 0 failed. Both builds clean with no new warnings, in anubuntu:24.04container with OpenSSL 3.0.13 andtcl-tls.Release notes
Not touched here, and
00-RELEASENOTESneeds more than one line when 9.2.1 is cut. The 9.2.0 GA section currently advertises two of the three behaviors this removes, and both are false on 9.2.1:#2999 itself appears nowhere in the file, so the main fail-fast behavior is undocumented in both directions. The historical 9.2.0 section should not be edited; the 9.2.1 entry should cover all three removals, including the
tls-ca-cert-dirhash-name requirement above, which is the one with a silent failure mode.This was generated by AI but verified, with love, by a human.