TUN-4177: Running with proxy-dns should not prevent running Named Tunnels

This commit is contained in:
Nuno Diegues 2021-04-05 11:09:38 +01:00
parent 1720ac0fc6
commit b25d38dd72
4 changed files with 17 additions and 7 deletions

View File

@ -296,7 +296,7 @@ func StartServer(
}() }()
// Serve DNS proxy stand-alone if no hostname or tag or app is going to run // Serve DNS proxy stand-alone if no hostname or tag or app is going to run
if dnsProxyStandAlone(c) { if dnsProxyStandAlone(c, namedTunnel) {
connectedSignal.Notify() connectedSignal.Notify()
// no grace period, handle SIGINT/SIGTERM immediately // no grace period, handle SIGINT/SIGTERM immediately
return waitToShutdown(&wg, cancel, errC, graceShutdownC, 0, log) return waitToShutdown(&wg, cancel, errC, graceShutdownC, 0, log)

View File

@ -85,8 +85,8 @@ func logClientOptions(c *cli.Context, log *zerolog.Logger) {
} }
} }
func dnsProxyStandAlone(c *cli.Context) bool { func dnsProxyStandAlone(c *cli.Context, namedTunnel *connection.NamedTunnelConfig) bool {
return c.IsSet("proxy-dns") && (!c.IsSet("hostname") && !c.IsSet("tag") && !c.IsSet("hello-world")) return c.IsSet("proxy-dns") && (!c.IsSet("hostname") && !c.IsSet("tag") && !c.IsSet("hello-world") && namedTunnel == nil)
} }
func findOriginCert(originCertPath string, log *zerolog.Logger) (string, error) { func findOriginCert(originCertPath string, log *zerolog.Logger) (string, error) {

View File

@ -20,11 +20,21 @@ def component_tests_config():
LOGGER.info(f"component tests base config {config}") LOGGER.info(f"component tests base config {config}")
def _component_tests_config(additional_config={}, named_tunnel=True): def _component_tests_config(additional_config={}, named_tunnel=True):
# Regression test for TUN-4177, running with proxy-dns should not prevent tunnels from running
additional_config["proxy-dns"] = True
additional_config["proxy-dns-port"] = 9053
if named_tunnel: if named_tunnel:
return NamedTunnelConfig(additional_config=additional_config, return NamedTunnelConfig(additional_config=additional_config,
cloudflared_binary=config['cloudflared_binary'], tunnel=config['tunnel'], credentials_file=config['credentials_file'], ingress=config['ingress']) cloudflared_binary=config['cloudflared_binary'],
tunnel=config['tunnel'],
credentials_file=config['credentials_file'],
ingress=config['ingress'])
return ClassicTunnelConfig( return ClassicTunnelConfig(
additional_config=additional_config, cloudflared_binary=config['cloudflared_binary'], hostname=config['classic_hostname'], origincert=config['origincert']) additional_config=additional_config, cloudflared_binary=config['cloudflared_binary'],
hostname=config['classic_hostname'], origincert=config['origincert'])
return _component_tests_config return _component_tests_config

View File

@ -11,13 +11,13 @@ expect_message = "Starting Hello World server"
def assert_log_to_terminal(cloudflared): def assert_log_to_terminal(cloudflared):
stderr = cloudflared.stderr.read(1250) stderr = cloudflared.stderr.read(1500)
assert expect_message.encode() in stderr, f"{stderr} doesn't contain {expect_message}" assert expect_message.encode() in stderr, f"{stderr} doesn't contain {expect_message}"
def assert_log_in_file(file): def assert_log_in_file(file):
with open(file, "r") as f: with open(file, "r") as f:
log = f.read(1500) log = f.read(1850)
assert expect_message in log, f"{log} doesn't contain {expect_message}" assert expect_message in log, f"{log} doesn't contain {expect_message}"