]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: ssl: don't set a 0 timeout on an expired TLS session
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 14 Sep 2026 12:32:05 +0000 (14:32 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 14 Sep 2026 15:16:45 +0000 (17:16 +0200)
commit217da687210699153f6569813c340e5131005807
tree9eb358713b8058c07745eaac2a4c989e05ba3398
parent277610add93687ada7e71ef303f238db84b231c1
BUG/MEDIUM: ssl: don't set a 0 timeout on an expired TLS session

Commit 9f1d590999 ("BUG/MEDIUM: ssl: enforce tune.ssl.lifetime across
TLS1.3 session renewals") clamps a resumed session's timeout to what is
left of its original lifetime. Once that deadline is reached there is
nothing left, and the session was given a timeout of 0.

OpenSSL encodes the session timeout as an optional ASN.1 field which it
omits when the value is zero, and the decoder then substitutes its own
default (3 seconds) instead. construct_stateless_ticket() first measures
the ticket, then re-encodes it, so the two lengths no longer match and
an internal consistency check fails. The resumed handshake is aborted
with an SSL_AD_INTERNAL_ERROR alert (80) instead of gracefully falling
back to a full handshake:

  1.1.1: error:1427D044:SSL routines:construct_stateless_ticket:internal error
  3.0:   error:0A0C0103:SSL routines::internal error

Only OpenSSL 3.1 and older are affected, newer versions don't compare
session ages in whole seconds anymore.

Fix this by never handing out a zero timeout: when nothing is left of
the original lifetime, clear the session's id context instead. The
session then no longer matches any SSL_CTX, so OpenSSL drops it and
performs a full handshake. This also makes the expired session really
disappear from the stateful cache, which a 0 timeout failed to do since
it was read back as the 3 seconds default.

This fixes issue #3499.

This must be backported as far as 2.8, where 9f1d590999 was backported.
src/ssl_sock.c