Skip to content

Instantly share code, notes, and snippets.

@zwned
Last active October 7, 2022 15:50
Show Gist options
  • Select an option

  • Save zwned/60600f4232496f38bbc3148875a97191 to your computer and use it in GitHub Desktop.

Select an option

Save zwned/60600f4232496f38bbc3148875a97191 to your computer and use it in GitHub Desktop.
SSHenanigans.md

SSHenanigans

SSHenanigans! More than just a resteraunt with goofy shit on the wall and mozerella sticks.


Overview

  • Local forwards
  • Remote forwards
  • Dynamic Forwards
  • VPN?
  • Tips 'n' trix

Realistically we only have 5 minutes so get with me after if something needs a bit more clarification


Local Forwards

Grab remote services down to your local machine

ex: You're SSHd to a host with a database and you want to run your cool database app against the remote servers database

ssh -L local_ip:local_port:destination_ip:destination_port example.com
ssh -L 0.0.0.0:5433:127.0.0.1:5432 example.com
ssh -L 1433:1.2.3.4:1433 example.com
ssh -L 192.168.1.37:8443:127.0.0.1:443 example.com

Remote Forwards

Shovel local services to your remote machines

ex: You deploy a network dropbox and you want to ensure a remote host can ssh into the protected network

ssh -R local_ip:local_port:destination_ip:destination_port example.com
ssh -R 22:127.0.0.1:42022 example.com
ssh -R 1.2.3.4:443:0.0.0.0:443 example.com

Dynamic Forwards

Create dynamic connections initiated from the remote host

You want to watch BBC4 but you dont live in the UK

ssh –D local_port
ssh -D 8080

VPN


Tips n Trix

  • Tunnels in tunnels in tunnels in tunnels
  • ControlMaster
  • rc files
  • authorized_keys
  • ssh config

Tunelception

We need to go deeper:

  • ProxyCommand (OG)
  • ProxyJump (NKOTB)
  • SSH Config

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment