From: William Lallemand Date: Fri, 27 Nov 2026 14:36:54 +0000 (+0000) Subject: MINOR: ssl: warn at startup when SSLKEYLOGFILE is set X-Git-Url: https://git.kaiwu.me/http/%22../$%7BGITURL%7D/static/gitweb.js?a=commitdiff_plain;h=c4c811d6e2f94b40b271a9a0421c9a2fe53c4c32;p=haproxy.git MINOR: ssl: warn at startup when SSLKEYLOGFILE is set A non-empty SSLKEYLOGFILE environment variable can make OpenSSL write TLS secrets directly to the filesystem, outside HAProxy logging. This is unsupported, degrades performance and leaks file descriptors across master-worker reloads. Warn during configuration pre-checks and recommend tune.ssl.keylog on. Emit a separate warning about the descriptor leak in master-worker mode. Skip the master to avoid duplicate warnings, and leave the environment unchanged. Empty and unset values do not trigger either warning. Verified configuration checks, setenv/unsetenv handling, zero-warning rejection, and successful TLS requests before and after a master-worker reload. No backport is required for this new startup diagnostic; the separate documentation update is intended for all stable branches. --- diff --git a/src/cfgparse-ssl.c b/src/cfgparse-ssl.c index 1b6b89b8d..88ff85625 100644 --- a/src/cfgparse-ssl.c +++ b/src/cfgparse-ssl.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -2731,6 +2732,23 @@ end: REGISTER_CONFIG_POST_SECTION("listen", post_section_frontend_crt_init); REGISTER_CONFIG_POST_SECTION("frontend", post_section_frontend_crt_init); +static int cfgparse_ssl_pre_check(void) +{ + const char *keylogfile = getenv("SSLKEYLOGFILE"); + + if (master || !keylogfile || !*keylogfile) + return ERR_NONE; + + ha_warning("The SSLKEYLOGFILE environment variable is not supported by HAProxy. " + "It causes filesystem access and degrades performance. Use 'tune.ssl.keylog on' instead.\n"); + if (global.mode & MODE_MWORKER) + ha_warning("Using SSLKEYLOGFILE in master-worker mode leaks file descriptors on each reload.\n"); + + return ERR_WARN; +} + +REGISTER_PRE_CHECK(cfgparse_ssl_pre_check); + static int cfgparse_ssl_post_check(void) { int err_code = 0;