]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl: do not try to use early data if not configured
authorWilly Tarreau <w@1wt.eu>
Wed, 3 Feb 2021 10:21:38 +0000 (11:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Feb 2021 07:04:02 +0000 (08:04 +0100)
The CO_FL_EARLY_SSL_HS flag was inconditionally set on the connection,
resulting in SSL_read_early_data() always being used first in handshake
calculations. While this seems to work well (probably that there are
fallback paths inside openssl), it's particularly confusing and makes
the debugging quite complicated. It possibly is not optimal by the way.

This flag ought to be set only when early_data is configured on the bind
line. Apparently there used to be a good reason for doing it this way in
1.8 times, but it really does not make sense anymore. It may be OK to
backport this to 2.3 if this helps with troubleshooting, but better not
go too far as it's unlikely to fix any real issue while it could introduce
some in old versions.

src/ssl_sock.c

index 628a9b0542e7ddb29d1484b096d2cfe6b603992e..ccce57874625fbab6fe270452129ede7daa47009 100644 (file)
@@ -5311,7 +5311,8 @@ static int ssl_sock_init(struct connection *conn, void **xprt_ctx)
                /* leave init state and start handshake */
                conn->flags |= CO_FL_SSL_WAIT_HS | CO_FL_WAIT_L6_CONN;
 #ifdef SSL_READ_EARLY_DATA_SUCCESS
-               conn->flags |= CO_FL_EARLY_SSL_HS;
+               if (bc->ssl_conf.early_data)
+                       conn->flags |= CO_FL_EARLY_SSL_HS;
 #endif
 
                _HA_ATOMIC_ADD(&sslconns, 1);