SVN SSH Multi-hop Tunnelling

grantm on 2006-05-25T10:09:39

I needed to access a Subversion repository on a server at work from home. All access to the repository is via SSH+svnserve - which is good because there are no Apache setup hassles and no extra authentication layer.

Unfortunately the SSH route from outside in involves landing on a bastion host in the DMZ and then logging on to a dual-homed proxy server and finally connecting to the server which hosts subversion. It's all passwordless since logins to the intermediate hosts are only possible if keys have been installed by the sysadmins. I have a shell alias that gets me onto the subversion server with agent forwarding as follows:

ssh -A bastion.example.com ssh -A proxy ssh svnserver

I thought it was going to be tricky to get subversion to work with a multihop SSH path and Google didn't seem to turn up anything particularly helpful. However, once I'd read the fine manual, it was not hard at all.

Step 1: Edit $HOME/.subversion/config, find the [tunnels] section and add a line like this:

workssh = /usr/bin/ssh -A bastion.example.com ssh -A proxy ssh svnserver

Step 2: Check out a working copy:

svn co svn+workssh:///path/to/svnrepos/proj/trunk proj

Done.