Add SSH tunnel service

Basically you use an executable provided by cygwin to install a Windows service on the tableauvm.

http://blog.yucas.mx/2012/11/22/creating-persistent-ssh-tunnels-in-windows-using-autossh/

Modified instructions:

  1. Add your public key to your list of authorized keys on the server. (use our vrAWS_key)
    1. Login to your SSH server.
    2. mkdir .ssh
    3. cat id_rsa.pub >> .ssh/authorized_keys
  2. Test your key.
    1. Logout of your SSH sever.
    2. Login to your SSH server again. This time, your key will be used for authentication and you won’t be challenged for your login credentials. If you are not logged in automatically, review the previous steps. Or contact your server administrator.
    3. Logout of your SSH server.
    4. Exit of the Cygwin shell.
  3. Install autossh as a Windows service.
    1. Now back in Windows, open a new command Window (Start -> Run -> cmd).
    2. cd C:\cygwin\bin
    3. cygrunsrv -I AutoSSH -p /usr/bin/autossh -a “-M 20000 -L localaddress:port:serveraddress:port user@ssh.host.name” -e AUTOSSH_NTSERVICE=yes
    4. Example used for SELV-UAT: cygrunsrv -I AutoSSH-SELV-UAT -p /usr/bin/autossh -a “-M 20004 -L 5434:localhost:5432 root@selv-uat.villagereach.org” -e AUTOSSH_NTSERVICE=yes
  4. Tweak Windows service settings.
    1. Open the Services management console (Administrative Tools -> Services).
    2. Edit the properties of the AutoSSH service.
    3. In the “Log On” tab, select the “This account” radio button and set the service to run as your current user.
    4. Start the service.
  5. Test your tunnels.