Repository navigation
Description
Describe the bug
Since 9.2.0, valkey-server aborts the TLS setup when any certificate in tls-ca-cert-file is expired, even if the CA that signed the server certificate is valid:
# One or more loaded CA certificates are invalid. Aborting TLS configuration.
# Failed to configure TLS. Check logs for more info.
With the same files, 9.1.3 starts fine.
A common setup during a CA rotation is to keep the previous CA in the bundle next to the new one, so that certificates signed by the old CA still validate. During a CA rotation, we keep the previous CA in the bundle next to the new one so that certificates signed by the old CA still validate. When that old CA expires, the bundle still works as a trust store, since OpenSSL just won't build chains through the expired certificate. But with 9.2.0, the server no longer starts and the container goes into a restart loop. We hit it today right after 9.2.0 was published, on an instance that was fine before a simple restart.
To reproduce
Needs OpenSSL >= 3.4 on the host for -not_before/-not_after.
#!/usr/bin/env bash
set -eu
IMAGE=${1:-valkey/valkey}
dir=$(mktemp -d) && chmod 755 "$dir" && cd "$dir"
# Valid CA and a server certificate signed by it
openssl req -x509 -newkey rsa:2048 -nodes -keyout ca.key -out ca.crt -days 3650 -subj "/CN=Current CA" \
-addext "basicConstraints=critical,CA:TRUE" -addext "keyUsage=critical,keyCertSign,cRLSign" 2>/dev/null
openssl req -newkey rsa:2048 -nodes -keyout server.key -out server.csr -subj "/CN=localhost" 2>/dev/null
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 365 2>/dev/null
# Old CA kept in the bundle during a CA rotation, now expired
openssl req -x509 -newkey rsa:2048 -nodes -keyout old-ca.key -out old-ca.crt -subj "/CN=Old CA" \
-addext "basicConstraints=critical,CA:TRUE" -not_before 20240101000000Z -not_after 20250101000000Z 2>/dev/null
cat ca.crt old-ca.crt > ca-bundle.crt
chmod 644 ./*
for tag in 9.1.3 9.2.0; do
echo "== $tag"
docker run --rm -v "$dir:/tls:ro" "$IMAGE:$tag" timeout 2 valkey-server --port 0 --tls-port 6380 \
--tls-cert-file /tls/server.crt --tls-key-file /tls/server.key \
--tls-ca-cert-file /tls/ca-bundle.crt 2>&1 | grep -E "Ready to accept|invalid|Failed to configure TLS" || true
done
rm -rf "$dir"Output:
== 9.1.3
* Ready to accept connections tls
== 9.2.0
# One or more loaded CA certificates are invalid. Aborting TLS configuration.
# Failed to configure TLS. Check logs for more info.
Expected behavior
As far as I understand, this change was not supposed to ship in a minor release. #3572 reverted #2999 from 9.1 with this description: "We plan to do in next major version as it's a breaking change." On #2999, it was suggested on Sep 11 to revert it again from the 9.2 branch, and that was agreed, but the check is in the 9.2.0 tag and the 9.2.0 release notes don't mention it.
I understand the long-term direction, and rejecting an expired server or client certificate makes sense. For the CA bundle it's less obvious to me. An expired CA in a trust store is not a misconfiguration that silently weakens anything, it's a common leftover of a CA rotation. Today it turns a working setup into a server that refuses to start, with no option to opt out.
Would it be possible to:
- revert Fail fast on invalid certificates at TLS config load #2999 in a 9.2.1, as previously decided for the 9.x line, or at least
- add a config option to turn the check off, for example
tls-reject-invalid-ca-certs yes|no. It could default tonoon 9.x to keep the 9.1 behavior, and toyesin 10.0. That way users who want the strict behavior can enable it now, and people with a rotated CA bundle have a way out without downgrading or patching their trust store in a hurry, and - alternatively, only log a warning for expired certificates in the CA bundle instead of aborting, which is what add warning log when certs are expired/not yet valid #3153 proposes
- mention the change in the release notes, whatever the default ends up being.
Additional information
- Images: official
valkey/valkey:9.1.3andvalkey/valkey:9.2.0 - The check comes from
areAllCaCertsValid()increateSSLContext()(src/tls.c) - Related: Fail fast on invalid certificates at TLS config load #2999, Revert "Fail fast on invalid certificates at TLS config load (#2999)" #3572, add warning log when certs are expired/not yet valid #3153
Activity
Baraa-Hasheesh commentedon Nov 19, 2026
This was added to the agenda to the next weekly meeting https://github.com/valkey-io/valkey/wiki/Weekly-meetings
madolson commentedon Nov 23, 2026
@zuiderkwast @yang-z-o We forgot to revert #2999 on 9.2. #5550 reverts it and #3522 on the 9.2 branch.
Should we consider backing out #2999 altogether, including from unstable?
[9.2] Revert fail-fast TLS certificate checks (#2999, #3522) (#5550)