使用 svn+ssh 协议以 2 跳访问 Subversion 存储库 [英] Accessing Subversion repository with 2 hops using svn+ssh protocol

查看:29
本文介绍了使用 svn+ssh 协议以 2 跳访问 Subversion 存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Ubuntu Subversion 服务器无法直接访问 Internet,192.168.1.2

My Ubuntu Subversion server is not directly accessible to the Internet, 192.168.1.2

我的公共 Ubuntu 机器通过 DMZ 暴露在 192.168.1.1

My public Ubuntu machine is exposed through the DMZ at 192.168.1.1

我已经设置了从 192.168.1.1:3906 到 192.168.1.2:3906 的端口转发,但我不知道这将如何与 svn+ssh 一起使用,因为需要额外的一跳才能到达我的 Subversion 服务器

I've setup port forwarding from 192.168.1.1:3906 to 192.168.1.2:3906, but I have no idea how this would work with svn+ssh since one extra hop is required to reach my Subversion server

对于任何遇到同样问题的人,我的困惑是因为我试图将端口转发到我的 SVN 服务器(在端口3906"上运行一个守护进程)但是访问你的通过 SSH 访问 SVN 服务器与访问运行守护程序(在 3906)的 SVN 服务器完全不同.您需要将此视为典型的 ssh 连接.一旦我编辑了我的设置,以下两种方法都有效

edit: For anybody going through the same problem, my confusion came because I was trying to port forward to my SVN server (running a daemon at port '3906') but accessing your SVN server through SSH is totally different from accessing your SVN server running a daemon (at 3906). You need to treat this as a typical ssh connection. Both of the methods below worked once I edited my settings

推荐答案

在你的 .ssh/config 文件中加入类似的内容:

Put something like this in your .ssh/config file:

Host subversionserver
        Host=192.168.1.1
        ProxyCommand = ssh 192.168.1.1 /usr/local/bin/nc -w 60 192.168.1.2 %p
        ForwardX11 = no
        User = myusername
        ForwardAgent = yes

然后你就可以连接到你的 ssh 服务器了:

Then you'll be able to connect to your ssh server with just:

ssh subversionserver

基本上,您将登录到您的公共邮箱并在您进入后运行 netcat 命令.您想要的 subversion 服务器 SSH 连接将通过 netcat 连接.

Basically you'll log in to your public box and run the netcat command once you get in. Your desired to the subversion server SSH connection will be going over the netcat connection.

显然你需要在你的盒子上安装 netcat.

Obviously you'll need to have netcat somewhere on your box.

我的 .ssh/config 文件中的版本有一个通配符 Host 并在 netcat 命令中使用 %h.当您想要代理通过 DMZ 才能访问的生产环境中的所有设备时,这非常有用.

The version in my .ssh/config file has a wildcard Host and uses %h in the netcat command. Very useful when you want to proxy through for all the boxes in a production environment that you have to go through a DMZ to get to.

这篇关于使用 svn+ssh 协议以 2 跳访问 Subversion 存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆