我正在尝试使用 mod_auth_kerb 针对在 W2008 服务器上运行的 AD 服务器自动将用户登录到我的网站。用户已经登录了一个 windows 网络,并且可以访问该网站。
我的虚拟服务器配置是:
<Location />
Order allow,deny
Satisfy Any
AuthType Kerberos
AuthName "Kerberos Login ORN"
KrbMethodNegotiate On
KrbMethodK5Passwd Off
KrbServiceName Any
KrbAuthRealms EXAMPLE.ES
Krb5KeyTab /etc/krb5.keytab
require valid-user
</Location>
我通过 apache 的 kinit 成功登录:
kinit -t /etc/HTTP-hesl035.keytab
Password for HTTP-hesl035@EXAMPLE.ES:
klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: HTTP-hesl035@EXAMPLE.ES
Valid starting Expires Service principal
11/07/13 17:55:46 11/08/13 03:55:51 krbtgt/EXAMPLE.ES@EXAMPLE.ES
renew until 11/08/13 03:55:46
或者
kinit HTTP-hesl035
Password for HTTP-hesl035@EXAMPLE.ES:
klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: HTTP-hesl035@EXAMPLE.ES
Valid starting Expires Service principal
11/07/13 17:57:26 11/08/13 03:57:26 krbtgt/EXAMPLE.ES@EXAMPLE.ES
renew until 11/08/13 03:57:26
我使用以下设置配置 Firefox:
network.negotiate-auth.delegation.uris = testing.example.es
network.negotiate-auth.trusted.uris = testing.example.es
当我访问该站点时,我会获得需要授权。
浏览器发送的第一个标头是:
GET Host: testing.example.es
服务器的第一个标头响应是:
401 Authorization required
WWW-authenticate: Negotiate
浏览器发送的第二个标头是:
GET Host: testing.example.es
Authentication: Negotiate {TOKEN}
服务器发送的第二个标头是:
401 Athorization required
Apache日志说以下内容:
Thu Nov 07 18:06:09 2013] [debug] src/mod_auth_kerb.c(1939): [client 192.168.4.16] kerb_authenticate_user entered with user (NULL) and auth_type Kerberos
[Thu Nov 07 18:06:09 2013] [debug] src/mod_auth_kerb.c(1939): [client 192.168.4.16] kerb_authenticate_user entered with user (NULL) and auth_type Kerberos
[Thu Nov 07 18:06:09 2013] [debug] src/mod_auth_kerb.c(1691): [client 192.168.4.16] Verifying client data using KRB5 GSS-API
[Thu Nov 07 18:06:09 2013] [debug] src/mod_auth_kerb.c(1707): [client 192.168.4.16] Client didn't delegate us their credential
[Thu Nov 07 18:06:09 2013] [debug] src/mod_auth_kerb.c(1735): [client 192.168.4.16] Warning: received token seems to be NTLM, which isn't supported by the Kerberos module. Check your IE configuration.
[Thu Nov 07 18:06:09 2013] [debug] src/mod_auth_kerb.c(1138): [client 192.168.4.16] GSS-API major_status:00010000, minor_status:00000000
[Thu Nov 07 18:06:09 2013] [error] [client 192.168.4.16] gss_accept_sec_context() failed: An unsupported mechanism was requested (, Unknown error)
在用户 Windows 机器上使用 krbtray.exe 我看到以下票证:
EXAMPLE.ES
- host/minit-bn-example.es
- krbtgt/EXAMPLE.ES
当我访问 apache 应用程序时,我得到了 krbtgt/EXAMPLE.ES。
似乎客户端正在发送 kerberos 票证,但不确定。有谁知道这个问题??
编辑:
如果我在我的 apache conf 中将 KrbMethodK5Passwd 设置为 On,我会在访问 Web 应用程序时收到一个带有用户/密码表单的弹出窗口。但我无法使用用户凭据登录。
阿帕奇日志说:
[Thu Nov 07 17:41:34 2013] [debug] src/mod_auth_kerb.c(1939): [client 192.168.4.16] kerb_authenticate_user entered with user (NULL) and auth_type Kerberos
[Thu Nov 07 17:41:34 2013] [error] [client 192.168.4.16] Error parsing server name (Any): Hostname cannot be canonicalized
[Thu Nov 07 17:41:34 2013] [debug] src/mod_auth_kerb.c(1110): [client 192.168.4.16] kerb_authenticate_user_krb5pwd ret=401 user=(NULL) authtype=(NULL)
如果我在 Windows 客户端中使用 wireshark 来获取数据包,我会从 AD 到 Windows 客户端收到 2 个 kerberos 错误:
KRB Error: KRB5KRB_ERR_RESPONSE_TOO_BIG
KRB Error: KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN