From: William Lallemand Date: Fri, 14 Aug 2026 09:07:12 +0000 (+0000) Subject: MINOR: ssl-gencert: enforce a stronger seed for the LRU cache key X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21ba33f12d936764f868b6561f7d5e677b241139;p=thirdparty%2Fhaproxy.git MINOR: ssl-gencert: enforce a stronger seed for the LRU cache key The generated-certificate LRU cache key is seeded with the process start time (time(NULL)). This is not considered a bug per se: 'generate-certificates' is generally deployed in MITM/interception contexts where the operator already controls both ends of the connection. Still, relying on the process start time for this seed is fragile, so switch to ha_random64(), which is seeded at boot from /dev/urandom and OpenSSL's RAND_bytes(). --- diff --git a/src/ssl_gencert.c b/src/ssl_gencert.c index f57c655ff..b608f552c 100644 --- a/src/ssl_gencert.c +++ b/src/ssl_gencert.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #if (defined SSL_CTRL_SET_TLSEXT_HOSTNAME && !defined SSL_NO_GENERATE_CERTIFICATES) @@ -440,7 +441,8 @@ ssl_sock_gencert_load_ca(struct bind_conf *bind_conf) if (global_ssl.ctx_cache) { ssl_ctx_lru_tree = lru64_new(global_ssl.ctx_cache); } - ssl_ctx_lru_seed = (uint64_t)time(NULL); + /* unpredictable seed, must not be guessable from the outside */ + ssl_ctx_lru_seed = ha_random64(); ssl_ctx_serial = now_ms; #endif