Redirect all SSH traffic through a "middleman" server

3

1

this is my setup right now: A. My NAS with static IP, reachable via SSH from the Internet (OS X) B. a VPS (Ubuntu Server) C. a dedicated server (Gentoo)

My question: Due to bad peering i want to tunnel all my SSH traffic from A to C through B (rsync, flexget,... running on A)

I know how to rsync using a tunnel but i can't really figure out how to make it happen so it's pushing all the traffic through the tunnel.

thanks!

grimes

mediocre

Posted 2012-08-23T15:26:08.477

Reputation: 151

Answers

2

Another way is to use netcat as an ssh proxy command. Append this to the file ~/.ssh/config on Host sourcehost:

Host targethost
    ProxyCommand ssh -q viahost nc -q0 C 22

Then ssh targethost on Host sourcehost should tunnel via Host viahost. Rsync etc. should also work. Consider to use ControlMaster like this:

ControlMaster auto
ControlPath $HOME/.ssh/tmp/%h_%p_%r

Johannes

Posted 2012-08-23T15:26:08.477

Reputation: 342

0

Tunelling ssh connection is quite easy. Step by step well written tutorial is here. You need to setup tunnel on the middle machine.

Then when you connect from A to B on specific port you will automatically connect to C.

If you want to pass all traffic - like https via tunnel you will need to install squid proxy and redirect traffic from 443 port through yout tunnel.

mnmnc

Posted 2012-08-23T15:26:08.477

Reputation: 3 637