]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proto_reverse_connect: prevent transparent server for pre-connect
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 21 Sep 2023 14:54:41 +0000 (16:54 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 21 Sep 2023 14:58:08 +0000 (16:58 +0200)
Prevent using transparent servers for pre-connect on startup by emitting
a fatal error. This is used to ensure we never try to connect to a
target with an unspecified destination address or port.

src/proto_reverse_connect.c

index efaf81507de425dd0202abeb06c32d75c4a3ffc3..f370ce2273d6cb9ca032914c50877ae75ddb36fa 100644 (file)
@@ -186,12 +186,16 @@ int rev_bind_listener(struct listener *listener, char *errmsg, int errlen)
                goto err;
        }
 
-       /* TODO check que on utilise pas un serveur @reverse */
        if (srv->flags & SRV_F_REVERSE) {
                snprintf(errmsg, errlen, "Cannot use reverse server '%s/%s' as target to a reverse bind.", ist0(be_name), ist0(sv_name));
                goto err;
        }
 
+       if (srv_is_transparent(srv)) {
+               snprintf(errmsg, errlen, "Cannot use transparent server '%s/%s' as target to a reverse bind.", ist0(be_name), ist0(sv_name));
+               goto err;
+       }
+
        /* Check that server uses HTTP/2 either with proto or ALPN. */
        if ((!srv->mux_proto || !isteqi(srv->mux_proto->token, ist("h2"))) &&
            (!srv->use_ssl || !isteqi(ist(srv->ssl_ctx.alpn_str), ist("\x02h2")))) {