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().
#include <haproxy/quic_ssl.h>
#include <haproxy/ssl_ckch.h>
#include <haproxy/ssl_sock.h>
+#include <haproxy/tools.h>
#include <haproxy/xxhash.h>
#if (defined SSL_CTRL_SET_TLSEXT_HOSTNAME && !defined SSL_NO_GENERATE_CERTIFICATES)
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