]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: alloc dynamic srv ssl ctx if proxy uses ssl chk rule
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 20 Sep 2021 13:31:42 +0000 (15:31 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 21 Sep 2021 11:56:03 +0000 (13:56 +0200)
The ssl context is not initialized for a dynamic server, even if there
is a tcpcheck rule which uses ssl on the related backed. This will cause
the check initialization to failed with the message :
  "Out of memory when initializing an SSL connection"

This can be reproduced by having the following config in the backend :
  option tcp-check
  tcp-check connect ssl
and create a dynamic server with check activated and a ca-file.

Fix this by calling the prepare_srv xprt callback when the proxy options
PR_O_TCPCKH_SSL is set.

Check support for dynamic servers has been merged in the current branch.
No backport needed.

src/server.c

index 659805e12376650ba8b53010bffb790f56ec57cb..a39569ea15bd48150cd549a4e64f880bb11ae3e7 100644 (file)
@@ -4563,7 +4563,7 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct
                goto out;
        }
 
-       if (srv->use_ssl == 1) {
+       if (srv->use_ssl == 1 || (srv->proxy->options & PR_O_TCPCHK_SSL)) {
                if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->prepare_srv) {
                        if (xprt_get(XPRT_SSL)->prepare_srv(srv))
                                goto out;