Skip to content

Commit

Permalink
Make local host configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
ProbablyFaiz committed Sep 4, 2024
1 parent a71b2bd commit ec969e6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions rl/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,14 @@ def ssh(node: str):


@cli.command(help="Run an SSH server on Sherlock and tunnel it to your local machine")
@click.option(
"--host",
"-H",
"local_host",
help="Local host to bind the tunnel to",
default="localhost",
type=str,
)
@click.option(
"--port",
"-p",
Expand All @@ -557,7 +565,14 @@ def ssh(node: str):
)
@_require_duo
@_require_sherlock_credentials
def tunnel(local_port: int, remote_port: int, *, credentials: Credentials, duo: Duo):
def tunnel(
local_host: str,
local_port: int,
remote_port: int,
*,
credentials: Credentials,
duo: Duo,
):
sshd_config_path = SHERLOCK_SSH_DIR / "sshd_config"
host_key_path = SHERLOCK_SSH_DIR / "host_rsa"

Expand Down Expand Up @@ -589,7 +604,8 @@ def tunnel(local_port: int, remote_port: int, *, credentials: Credentials, duo:
try:
_run_sherlock_ssh(
"ssh",
common_args + ["-N", "-L", f"{local_port}:localhost:{remote_port}"],
common_args
+ ["-N", "-L", f"{local_host}:{local_port}:localhost:{remote_port}"],
credentials=credentials,
duo=duo,
)
Expand Down

0 comments on commit ec969e6

Please sign in to comment.