VPN via reverse port forwarding ssh tunnel


Goal: set up a reverse ssh tunnel to work from the home linux box.

uses tricks about halfway through this very good tutorial: http://www.suso.org/docs/shell/ssh.sdf

  1)  log into work.box, and:

    ssh -R 22222:i`uname -n`:22 me@home.box

    where 22222 is the port on home.box to forward, 22 is the port
    receive the connection, `uname -n` is the hostname to receive the
    connection.  Note that localhost won't work as it resolves to
    127.0.0.1 which is not useful.

  2)  log into root on home.box, add the following line to /etc/hosts:

    127.0.0.1    work.box

  3)  now, from home.box, any user can:

    ssh -p 22222 me@work.box

  4)  create an appropriate user with ssh keys.
      wrap it in a 'while' loop and put it in the system startup:

    while true ; do
        ssh -R 2222:work.box:22 myvpn@home.box
        sleep 60
    done


date: 03/14/2007