【问题标题】:How do I restrict Apache/SVN access to specific users (LDAP/file-based authentication)?如何限制 Apache/SVN 对特定用户的访问(基于 LDAP/文件的身份验证)?
【发布时间】:2009-01-27 18:01:22
【问题描述】:

我在 Windows Server 2003 上运行 Apache/SVN,通过 LDAP/Active Directory 和平面文件进行身份验证。

除了 任何 LDAP 用户可以访问所有内容之外,它工作得很好。我希望能够按用户或组限制 SVN 存储库。

理想情况下,我会得到这样的结果:

<Location /svn/repo1>
  # Restricted to ldap-user1, file-user1, or members of ldap-group1,
  # all others denied
</Location>

<Location /svn/repo2>
  # Restricted to ldap-user2, file-user2, or members of ldap-group2,
  # all others denied
</Location>

真正的窍门可能是我混合了身份验证:LDAP 和文件:

<Location /svn>
  DAV svn
  SVNParentPath C:/svn_repository
  AuthName "Subversion Repository"
  AuthType Basic
  AuthBasicProvider ldap file
  AuthUserFile "svn-users.txt" #file-based, custom users
  AuthzLDAPAuthoritative On
  AuthLDAPBindDN ldapuseraccount@directory.com
  AuthLDAPBindPassword ldappassword
  AuthLDAPURL ldap://directory.com:389/cn=Users,dc=directory,dc=com?sAMAccountName?sub?(objectCategory=person)
  Require valid-user
</Location>

在我的谷歌搜索中,我看到有些人通过像这样拉入authz 文件来完成此操作:

<Location /svn>
  ...
  AuthzSVNAccessFile "conf/svn-authz.txt"
</Location

然后,我需要映射 AD 用户。有这种方法的例子吗?

【问题讨论】:

  • 非常感谢您的配置
  • 你能允许除一个以外的所有读/写访问吗?

标签: svn authentication active-directory ldap apache2


【解决方案1】:

这实际上比我想象的要容易得多。我将此添加到我的位置:

<Location /svn>
  ...
  AuthzSVNAccessFile "conf/svn-authz.txt"
</Location

在那个文件中,我只是指定了普通的SVN权限(此时系统似乎没有区分文件用户和LDAP用户):

[groups]
@admin = haren

###
### Deny all but administrators to the tree
###

[/]
* =
@admin = rw


###
### Allow more specific people on a per-repository basis below
###

[repo1:/]
ldap-user1 = rw
file-user1 = rw

[repo2:/]
ldap-user2 = rw
file-user2 = rw

我仍在使用 LDAP 组语法来使该部分正常工作。有任何建议表示赞赏。

【讨论】:

    【解决方案2】:

    其他有兴趣的人的另一种替代方法:

    Require ldap-group cn=SVN Users,cn=Users,dc=company,dc=com
    

    这是假设您在 Active Directory 中创建了一个名为 SVN 用户的组。请注意,该组周围没有双引号。

    使用它而不是 Require valid-user

    那么你可能不需要在任何时候重新启动 apache,只要将用户添加到 AD 中的组中

    【讨论】:

    • 嗨,如果这是针对特定的 repo,例如 test-repo,那么 test-repo 的 svn.acl 文件中的权限是什么?应该是 *= rw 还是其他?我尝试将您提到的内容添加到位置 /repos/test-repo 的 httpd.conf 文件中,但包括 SVN 用户组在内的任何人都看不到 test-repo
    【解决方案3】:

    你应该使用

    Require valid-user
    

    但使用

    Require group
    

    【讨论】:

    • 组的语法是什么?是否可以将他的信息放在 authz 文件中,这样我每次更改后都不必重新启动 apache?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-18
    • 1970-01-01
    相关资源
    最近更新 更多