From 840ae69ef3c02c314cd1ce245bb4fab754c82fb3 Mon Sep 17 00:00:00 2001 From: Abhay Saxena Date: Thu, 13 Dec 2018 15:48:07 -0500 Subject: [PATCH] Replace localhost with 127.0.0.1 --- newsfragments/783.bugfix | 1 + telepresence/connect/ssh.py | 2 +- telepresence/mount.py | 2 +- telepresence/outbound/container.py | 4 ++-- telepresence/outbound/vpn.py | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 newsfragments/783.bugfix diff --git a/newsfragments/783.bugfix b/newsfragments/783.bugfix new file mode 100644 index 0000000000..bd2315bb4c --- /dev/null +++ b/newsfragments/783.bugfix @@ -0,0 +1 @@ +Telepresence is less likely to get confused by network setups that have IPv6 enabled. diff --git a/telepresence/connect/ssh.py b/telepresence/connect/ssh.py index e433a5ea02..56a40164c7 100644 --- a/telepresence/connect/ssh.py +++ b/telepresence/connect/ssh.py @@ -25,7 +25,7 @@ def __init__( self, runner: Runner, port: int, - user_at_host: str = "telepresence@localhost", + user_at_host: str = "telepresence@127.0.0.1", ) -> None: self.runner = runner self.port = port diff --git a/telepresence/mount.py b/telepresence/mount.py index 9c3a6b4a4c..4a1eb85085 100644 --- a/telepresence/mount.py +++ b/telepresence/mount.py @@ -51,7 +51,7 @@ def mount_remote_volumes( # Don't store host key: "-o", "UserKnownHostsFile=/dev/null", - ] + middle + ["telepresence@localhost:/", mount_dir], + ] + middle + ["telepresence@127.0.0.1:/", mount_dir], stderr=STDOUT ) mounted = True diff --git a/telepresence/outbound/container.py b/telepresence/outbound/container.py index 76ee29c7c4..c9d0a9cbf1 100644 --- a/telepresence/outbound/container.py +++ b/telepresence/outbound/container.py @@ -121,7 +121,7 @@ def run_docker_command( publish_args.append( "--publish=127.0.0.1:{}:38022/tcp".format(container_sshd_port) ) - local_ssh = SSH(runner, container_sshd_port, "root@localhost") + local_ssh = SSH(runner, container_sshd_port, "root@127.0.0.1") # Start the sshuttle container: name = random_name() @@ -153,7 +153,7 @@ def run_docker_command( local_ssh.wait() runner.launch( "Local SSH port forward", - local_ssh.bg_command(["-R", "38023:localhost:{}".format(ssh.port)]) + local_ssh.bg_command(["-R", "38023:127.0.0.1:{}".format(ssh.port)]) ) # Wait for sshuttle to be running: diff --git a/telepresence/outbound/vpn.py b/telepresence/outbound/vpn.py index 63b580aaea..6e3f8a4eb2 100644 --- a/telepresence/outbound/vpn.py +++ b/telepresence/outbound/vpn.py @@ -254,7 +254,7 @@ def connect_sshuttle( "--to-ns", "127.0.0.1:9053", "-r", - "telepresence@localhost:" + str(ssh.port), + "telepresence@127.0.0.1:" + str(ssh.port), ] + get_proxy_cidrs(runner, remote_info, hosts_or_ips), keep_session=True, # Avoid trouble with interactive sudo )