关闭ssh访问gitolite服务器时已认证用户可以列出所有仓库的方法

当客户A的公钥添加到gitolite服务器之后, 客户A用ssh去访问该服务器, 服务器会回应并列出所有的仓库。其中有些仓库是客户A不能访问的,比如客户B的仓库,但是他却能看到。这有可能会泄露商业机密。

如下:

$ ssh app@gitoliteserver

PTY allocation request failed on channel 0

hello customer_a, this is app@gitoliteserver running gitolite3 v3.6.6-9-gd6e8a0f on git 1.9.1

R W testing

R W customer_a/path/to/repo1

R W customer_a/path/to/repo2

R W customer_b/path/to/repo1

R W customer_b/path/to/repo2

Connection to gitoliteserver closed.

关闭的方法:

1. 安装之前在源码的位置修改:

diff --git a/src/commands/info b/src/commands/info
index 5079cfa..09d92f5 100755
--- a/src/commands/info
+++ b/src/commands/info
@@ -36,7 +36,7 @@ if ($json) {
 }

 print_patterns();     # repos he can create for himself
-print_phy_repos();    # repos already created
+#print_phy_repos();    # repos already created

 

2. 安装之后安装 目录修改

打开文件 ~bin/commands/info 注释以下这行

#print_phy_repos(); # repos already created

猜你喜欢

转载自blog.csdn.net/hidlong/article/details/88228901
今日推荐