通过LDAP访问http的gitolite不会传递用户名

时间:2014-01-22 17:21:19

标签: apache gitolite

我正在尝试使用以下命令设置git服务器:

  • http-access能够克隆这样的存储库:

    git clone http://mygitserver/repository

  • 有一个网络界面(gitweb),如果可能,每个用户有限制

  • 基于LDAP帐户控制访问

到目前为止,我已经启动并运行了gitweb;当我访问

http://gitserver/

它询问ldap登录以及何时提供此信息;它显示了所有存储库(甚至是gitolite-admin存储库......不太好)

当我尝试克隆时,我收到错误:

fatal: http://gitserver/<reponame>.git/info/refs not valid: is this a git repository?

我挖了它,我发现gitolite-suexec-wrapper.sh没有收到LDAP用户名;所以gitolite无法授予访问权限,因为用户名是空的......任何想法?

这是我的配置:

我的apache配置文件如下所示: http://gitolite.com/gitolite/g2/ggshb.html。最有趣的部分是:

ScriptAliasMatch \
        "(?x)^/(.*/(HEAD | \
                        info/refs | \
                        objects/(info/[^/]+ | \
                                 [0-9a-f]{2}/[0-9a-f]{38} | \
                                 pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
                        git-(upload|receive)-pack))$" \
        /srv/www/bin/gitolite-suexec-wrapper.sh/$1

由于一个或另一个原因,参数$ 1未被传递或为空....在apache日志中我得到以下这些行:

10.1.86.100 - - [22/Jan/2014:18:09:52 +0100] "GET /git/<reponame>.git/info/refs?service=git-upload-pack HTTP/1.1" 401 - "-" "git/1.8.4"
601 10.1.86.100 - - [22/Jan/2014:18:09:57 +0100] "GET /git/<reponame>.git/info/refs?service=git-upload-pack HTTP/1.1" 401 - "-" "git/1.8.4"
602 10.1.86.100 - chris.maes [22/Jan/2014:18:09:57 +0100] "GET /git/<reponame>.git/info/refs?service=git-upload-pack HTTP/1.1" 200 120 "-" "git/1.8.4"
是的,是的我的环境: 打开13.1 gitolite 2.3.1 git 1.8.4

1 个答案:

答案 0 :(得分:1)

这两个解决方案是:

1 / Apache + ldap,呼叫gitolite-shell(gitolie V3)

 ScriptAlias /hgit/ @H@/sbin/gitolite-shell/
    SetEnv GIT_HTTP_BACKEND "@H@/usr/local/apps/git/libexec/git-core/git-http-backend"
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
      SSLOptions +StdEnvVars
    </FilesMatch>
    <Location /hgit>
        SSLOptions +StdEnvVars
        Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
        #AllowOverride All
        order allow,deny
        Allow from all
        AuthName "LDAP authentication for ITSVC Smart HTTP Git repositories"
        AuthType Basic
        AuthBasicProvider myldap companyldap

2 /或GitLab,它具有LDAP身份验证:“setting up gitlab LDAP-authentication without special gitlab user
请参阅config gitlab.yml ldap section