One common use is to secure vnc, which has no crypto built into it. On the remote host, have the vnc server listen only on localhost:5901 This assumes everyone who can ssh to the server should be allowed access. On your workstation, form an ssh tunnel to that remote host and its port, and link it your own localhost:5901 Open your vnc client GUI and set it to open 127.0.0.1:5901, voila, vnc session. More fun things: s…
A visual guide to SSH tunnels
31–40 of 82 posts
Re: A visual guide to SSH tunnels
#32A lot of tunneling tutorial, medium articles and blog post mixes local and remote port forwarding and use the words interchangeably which cause a lot of confusion.
Re: A visual guide to SSH tunnels
#33Re: A visual guide to SSH tunnels
#34One common use is to secure vnc, which has no crypto built into it. On the remote host, have the vnc server listen only on localhost:5901 This assumes everyone who can ssh to the server should be allowed access. On your workstation, form an ssh tunnel to that remote host and its port, and link it your own localhost:5901 Open your vnc client GUI and set it to open 127.0.0.1:5901, voila, vnc session. More fun things: s…
SSH supports unix domain socket forwarding and even cross unix/ip forwarding with a syntax like:
ssh -L /path/to/sock:/path/to/sock
ssh -L /path/to/sock:localhost:5901
ssh -L 5091:/path/to/sock
Then you can have user-authenticated host and transit secure password-less VNC connections.Unfortunately I haven't been able to convince tigervnc viewer to connect to a unix domain socket, so I don't have a fully scripted connection, but remmina and tigervnc server work fine.
Also, forwardings / connections fail if the socket already exists when the listening side starts up (often an unclosed leftover), so I rm them before starting the ssh connection / vnc server and it works reliably.
Re: A visual guide to SSH tunnels
#35Domain sockets can be forwarded via ssh with the same -L and -R arguments, including cross unix/ip forwardings.
Re: A visual guide to SSH tunnels
#36Earlier quoted context omitted.
One can further tunnel SSH inside of TLS with Stunnel [0] to get through firewalls that block SSH but permit arbitrary TLS connections. Loading a website through this requires three layers of TCP but assuming the connection is good this should be okay. A couple reasons for a regular VPN: they can be made automatic and persistent so the tunnel is always ready for use, they can tunnel other protocols besides TCP, they…
Stunnel and ssh tunnels don't put TCP inside TCP so it shouldn't risk any TCP-in-TCP congestion issues?
It still does have overhead, so lower bandwidth. Also, TCP, SSH and/or TLS forwarding of UDP, IP or Ethernet can have issues with delays, re-transmits etc (TCP-in-TCP).
Re: A visual guide to SSH tunnels
#37Re: A visual guide to SSH tunnels
#38Is it just me or is this site a bit of a disaster on mobile?
Re: A visual guide to SSH tunnels
#39Great write up! One thing to add is that you can even open tunnels during an interactive session without disconnection. To do this, type the escape command sequence ~C (will not show) and it will drop you to the control prompt. You can then add tunnels. ssh> ssh> -L 8000:localhost:9000 Forwarding port.
Re: A visual guide to SSH tunnels
#40Why don't people use unix domain sockets for local connections? They are pretty much the same thing as local IP connections, except access rights apply as on files, so you're not exposing connections to pretty much all processes. Domain sockets can be forwarded via ssh with the same -L and -R arguments, including cross unix/ip forwardings.