【问题标题】:Apache - Mercurial - Authentication - Active Directory groups / LDAP groupsApache - Mercurial - 身份验证 - Active Directory 组/LDAP 组
【发布时间】:2012-09-02 23:17:45
【问题描述】:

操作系统:Linux OpenSUSE 版本控制 - Mercurial 阿帕奇2

我运行 http://my.os.name/ 它给了我一个页面 - 因此 apache 正在运行。 我运行 http://my.os.name:/hg - 它显示了 Mercurial 页面,因此 mercurial 是 显示在 http Internet Explorer 页面上。

我能够在 Mercurial 中创建存储库/或进行正常工作。

我需要什么。 1.当我打开上面的汞链接 然后,它应该首先检查我是否属于我的公司,而不是向我显示 Mercurial(Hg) 存储库页面主页,即它应该使用 Windows Active Directory 或 LDAP 服务器进行身份验证。

  1. 如果我对文件进行任何更改或在 Hg 中创建目录/存储库,那么它应该确保 / 验证/验证我是否具有执行该操作的有效访问权限。

我该怎么做,我需要一步一步的帮助,因为我是 Apache/Mercurial 身份验证设置的新手。

我几乎已经阅读了所有有关设置此功能的在线帮助,到目前为止,我能够确定当我打开 Hg 链接时,是否会弹出用户名/密码提示,但它没有接受它/不工作。

我也不想创建 .htpasswd/ .htaccess 或摘要文件。我想知道的是,如果在 Windows Active Directory 中,如果我为 ex 创建了一个安全组:Company/Project1_readers、Company/Project1_Contributors、Company/Project1_Repository1_Readers、Company/Project1_Repository2_Contributors... 并且在那些 AD 安全组 ID 中,如果我添加了所有开发人员,然后在 AD 中使用这些组,我想授予开发人员访问权限,而不是在 .hg/hgrc 文件中添加这些用户。 (这通常是我们在 TFS(Team Foundation Server)中授予/撤销访问权限的方式),而不是在每个存储库中弄乱文件(添加/删除用户)等。

我该怎么做?

如果最好的方法是只创建 .htpasswd/.htaccess/.htdigest 等文件,请告知...如果我在实现上述场景时出错了。

我的 httpd.conf 文件包含另一个 .conf 文件(其中包含)

==========================================

<Directory /srv/www/hg>
   Order deny,allow
   Deny from All
   AuthType Basic
#   #AuthName "Apache Web Site: Login with your AD(Active Directory) credentials"
   AuthName "Mercurial Repositories"
#
#
#   AuthBasicProvider ldap
#   AuthzLDAPAuthoritative off
#   #AuthLDAPURL ldap://10.211.16.1:389/OU=TSH,DC=tsh,DC=Mason,DC=com?sAMAccountName
#   AuthLDAPURL "ldap://10.211.16.1:389/?samAccountName?sub?(objectClass=user)"
##               #ldap://ldap.your-domain.com:389/o=stooges?uid?sub
#   AuthLDAPBindDN "cn=xyzserver,OU=Services,OU=Users,OU=Infrastructure,OU=DEN,OU=KSH,DC=Psh,DC=Mason,DC=com"
#                  #"cn=StoogeAdmin,o=stooges"
#   AuthLDAPBindPassword secret1
   require valid-user
#   require ldap-user
   Satisfy any
</Directory>

当我在 Jenkins 中使用 abvoe LDAP URL 时,Jenkins 在登录时成功地对用户进行身份验证,那么为什么在此服务器的 .conf 文件中同样不起作用。注意,在 apache2 中,以上内容不必在 httpd.conf 文件中。包含概念是让我包含 file.conf 和 file.conf 包含上述代码。这是根据 httpd.conf 文件中提到的 Apache2 说明。

其余的 mercurial 文件 hgwebdir.cgi、hgweb.cgi、hgweb.config 都很好(根据我读过的在线博客)。

我已经加载了所有必需的模块(因为它们在 /etc/apache2/sysconfig.d/loadmodule.conf 文件中可见(LDAP auth 所需的模块,即 mod_ldap、mod_authz_ldap 等与 ldap 和 apache 相关的模块)。

【问题讨论】:

    标签: apache authentication mercurial apache2 ldap


    【解决方案1】:

    好的,没有使用我的 Windows Ldap 凭据的提示部分现在正在工作。

    我做错了什么。 - 见行:对于 AuthLDAPURL 和 AuthLDAPBindPassword,这些是我上面显示的帖子中的罪魁祸首。 - 原因是,我是 Windows AD/LDAP 概念的新手,所以无法从我公司的系统团队中找到任何人。所以尝试了我自己的双手。 AuthLDAPURL 的第一行,我从我们的一个 Jenkins 实例的 GLOBAL 配置文件 (config.xml) 中获得。

    用于显示配置的 Jenkins GUI 不显示密码(因为它们被屏蔽了),因此您会看到 Manager 的 DN 密码为“* * * * * *”。 所以,我想我应该打开 Jenkins 实例的 config.xml 文件并从那里得到密码“secret1”。实际上“secret1”只是一个例子,实际上它是一些疯狂的价值,比如“VVX12##!5GH”。

    所以基本上我之前使用的那个不能正常工作,因为 LDAP 身份验证无法正常工作,你必须与 SYSTEMS 团队中的某个人或 WHO 实际在 Jenkins 实例中为 LDAP 身份验证进行设置的人交谈。

    终于我得到了密码,而且成功了。

    解决方案:请参阅下面我所做的更改。

    • 需要注意的重要一点是,在 Jenkins 中,LDAP 的 AUTHURL 是:

      AuthLDAPURL ldap://10.211.16.1:389/OU=TSH,DC=tsh,DC=Mason,DC=com?sAMAccountName

    但是, 从 Unix/Linux/在我的情况下是 SUSE 机器,我们必须将这一行稍微更改为

    AuthLDAPURL ldap://10.211.16.1:389/OU=TSH,DC=tsh,DC=Mason,DC=com?sAMAccountName?sub
    

    有关此的更多信息(Apache2.2 关于连接到 Windows AD(Active Directory)身份验证): PS:http://www.yolinux.com/TUTORIALS/LinuxTutorialApacheAddingLoginSiteProtection.html

    然后 - 我在文件中输入了 cn=xyzserver(经理 DN 用户 id)的正确密码,然后一切都很好。

    apache 配置文件或您单独创建并包含在 httpd.file 或通过 /etc/sysconfig/apache2 文件管理器(变量 APACHE_INCLUDE...)的文件的快照现在如下所示:

    <Directory /srv/www/htdocs/hg>
       Order deny,allow
       Deny from All
       AuthType Basic
       AuthName "LDAP Access - Mercurial"
       AuthBasicProvider ldap
       AuthzLDAPAuthoritative off
       AuthLDAPURL ldap://10.211.16.1:389/OU=TSH,DC=tsh,DC=Mason,DC=com?sAMAccountName?sub
    
    #AuthLDAPURL "ldap://10.211.16.1:389/OU=TSH,DC=Mason,DC=com?sAMAccountName?sub?(objectClass=*)"
    
       AuthLDAPBindDN "cn=xyzserver,OU=Services,OU=Users,OU=Infrastructure,OU=DEN,OU=KSH,DC=Psh,DC=Mason,DC=com"
    
       AuthLDAPBindPassword CorrectPassword!
    
    #   require ldap-user c149807
    #   AuthUserFile "/dev/null"
    
       require valid-user
       Satisfy any
    </Directory>
    

    我现在将在实际存储库中获取用户访问部分,因为 Auth 部分是从 IE(Internet Explorer) 到 Hg(Mercurial) 从 Linux/Unix/OpenSUSE 机器完成的。

    【讨论】:

      【解决方案2】:

      如果在 mercurial 中多次提示用户凭据。设置 Mercurial_Keyring 然后

      这个问题来了,没有人能简单地解释一下。

      ???如果我使用 servername、servername 的 IP 或 servername 的 FQDN,如何使 [auth] xx.prefix = servername/hg_or_something 对 servername/hg 位置下的所有存储库有效?

      答案:Arun • 2 分钟前 -

      OK, I put this in ~/.hgrc (Linux/Unix -home directory's .hgrc hidden file) or Windows users %UserProfile%/mercurial.ini or %HOME%/mercurial.ini file.
      
      [auth]
      default1.schemes = http https
      default1.prefix = hg_merc_server/hg
      default1.username = c123456
      
      default2.schemes = http https
      default2.prefix = hg_merc_server.company.com/hg
      default2.username = c123456
      
      default3.schemes = http https
      default3.prefix = 10.211.222.321/hg
      default3.username = c123456
      
      Now, I can checkout using either Server/IP/Server's FQDN.
      

      【讨论】:

        猜你喜欢
        • 2011-08-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-04-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多