Skip to content

Instantly share code, notes, and snippets.

@yossale
Created October 3, 2018 13:05
Show Gist options
  • Save yossale/25760edb6869d1aa18ff6b3c8a19e95a to your computer and use it in GitHub Desktop.
Save yossale/25760edb6869d1aa18ff6b3c8a19e95a to your computer and use it in GitHub Desktop.
alias ssh-tunnel='function _ssh_tunnel(){ set -x; port=$(gshuf -i 39152-65530 -n 1); ssh -f -N -L$port:$1:22 ec2-user@<DMZ_IP> -i ~/.ssh/dmz.pem ; ssh -i ~/.ssh/prod.pem [email protected] -p $port ;};_ssh_tunnel'
# to run:
ssh-tunnel <SOME PROD IP>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment