MINOR: proto_reverse_connect: prevent transparent server for pre-connect

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.
This commit is contained in:
Amaury Denoyelle 2023-09-21 16:54:41 +02:00
parent 9b6812d781
commit d3db96f11a
1 changed files with 5 additions and 1 deletions

View 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")))) {