Skip to content

Commit 574ed8e

Browse files
committed
Allow no remote to work.
Pull request sshuttle#502 made -r/--remote required. However, the documentation still indicates that using no remote is a valid way to test sshuttle (see Examples section of man page). I think this mode might be useful for testing performance local without ssh, local with ssh, and remote with ssh. This patch adds a warning when -r/--remote is missing but restores the previous behavior.
1 parent c1cc391 commit 574ed8e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

sshuttle/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,9 @@ def main(listenip_v6, listenip_v4,
572572
user, sudo_pythonpath):
573573

574574
if not remotename:
575-
# XXX: We can't make it required at the argparse level,
576-
# because sshuttle calls out to itself in FirewallClient.
577-
raise Fatal("You must specify -r/--remote.")
575+
print("WARNING: You must specify -r/--remote to securely route "
576+
"traffic to a remote machine. Running without -r/--remote "
577+
"is only recommended for testing.")
578578

579579
if daemon:
580580
try:

sshuttle/ssh.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def parse_hostport(rhostport):
4343
"""
4444
# leave use of default port to ssh command to prevent overwriting
4545
# ports configured in ~/.ssh/config when no port is given
46+
if rhostport is None or len(rhostport) == 0:
47+
return None, None, None, None
4648
port = None
4749
username = None
4850
password = None

0 commit comments

Comments
 (0)