【问题标题】:gitolite with http acces via LDAP does not pass the username通过 LDAP 进行 http 访问的 gitolite 不传递用户名
【发布时间】:2014-01-22 17:21:19
【问题描述】:

我正在尝试设置一个 git 服务器:

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

    git 克隆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 混帐 1.8.4

【问题讨论】:

  • 有什么理由使用旧的 gitolite 2.x?至于 Apache 我不使用gitolite-suexec-wrapper.sh:见github.com/VonC/compileEverything/blob/…
  • 我刚刚添加了我找到的存储库;这是我发现的最后一个可用的......这会有很大的不同吗?
  • 最新的是github.com/sitaramc/gitolite: 3.5.1,它更容易安装/支持/更新。它不需要gitolite-suexec-wrapper.sh:您可以直接调用gitolite-shell 脚本,如我的Apache 配置所示。
  • 我刚和一位同事讨论过:GitLab 或 Gitorious 是否是拥有我想要的所有功能的更简单的替代方案?
  • 不,这是一个完全不同的设置,带有一个额外的数据库来管理用户。但 GitLab 肯定有一套非常完整的功能。但是,它有 not 自定义钩子。 (github.com/gitlabhq/gitlab-shell/issues/14,即gitolite的VREFS)

标签: apache gitolite


【解决方案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

【讨论】:

  • 哇,GitLab + bitnabi 是启示录!!!我使用 bitnabi 安装程序安装了它:GitLab 通过 LDAP 访问立即启动并运行;我仍然需要为用户访问和 repos 做一些配置,但到目前为止我是虚张声势!!!
猜你喜欢
  • 2015-09-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多