我需要为 Subgit 添加什么防火墙规则?

What firewall rules do I need to add for Subgit?

我已经安装了 Stash,SVN mirror plugin - 它安装了 subgit。

我的 iptables 设置如下:

Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:7990
ACCEPT     tcp  --  yyy.yyy.yyy.yyy      anywhere             tcp spt:mysql
ACCEPT     udp  --  anywhere             anywhere             udp spt:domain
ACCEPT     all  --  xxx.xxx.xxx.xxx      anywhere
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:7999
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:http state ESTABLISHED


Chain FORWARD (policy DROP)
target     prot opt source               destination

Chain OUTPUT (policy DROP)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             yyy.yyy.yyy.yyy         tcp dpt:mysql
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:ssh state ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:7990
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:38724
ACCEPT     all  --  anywhere             xxx.xxx.xxx.xxx
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:7999
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http state NEW,ESTABLISHED

其中xxx.xxx.xxx.xxx是SVN服务器的IP。初始同步适用于这些设置。但是当我提交给 SVN 时,更改不会通过。如果我将 INPUT 和 OUTPUT 的策略更改为 ACCEPT,更改会立即同步。那么我还需要允许什么?

我无法提供确切的 iptables 配置帮助,但对于 SVN Mirror Add-On(和 SubGit),以下是正确的:

1) SubGit 需要完全访问它镜像的 Subversion 项目。

从协议的角度来看,它需要能够通过 http(s)(端口 80 或 443)或 svn 协议(端口 3690)访问目标 Subversion 存储库。这里的访问是指在端口与Subversion版本库主机建立连接,然后通过已建立的连接发送和接收数据。这是 iptables 规则应该允许的。

有关 Subversion 用于不同协议的端口的详细信息,请参阅此 post:what ports need to be open for svn tortoise to authenticate (clear text) and commit

2) SubGit 启动后台进程并通过tcp 协议与其通信。

该通信仅涉及本地主机,端口是从特定用户当前可用的端口中随机选择的。因此,您的 iptables 规则应该允许从本地主机在本地主机上打开和访问任何端口。

希望对您有所帮助!

iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

做到了。