From e376a13025e77805053ee22a63d89429b2d57731 Mon Sep 17 00:00:00 2001 From: Dalton Date: Fri, 5 Jun 2020 15:10:09 -0500 Subject: [PATCH] AUTH-2645 protect against user mistaken flag input --- cmd/cloudflared/tunnel/cmd.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/cloudflared/tunnel/cmd.go b/cmd/cloudflared/tunnel/cmd.go index 75b39209..84e547c4 100644 --- a/cmd/cloudflared/tunnel/cmd.go +++ b/cmd/cloudflared/tunnel/cmd.go @@ -401,6 +401,14 @@ func StartServer(c *cli.Context, version string, shutdownC, graceShutdownC chan c.Set("url", "ssh://"+localServerAddress) } + url := c.String("url") + hostname := c.String("hostname") + if url == hostname && url != "" && hostname != "" { + errText := "hostname and url shouldn't match. See --help for more information" + logger.Error(errText) + return fmt.Errorf(errText) + } + if staticHost := hostnameFromURI(c.String("url")); isProxyDestinationConfigured(staticHost, c) { listener, err := net.Listen("tcp", "127.0.0.1:") if err != nil {