macossshtunnelingssh-tunnelsvn-ssh

SVN-SSH Tunnel via 3rd machine?


I have a client that has SVN+SSH set up that I need to access. Unfortunately I can't get my IP white-listed because I'm on Comcast and they have some security policy against that. I do, however, have SSH access to another machine that I can SSH into that can also SSH into the SVN server (via a non-standard port)... So the total loop needs to look like:

Local Computer (OSX)  --SSH-->  Server1  --SVN+SSH_4567-->  SVN Server

I know how to set up basic SSH tunnels, but I'm not sure how to set this up, or if it's even possible. Help? :)

Note that ideally, I can set this up somehow in ~/.ssh/config and ~/.subversion/config and not have to manually tunnel from A->B->C each time I want to make a commit/update


Solution

  • ssh -L 1234:svnserver:4567 server1
    

    The tunneled connection will be

    ssh -p 1234 localhost
    

    To automate this somewhat you can add the tunnel connection to ~/.subversion/config:

    [tunnels]
    tssh = ssh -p 1234
    

    and then use svn+tssh://localhost/path/to/repo but I don't know of a way to automate creating the tunnel.