- ssl-propquery
- ssl-provider
- ssl-provider-path
+ - ssl-security-level
- ssl-server-verify
- ssl-skip-self-issued-ca
- stats
See also: "crt", section 5.1 about bind options and section 5.2 about server
options.
+ssl-security-level <number>
+ This directive allows to chose the OpenSSL security level as described in
+ https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_security_level.html
+ The security level will be applied to every SSL contextes in HAProxy.
+ Only a value between 0 and 5 is supported.
+
+ The default value depends on your OpenSSL version, distribution and how was
+ compiled the library.
+
+ This directive requires at least OpenSSL 1.1.1.
+
ssl-server-verify [none|required]
The default behavior for SSL verify on servers side. If specified to 'none',
servers certificates are not verified. The default is 'required' except if
#define HAVE_SSL_0RTT_QUIC
#endif
+
+#if defined(SSL_CTX_set_security_level) || HA_OPENSSL_VERSION_NUMBER >= 0x1010100fL
+#define HAVE_SSL_SET_SECURITY_LEVEL
+#endif
+
+#if !defined(HAVE_SSL_SET_SECURITY_LEVEL)
+/* define a nope function for set_security_level */
+#define SSL_CTX_set_security_level(ctx, level) ({})
+#endif
+
#if (HA_OPENSSL_VERSION_NUMBER >= 0x3000000fL)
#define HAVE_OSSL_PARAM
#define MAC_CTX EVP_MAC_CTX
#endif
+
+#if (HA_OPENSSL_VERSION_NUMBER < 0x10101000L)
+#endif
+
+
#if (HA_OPENSSL_VERSION_NUMBER < 0x3000000fL)
#if defined(SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB)
#define SSL_CTX_set_tlsext_ticket_key_evp_cb SSL_CTX_set_tlsext_ticket_key_cb
int keylog; /* activate keylog */
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 */
+ int security_level; /* configure the openssl security level */
#ifndef OPENSSL_NO_OCSP
struct {
return 0;
}
+/* parse the "ssl-security-level" keyword in global section. */
+static int ssl_parse_security_level(char **args, int section_type, struct proxy *curpx,
+ const struct proxy *defpx, const char *file, int linenum,
+ char **err)
+{
+#ifndef HAVE_SSL_SET_SECURITY_LEVEL
+ memprintf(err, "global statement '%s' requires at least OpenSSL 1.1.1.", args[0]);
+ return -1;
+#else
+ char *endptr;
+
+ if (!*args[1]) {
+ ha_alert("parsing [%s:%d] : '%s' : missing value\n", file, linenum, args[0]);
+ return -1;
+ }
+
+ global_ssl.security_level = strtol(args[1], &endptr, 10);
+ if (*endptr != '\0') {
+ ha_alert("parsing [%s:%d] : '%s' : expects an integer argument, found '%s'\n",
+ file, linenum, args[0], args[1]);
+ return -1;
+ }
+
+ if (global_ssl.security_level < 0 || global_ssl.security_level > 5) {
+ ha_alert("parsing [%s:%d] : '%s' : expects a value between 0 and 5\n",
+ file, linenum, args[0]);
+ return -1;
+ }
+#endif
+
+ return 0;
+}
+
/* parse the "ssl-skip-self-issued-ca" keyword in global section. */
static int ssl_parse_skip_self_issued_ca(char **args, int section_type, struct proxy *curpx,
const struct proxy *defpx, const char *file, int line,
{ CFG_GLOBAL, "ssl-provider", ssl_parse_global_ssl_provider },
{ CFG_GLOBAL, "ssl-provider-path", ssl_parse_global_ssl_provider_path },
#endif
+ { CFG_GLOBAL, "ssl-security-level", ssl_parse_security_level },
{ CFG_GLOBAL, "ssl-skip-self-issued-ca", ssl_parse_skip_self_issued_ca },
{ CFG_GLOBAL, "tune.ssl.cachesize", ssl_parse_global_int },
#ifndef OPENSSL_NO_DH
ctx = SSL_CTX_new(TLS_server_method());
bind_conf->initial_ctx = ctx;
+ if (global_ssl.security_level > -1)
+ SSL_CTX_set_security_level(ctx, global_ssl.security_level);
SSL_CTX_set_options(ctx, options);
SSL_CTX_set_mode(ctx, SSL_MODE_RELEASE_BUFFERS);
SSL_CTX_set_min_proto_version(ctx, TLS1_3_VERSION);
/* Create and set the new SSL_CTX */
if (!(ssl_ctx = SSL_CTX_new(SSLv23_server_method())))
goto mkcert_error;
+
+ if (global_ssl.security_level > -1)
+ SSL_CTX_set_security_level(ssl_ctx, global_ssl.security_level);
+
if (!SSL_CTX_use_PrivateKey(ssl_ctx, pkey))
goto mkcert_error;
if (!SSL_CTX_use_certificate(ssl_ctx, newcrt))
#ifdef HAVE_SSL_KEYLOG
.keylog = 0,
#endif
+ .security_level = -1,
#ifndef OPENSSL_NO_OCSP
.ocsp_update.delay_max = SSL_OCSP_UPDATE_DELAY_MAX,
.ocsp_update.delay_min = SSL_OCSP_UPDATE_DELAY_MIN,
goto error;
}
+ if (global_ssl.security_level > -1)
+ SSL_CTX_set_security_level(ctx, global_ssl.security_level);
+
errcode |= ssl_sock_put_ckch_into_ctx(path, data, ctx, err);
if (errcode & ERR_CODE)
goto error;
goto error;
}
+ if (global_ssl.security_level > -1)
+ SSL_CTX_set_security_level(ctx, global_ssl.security_level);
+
errcode |= ssl_sock_put_srv_ckch_into_ctx(path, data, ctx, err);
if (errcode & ERR_CODE)
goto error;
ctx = SSL_CTX_new(SSLv23_server_method());
bind_conf->initial_ctx = ctx;
+ if (global_ssl.security_level > -1)
+ SSL_CTX_set_security_level(ctx, global_ssl.security_level);
+
if (conf_ssl_methods->flags && (conf_ssl_methods->min || conf_ssl_methods->max))
ha_warning("Proxy '%s': no-sslv3/no-tlsv1x are ignored for bind '%s' at [%s:%d]. "
"Use only 'ssl-min-ver' and 'ssl-max-ver' to fix.\n",
cfgerr++;
return cfgerr;
}
+ if (global_ssl.security_level > -1)
+ SSL_CTX_set_security_level(ctx, global_ssl.security_level);
srv->ssl_ctx.ctx = ctx;
}