mod_authnz_ldap: AuthzSVNAccessFile과 함께 userPrincipalName 및 sAMAccountName 사용

mod_authnz_ldap: AuthzSVNAccessFile과 함께 userPrincipalName 및 sAMAccountName 사용

여기 첫 글이니까 잘 부탁드려요...

우리는 Subversion 서버에 대한 액세스를 관리하는 아파치를 가지고 있습니다. 현재 사용자는 자신의 sAMAccountName으로만 로그인할 수 있지만 userPrincipalName(이메일 주소)이 점차 대부분의 로그인에 대한 기본 ID가 되고 있으므로 이를 지원하고 sAMAccountName에 대한 지원도 계속 유지하고자 합니다.

다음과 같은 현재 접근 방식에는 사용자 이름(sAMAccountName 및 userPrincipalName)이 모두 svnaccessfile에 지정되어야 한다는 단점이 있습니다.

<AuthnProviderAlias ldap ldap-sAMAccountName>
    AuthLDAPBindDN "CN=d-svn-ldap,OU=IT-050,OU=Service Accounts,OU=Accounts,OU=Domain Administration,DC=cds,DC=company"
    AuthLDAPBindPassword ***
    AuthLDAPUrl "ldap://server.company:3268/DC=cds,DC=company?sAMAccountName?sub?(objectclass=user)"
</AuthnProviderAlias>
<AuthnProviderAlias ldap ldap-userprincipalname>
    AuthLDAPBindDN "CN=d-svn-ldap,OU=IT-050,OU=Service Accounts,OU=Accounts,OU=Domain Administration,DC=cds,DC=company"
    AuthLDAPBindPassword ***
    AuthLDAPUrl "ldap://server.company:3268/DC=cds,DC=company?userPrincipalName?sub?(objectclass=user)"
</AuthnProviderAlias>

<Location "/our_repo">
DAV svn
SVNPath /svn/repos/our_repo
SVNListParentPath on

AuthzSVNAccessFile /etc/apache2/conf-available/authz_repository_our_repo
Options Indexes Followsymlinks

AuthBasicProvider ldap-sAMAccountName  ldap-userprincipalname

AuthType Basic
AuthName "LDAP authentication"
Require valid-user
# Note that Require ldap-* would not work here, since the
# AuthnProviderAlias does not provide the config to authorization providers
# that are implemented in the same module as the authentication provider.
</Location>

그래서 svnaccessfile에서 userPrincipalNames만 지정할 수 있는 방법을 찾고 있습니다. AuthLDAPRemoteUserAttribute가 여기서 도움이 되기를 바랐기 때문에 AuthLDAPRemoteUserAttribute userPrincipalNameldap-sAMAccountName에 추가하여 error.log에 다음 메시지가 표시되도록 했습니다.

auth_ldap authenticate: REMOTE_USER가 'userPrincipalName' 속성으로 설정되었지만 사용자에 대한 LDAP 쿼리에서 이 속성이 요청되지 않았습니다. REMOTE_USER는 적절하게 사용자 이름 또는 DN으로 대체됩니다.

이것이 올바른 접근 방식입니까? 이것이 가능합니까?

감사해요

플로

답변1

에서 영감을 받다https://svn.haxx.se/users/archive-2010-04/0011.shtml우리는 다시 시도해 보고 두 필드에 대해 LDAP를 쿼리하는 방법에 대한 해결책을 찾았습니다.

<AuthnProviderAlias ldap ldap-sAMAccountName>
    AuthLDAPBindDN "CN=d-svn-ldap,OU=IT-050,OU=Service Accounts,OU=Accounts,OU=Domain Administration,DC=cds,DC=company"
    AuthLDAPBindPassword ***
    AuthLDAPRemoteUserIsDN on
    AuthLDAPUrl "ldap://server.company:3268/DC=cds,DC=company?sAMAccountName,userPrincipalName?sub?(objectclass=*)"
    AuthLDAPRemoteUserAttribute userPrincipalName
</AuthnProviderAlias>

마지막 줄은 REMOTE_USER를 userPrincipalName의 콘텐츠로 바꿉니다.

우리 회사의 userPrincipalName에는 일부 대문자가 포함된 이메일 주소가 포함되어 있으므로 svnaccessfile에서 이메일 주소와 정확히 동일한 대소문자를 사용해야 합니다.

사용자가 입력한 것(REMOTE_USER)이 아닌 userPrincipalName만 사용하려면 다른 AutnProviderAlias에 대해 AuthLDAPRemoteUserAttribute도 지정해야 했습니다.

<AuthnProviderAlias ldap ldap-userprincipalname>
    AuthLDAPBindDN "CN=d-svn-ldap,OU=IT-050,OU=Service Accounts,OU=Accounts,OU=Domain Administration,DC=cds,DC=company"
    AuthLDAPBindPassword ***
    AuthLDAPUrl "ldap://server.company:3268/DC=cds,DC=company?userPrincipalName?sub?(objectclass=user)"
    AuthLDAPRemoteUserAttribute userPrincipalName
</AuthnProviderAlias>

또한 공급자의 순서를 변경해야 했습니다.

AuthBasicProvider ldap-userprincipalname ldap-sAMAccountName  

참고 사항: error.log에는 LDAP 결과로 인한 거부만 표시되며 svnaccessfile에 누락된 권한은 표시되지 않습니다. 따라서 Apache를 다시 시작하거나 브라우저 로그인을 삭제하지 않고도 svn accessfile의 변경 사항을 볼 수 있습니다.

관련 정보