SSH proxy

Moki Lv6

Bastion

1
ssh -p 22 user@BASTION_PUBLIC_IP -fTN -L 127.0.0.1:4440:127.0.0.1:22 

SSHFS

First key is for bastion, second for destination host.

1
2
export SSHFS_PROXY="-o ssh_command=\"ssh -i path/to/local/keyfile -J user@127.0.0.1:4440 -i path/to/local/keyfile\""
sshfs $SSHFS_PROXY user@LOCAL_IP_IN_REMOTE_ENVIRONMENT:/remote-dir local-dir

SSH

1
2
export SSH_PROXY="-o ProxyCommand=\"ssh -W %h:%p -i path/to/local/keyfile -q -p 4440 user@127.0.0.1\""
ssh $SSH_PARAMS user@LOCAL_IP_IN_REMOTE_ENVIRONMENT

SSH port forward

1
2
export SSH_PROXY="-o ProxyCommand=\"ssh -W %h:%p -i path/to/local/keyfile -q -p 4440 user@127.0.0.1\""
ssh -p 4440 user@127.0.0.1 -fTN -L 127.0.0.1:44482:LOCAL_IP_IN_REMOTE_ENVIRONMENT:443
On this page
SSH proxy