Skip to content

[BUG] 9.2.0 refuses to start TLS when the CA bundle contains an expired certificate (#2999 was planned for 10.0) #5506

Open

Description

@Qwarctick

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:

  1. 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
  2. add a config option to turn the check off, for example tls-reject-invalid-ca-certs yes|no. It could default to no on 9.x to keep the 9.1 behavior, and to yes in 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
  3. 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
  4. mention the change in the release notes, whatever the default ends up being.

Additional information

Activity

  1. added
    bug
    on Nov 19, 2026
  2. Baraa-Hasheesh commented on Nov 19, 2026

    @Baraa-Hasheesh
    Contributor

    This was added to the agenda to the next weekly meeting https://github.com/valkey-io/valkey/wiki/Weekly-meetings

  3. madolson commented on Nov 23, 2026

    @madolson
    Member

    @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?

  4. added a commit that references this issue on Nov 24, 2026
    cd38a77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions