Hi Manu, On 03/20/2017 11:46 AM, Emeric Brun wrote: > Hi Manu, > > On 03/17/2017 06:43 PM, Emmanuel Hocdet wrote: >> >>> Le 16 mars 2017 à 17:49, Emmanuel Hocdet <[email protected] >>> <mailto:[email protected]>> a écrit : >>> >>> Hi Emeric, >>> >>>> Le 16 mars 2017 à 14:44, Emeric Brun <[email protected] >>>> <mailto:[email protected]>> a écrit : >>>> >>>> I'm clearly not sure that setting openssl's options to ~no-tlsxx have the >>>> same behavior than forcing the callback sets (using force-) to one >>>> protocol. >>>> >>>> I always suspected that no-tlsxx options applies on a kind of >>>> 'capabilities' where as setting a callback-set clearly force the usage of >>>> a protocol version. >>>> >>>> So for me the patch could modify some behavior for openssl versions < 1.1 >>> >>> I did not see any problems with 1.0.1, 1.0.2 documentation tends to say >>> that it’s ok and 1.1.0 deprecated the haproxy ‘force’ implementation. >>> At worst, this can change something in openssl 0.9.x but it's for haproxy >>> 1.8dev… >>> It seem that use SSL_CTX_set_options is a good compatibly choice. >>> >>> The only thing i see is that no-tlsxx can generate a not recommented >>> configuration (1.0.2). >>> "The list of protocols available can be further limited using the >>> SSL_OP_NO_SSLv2, SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1 and >>> SSL_OP_NO_TLSv1_2options of the SSL_CTX_set_options >>> <https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html> or >>> SSL_set_options >>> <https://www.openssl.org/docs/man1.0.2/ssl/SSL_set_options.html> functions. >>> Clients should avoid creating "holes" in the set of protocols they support, >>> when disabling a protocol, make sure that you also disable either all >>> previous or all subsequent protocol versions. In clients, when a protocol >>> version is disabled without disabling all previous protocol versions, the >>> effect is to also disable all subsequent protocol versions." >>> >>> Openssl introduce min-tlsxx max-tlsxx directives to avoid ‘holes’ >>> configuration is equivalent to use SSL_CTX_set_options correctly. >>> >>>> There is another point which worries me: >>>> >>>> In the proposed patch, statement 'force-' will disable all known protocol >>>> version except that one. >>>> >>>> But we will face issue using 'force-' when openssl will support further >>>> tls versions not yet handled by haproxy. This problem was correctly >>>> handled by the previous implementation. >>>> >>> I agree, TLSv1.3 is missing. min-tlsxx max-tlsxx openssl directives will be >>> a better way to no care about new version. >>> I have a second patch who add TLSv1.3 and min-tlsxx max-tlsxx haproxy >>> directive (patch is ssl version agnostic). >>> >> With this patches, all tls versions are supported and it’s easy to add new >> tls version internally. >> min-tlsxx and max-tlsxx is supported for all ssllibs: configuration will be >> more clear that with no-tlsxx and without « holes ». >> Add SSL_CTX_set_min/max_proto_version could be a option but i does not see >> the necessity. >> >> Manu >> >> > > I'm still thinking that SSL_set_min/max_proto_version are a better approach > to handle 'force-' options for openssl version >= 1.1 . Less intrusive for > older openssl's versions and without any doubt on what they gonna do even if > new protocols versions would appear. > > R, > Emeric > Something like that (see attachment).
R, Emeric
>From 87612555e61b1804985bc1d012ca1d611ceb5932 Mon Sep 17 00:00:00 2001 From: Emeric Brun <[email protected]> Date: Mon, 20 Mar 2017 12:45:44 +0100 Subject: [PATCH] MINOR: fix deprecated warnings on ssl methods using openssl 1.1. X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Calls to deprecated method functions was replaced using SSL_CTX_set_min_proto_version and SSL_CTX_set_max_proto_version. --- src/ssl_sock.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/ssl_sock.c b/src/ssl_sock.c index f947c99..ffed5e7 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -3188,6 +3188,28 @@ ssl_sock_initial_ctx(struct bind_conf *bind_conf) SSL_MODE_SMALL_BUFFERS; int conf_ssl_options = bind_conf->ssl_options; +#ifdef SSL_CTX_set_min_proto_version + if (!ctx && conf_ssl_options & BC_SSL_O_USE_TLSV12) { + ctx = SSL_CTX_new(SSLv23_server_method()); + SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION); + SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION); + } + if (!ctx && conf_ssl_options & BC_SSL_O_USE_TLSV11) { + ctx = SSL_CTX_new(SSLv23_server_method()); + SSL_CTX_set_min_proto_version(ctx, TLS1_1_VERSION); + SSL_CTX_set_max_proto_version(ctx, TLS1_1_VERSION); + } + if (!ctx && conf_ssl_options & BC_SSL_O_USE_TLSV10) { + ctx = SSL_CTX_new(SSLv23_server_method()); + SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION); + SSL_CTX_set_max_proto_version(ctx, TLS1_VERSION); + } + if (!ctx && conf_ssl_options & BC_SSL_O_USE_SSLV3) { + ctx = SSL_CTX_new(SSLv23_server_method()); + SSL_CTX_set_min_proto_version(ctx, SSL3_VERSION); + SSL_CTX_set_max_proto_version(ctx, SSL3_VERSION); + } +#else #if SSL_OP_NO_TLSv1_2 if (!ctx && conf_ssl_options & BC_SSL_O_USE_TLSV12) ctx = SSL_CTX_new(TLSv1_2_server_method()); @@ -3202,6 +3224,7 @@ ssl_sock_initial_ctx(struct bind_conf *bind_conf) if (!ctx && conf_ssl_options & BC_SSL_O_USE_SSLV3) ctx = SSL_CTX_new(SSLv3_server_method()); #endif +#endif if (!ctx) { ctx = SSL_CTX_new(SSLv23_server_method()); if (conf_ssl_options & BC_SSL_O_NO_SSLV3) @@ -3587,6 +3610,28 @@ int ssl_sock_prepare_srv_ctx(struct server *srv) if (srv->check.use_ssl) srv->check.xprt = &ssl_sock; +#ifdef SSL_CTX_set_min_proto_version + if (!ctx && srv->ssl_ctx.options & SRV_SSL_O_USE_TLSV12) { + ctx = SSL_CTX_new(SSLv23_server_method()); + SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION); + SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION); + } + if (!ctx && srv->ssl_ctx.options & SRV_SSL_O_USE_TLSV11) { + ctx = SSL_CTX_new(SSLv23_server_method()); + SSL_CTX_set_min_proto_version(ctx, TLS1_1_VERSION); + SSL_CTX_set_max_proto_version(ctx, TLS1_1_VERSION); + } + if (!ctx && srv->ssl_ctx.options & SRV_SSL_O_USE_TLSV10) { + ctx = SSL_CTX_new(SSLv23_server_method()); + SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION); + SSL_CTX_set_max_proto_version(ctx, TLS1_VERSION); + } + if (!ctx && srv->ssl_ctx.options & SRV_SSL_O_USE_SSLV3) { + ctx = SSL_CTX_new(SSLv23_server_method()); + SSL_CTX_set_min_proto_version(ctx, SSL3_VERSION); + SSL_CTX_set_max_proto_version(ctx, SSL3_VERSION); + } +#else #if SSL_OP_NO_TLSv1_2 if (!ctx && srv->ssl_ctx.options & SRV_SSL_O_USE_TLSV12) ctx = SSL_CTX_new(TLSv1_2_client_method()); @@ -3601,6 +3646,7 @@ int ssl_sock_prepare_srv_ctx(struct server *srv) if (!ctx && srv->ssl_ctx.options & SRV_SSL_O_USE_SSLV3) ctx = SSL_CTX_new(SSLv3_client_method()); #endif +#endif if (!ctx) { ctx = SSL_CTX_new(SSLv23_client_method()); if (srv->ssl_ctx.options & SRV_SSL_O_NO_SSLV3) -- 2.7.4

