- ssl-security-level
- ssl-server-verify
- ssl-skip-self-issued-ca
+ - ssl-workaround-bogus-keylogfile
- stats
- stats-file
- strict-limits
certificates. It's useless for BoringSSL, .issuer is ignored because ocsp
bits does not need it. Requires at least OpenSSL 1.0.2.
+ssl-workaround-bogus-keylogfile { on | off }
+ Use of this directive is strongly discouraged. OpenSSL's native key logging
+ writes TLS secrets directly to the filesystem on every SSL handshake,
+ outside of HAProxy logging, which degrades performance. In master-worker
+ mode, it also leaks file descriptors on each reload. Prefer
+ "tune.ssl.keylog on" and the ssl_xx_*_secret sample fetches to log TLS secrets
+ through HAProxy's regular logging facilities instead.
+
+ When set to "on", this directive leaves the SSLKEYLOGFILE environment
+ variable unchanged. The default is "off": HAProxy unsets it at startup,
+ before loading certificates and creating SSL contexts.
+
+ OpenSSL introduced support for SSLKEYLOGFILE in version 3.5. This feature is
+ available only when OpenSSL is built with the "enable-sslkeylog" configuration
+ option. When the variable is set to a non-empty path, OpenSSL writes TLS
+ connection secrets to that file for use by traffic analysis tools. Other
+ SSL libraries may support this variable as well.
+
+ This directive is only meant for debugging setups which rely on the SSL
+ library behavior and accept the above drawbacks. It is experimental and
+ requires "expose-experimental-directives" to appear before it, otherwise
+ the configuration file is rejected.
+
+ See also: tune.ssl.keylog
+
stats calculate-max-counters [on|off]
Activates or deactivates the calculation of stats max counters. If you
don't need them, deactivating them may increase performances a bit.
care as it will consume more memory per SSL session and could decrease
performances. This is disabled by default.
- The SSLKEYLOGFILE environment variable is not supported by HAProxy. It
- causes filesystem access and degrades performance. In master-worker mode,
- it also leaks file descriptors on each reload. Use "tune.ssl.keylog on"
+ The SSLKEYLOGFILE environment variable is not supported by HAProxy: it
+ causes filesystem access on every SSL handshake and degrades performance,
+ and in master-worker mode it leaks file descriptors on each reload. HAProxy
+ removes it from its environment at startup; see
+ "ssl-workaround-bogus-keylogfile" for the details. Use "tune.ssl.keylog on"
and the sample fetches below instead.
These sample fetches should be used to generate the SSLKEYLOGFILE that is
int ctx_cache; /* max number of entries in the ssl_ctx cache. */
int capture_buffer_size; /* Size of the capture buffer. */
int keylog; /* activate keylog */
+ int bogus_keylogfile; /* do not remove SSLKEYLOGFILE from the environment */
uint keyupdate_max; /* max received TLS1.3 KeyUpdates per second per connection (0 == unlimited) */
int extra_files; /* which files not defined in the configuration file are we looking for */
int extra_files_noext; /* whether we remove the extension when looking up a extra file */
{ CFG_GLOBAL, "external-check", cfg_parse_global_external_check },
{ CFG_GLOBAL, "description", cfg_parse_global_node_desc },
{ CFG_GLOBAL, "expose-deprecated-directives", cfg_parse_global_non_std_directives, KWF_DISCOVERY },
- { CFG_GLOBAL, "expose-experimental-directives", cfg_parse_global_non_std_directives },
+ { CFG_GLOBAL, "expose-experimental-directives", cfg_parse_global_non_std_directives, KWF_DISCOVERY },
{ CFG_GLOBAL, "fd-hard-limit", cfg_parse_global_limits },
{ CFG_GLOBAL, "force-cfg-parser-pause", cfg_parse_global_parser_pause, KWF_EXPERIMENTAL },
{ CFG_GLOBAL, "h2-workaround-bogus-websocket-clients", cfg_parse_global_bool_opts },
}
#endif
+/* parse "ssl-workaround-bogus-keylogfile" */
+static int ssl_parse_global_bogus_keylogfile(char **args, int section_type,
+ struct proxy *curpx,
+ const struct proxy *defpx,
+ const char *file, int line,
+ char **err)
+{
+ if (too_many_args(1, args, err, NULL))
+ return -1;
+
+ if (strcmp(args[1], "on") == 0)
+ global_ssl.bogus_keylogfile = 1;
+ else if (strcmp(args[1], "off") == 0)
+ global_ssl.bogus_keylogfile = 0;
+ else {
+ memprintf(err, "'%s' expects either 'on' or 'off' but got '%s'.", args[0], args[1]);
+ return -1;
+ }
+ return 0;
+}
+
/*
* parse "tune.ssl.keyupdate-rate-limit" : max received TLS1.3 KeyUpdate
* messages per second and per connection. 0 disables the limit.
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;
INITCALL1(STG_REGISTER, srv_register_keywords, &srv_kws);
static struct cfg_kw_list cfg_kws = {ILH, {
+ { CFG_GLOBAL, "ssl-workaround-bogus-keylogfile", ssl_parse_global_bogus_keylogfile, KWF_EXPERIMENTAL | KWF_DISCOVERY },
{ CFG_GLOBAL, "ca-base", ssl_parse_global_path_base },
{ CFG_GLOBAL, "crt-base", ssl_parse_global_path_base },
{ CFG_GLOBAL, "key-base", ssl_parse_global_path_base },
exit(EXIT_FAILURE);
}
+#ifdef USE_OPENSSL
+ /* Global options are known. Disable OpenSSL's native key logging before
+ * configuration parsing can create SSL contexts, unless explicitly allowed.
+ */
+ if (!global_ssl.bogus_keylogfile)
+ unsetenv("SSLKEYLOGFILE");
+#endif
+
/* From this stage all runtime modes are known. So let's do below some
* preparation steps and then let's apply all discovered modes.
*/
ha_alert("Worker failed to restore its env, exiting.\n");
exit(EXIT_FAILURE);
}
+
+#ifdef USE_OPENSSL
+ /* restore_env() may have brought SSLKEYLOGFILE back. */
+ if (!global_ssl.bogus_keylogfile)
+ unsetenv("SSLKEYLOGFILE");
+#endif
setenv("HAPROXY_MWORKER", "1", 1);
/* restore_env() above has dropped it, put it back so