1

I have the following machines

  • MachineA behind firewall somewhere at the world
  • MachineB server on the internet (middleman)
  • My Laptop behind firewall somewhere at the world

MachineA maintains a reverse SSH tunnel to MachineB

machineA:> autossh -M 2000 -N MachineBIP -R 22000:localhost:22 -C

My Laptop can create a SOCKS5 tunnel to MachineB

my_laptop:> ssh -C2qTnN -D 8123 MachineBIP

Now obviously my browser goes out through MachineB. How can I extend the tunnel so it goes out from MachineA so the browser on My Laptop can access the network of MachineA?

ptheofan
  • 411
  • 1
  • 4
  • 6

1 Answers1

1

One solution is the following.

On your laptop, using the ssh config file ~/.ssh/config.

  1. Make sure both MachineA and MachineB have the pub key of your laptop in their authorised keys list.
  2. Create the entries in the config for both machines. Write the entry MachineA as if you were calling it from MachineB after ssh -R was established.
Host machineB
    user root
    HostName _machineB_ip
    StrictHostKeyChecking no
    IdentityFile ~/.ssh/id_rsa

Host machineA
    user root
    StrictHostKeyChecking no
    HostName 127.0.0.1
    IdentityFile ~/.ssh/id_rsa
    Port 22000
  1. Then use the -J parameter to identify a jumphost
ssh -J machineB -C2qTnN -D 8123 machineA
ptheofan
  • 411
  • 1
  • 4
  • 6