针对 ldap 的 Apache2 身份验证失败 "user not found"
Apache2 authentication against ldap fails with "user not found"
我最近安装了 slapd (2.4.40+dfsg-1+deb8u2),我正在尝试通过 ldap 验证 apache2 (2.4.10-10+deb8u7)。系统本身是 debian (8.6)。
Ldap 应该 运行 在本地主机上的默认端口上,并且使用 phpldapadmin DN ( cn=admin,dc=1000,dc=hu ) 似乎是行。对于 apache2 身份验证,我使用 .htaccess 文件,基本身份验证(htpasswd 文件)也可以正常工作。
我的配置是:
AuthName "Add your login message here."
AuthType Basic
AuthBasicProvider ldap
AuthLDAPURL "ldap://localhost:389/dc=1000,dc=hu?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN "cn=admin,dc=1000,dc=hu"
AuthLDAPBindPassword ******
require ldap-user testtest test ttest
.
无论我做什么,我都在 apache2 日志中收到 "user not found" 错误:
==> /var/log/apache2/error.log <==
[Sat Jan 21 12:54:29.272676 2017] [auth_basic:error] [pid 27767] [client 127.0.0.1:52852] AH01618: user ttest not found: /t1/
==> /var/log/apache2/access.log <==
127.0.0.1 - ttest [21/Jan/2017:12:54:29 +0100] "GET /t1/ HTTP/1.1" 401 738 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
==> /var/log/apache2/error.log <==
[Sat Jan 21 12:54:44.388323 2017] [auth_basic:error] [pid 27766] [client 127.0.0.1:52854] AH01618: user test not found: /t1/
==> /var/log/apache2/access.log <==
127.0.0.1 - test [21/Jan/2017:12:54:44 +0100] "GET /t1/ HTTP/1.1" 401 738 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
==> /var/log/apache2/error.log <==
[Sat Jan 21 12:54:49.460321 2017] [auth_basic:error] [pid 27770] [client 127.0.0.1:52856] AH01618: user testtest not found: /t1/
==> /var/log/apache2/access.log <==
127.0.0.1 - testtest [21/Jan/2017:12:54:49 +0100] "GET /t1/ HTTP/1.1" 401 738 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
ttest,test,testtest是我系统中的username,sn,cn。
AuthLDAPBindPassword 的密码经过三重检查,同样针对用户。
我哪里出错了? AuthLDAPURL 在这种情况下是否具有正确的值?
好吧,在上面的示例中,AuthLDAPURL 对于所描述的设置是错误的。应该只有:
AuthLDAPURL ldap://localhost/dc=256,dc=hu?cn?sub
.
我遇到了同样的错误,这与在 Active Directory 中使用默认属性 'uid' 有关,而不是指定 sAMAccountName。
AuthLDAPURL ldap://192.168.1.1:389/dc=domain,dc=local?sAMAccountName
似乎 AuthLDAPURL 问题
我改:
- ldap://localhost:389/dc=1000,dc=hu?sAMAccountName?sub?(objectClass=*)
- ldap://localhost:389/dc=1000,dc=hu?name
我最近安装了 slapd (2.4.40+dfsg-1+deb8u2),我正在尝试通过 ldap 验证 apache2 (2.4.10-10+deb8u7)。系统本身是 debian (8.6)。
Ldap 应该 运行 在本地主机上的默认端口上,并且使用 phpldapadmin DN ( cn=admin,dc=1000,dc=hu ) 似乎是行。对于 apache2 身份验证,我使用 .htaccess 文件,基本身份验证(htpasswd 文件)也可以正常工作。
我的配置是:
AuthName "Add your login message here."
AuthType Basic
AuthBasicProvider ldap
AuthLDAPURL "ldap://localhost:389/dc=1000,dc=hu?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN "cn=admin,dc=1000,dc=hu"
AuthLDAPBindPassword ******
require ldap-user testtest test ttest
.
无论我做什么,我都在 apache2 日志中收到 "user not found" 错误:
==> /var/log/apache2/error.log <==
[Sat Jan 21 12:54:29.272676 2017] [auth_basic:error] [pid 27767] [client 127.0.0.1:52852] AH01618: user ttest not found: /t1/
==> /var/log/apache2/access.log <==
127.0.0.1 - ttest [21/Jan/2017:12:54:29 +0100] "GET /t1/ HTTP/1.1" 401 738 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
==> /var/log/apache2/error.log <==
[Sat Jan 21 12:54:44.388323 2017] [auth_basic:error] [pid 27766] [client 127.0.0.1:52854] AH01618: user test not found: /t1/
==> /var/log/apache2/access.log <==
127.0.0.1 - test [21/Jan/2017:12:54:44 +0100] "GET /t1/ HTTP/1.1" 401 738 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
==> /var/log/apache2/error.log <==
[Sat Jan 21 12:54:49.460321 2017] [auth_basic:error] [pid 27770] [client 127.0.0.1:52856] AH01618: user testtest not found: /t1/
==> /var/log/apache2/access.log <==
127.0.0.1 - testtest [21/Jan/2017:12:54:49 +0100] "GET /t1/ HTTP/1.1" 401 738 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
ttest,test,testtest是我系统中的username,sn,cn。
AuthLDAPBindPassword 的密码经过三重检查,同样针对用户。
我哪里出错了? AuthLDAPURL 在这种情况下是否具有正确的值?
好吧,在上面的示例中,AuthLDAPURL 对于所描述的设置是错误的。应该只有:
AuthLDAPURL ldap://localhost/dc=256,dc=hu?cn?sub
.
我遇到了同样的错误,这与在 Active Directory 中使用默认属性 'uid' 有关,而不是指定 sAMAccountName。
AuthLDAPURL ldap://192.168.1.1:389/dc=domain,dc=local?sAMAccountName
似乎 AuthLDAPURL 问题
我改:
- ldap://localhost:389/dc=1000,dc=hu?sAMAccountName?sub?(objectClass=*)
- ldap://localhost:389/dc=1000,dc=hu?name