Tag Archives: Gentoo

Using subversion over ssh gate server

If you have the same problem like me, connecting to a svn server that is only reachable over a gate server, try this:

  • Add your root public ssh key to the ~/.ssh/authorized_keys on the gate server.
  • And your user public ssh key to the ~/.ssh/authorized_keys on the svn server.
  • Try this: ssh -L 24:<svn_server>:22 <gate_login>@<gate_server>
  • Now nmap should show something like this:
  • doep ~ # nmap localhost
    PORT      STATE SERVICE
    24/tcp    open  priv-mail
  • You can also create an init script. /etc/init.d/sshtun
  • #!/sbin/runscript
    SSHTUN_OPTIONS="-L 24:<svn_server>:22 <gate_login>@<gate_server> -N"
    
    depend() {
    need net
    }
    
    start() {
    ebegin "Starting sshtun"
    start-stop-daemon --start --quiet --exec /usr/bin/ssh --background \
    --pidfile /var/run/sshtun.pid --make-pidfile -- $SSHTUN_OPTIONS
    eend $?
    }
    
    stop() {
    ebegin "Stopping sshtun"
    start-stop-daemon --stop --quiet --pidfile /var/run/sshtun.pid
    eend $?
    }
  • Don’t forget to make it executable:
  • doep ~ # chmod +x /etc/init.d/sshtun
  • Then start the ssh tunnel:
  • doep ~ # /etc/init.d/sshtun start
  • To create the tunnel on startup, use rc-update:
  • doep ~ # rc-update add sshtun default
  • Now open your ssh config ~/.ssh/config and add a new server:
  • Host svn
    HostName localhost
    User <svn_user>
    Port 24
  • If you have already checked out a repository you can easily change the location:
  • doep@doep ~ $ svn switch --relocate http://<svn_server>/svn/repository svn+ssh://svn/var/svn/repos/repository
  • Otherwise check it out:
  • doep@doep ~ $ svn co svn+ssh://svn/var/svn/repos/repository
VN:F [1.9.22_1171]
Rating: 6.0/10 (3 votes cast)
Wir benutzen Cookies um die Nutzerfreundlichkeit der Webseite zu verbessen. Durch Deinen Besuch stimmst Du dem zu.