【问题标题】:Apache Kerberos Authentication - Client didn't delegate us their credentialApache Kerberos 身份验证 - 客户端没有将他们的凭证委托给我们
【发布时间】:2013-11-07 17:14:31
【问题描述】:

我正在尝试使用 mod_auth_kerb 针对在 W2008 Server 上运行的 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>

我通过 kinit 从 apache 成功登录:

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 应用程序时收到一个带有用户/密码表单的弹出窗口。但我无法使用用户凭据登录。

Apache 日志说:

[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

【问题讨论】:

    标签: apache active-directory kerberos


    【解决方案1】:

    KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN 错误是由于 AD 服务器中的 ktpass.exe 生成的地图文件错误造成的。

    使用 ktpass.exe 生成正确的地图文件,如下所示:

    ktpass -princ HTTP/example.es@EXAMPLE.ES -mapuser username\HTTP-hesl035 -crypto ALL -ptype KRB5_NT_PRINCIPAL -mapop set -pass password -out c:\tem
    p\krb5.keytab
    

    并在 AD 服务器中使用 setspn.exe 为用户分配 SPN:

    setspn -s HTTP/example.es HTTP-hesl035
    
    • HTTP-hesl035 是在 AD 中创建的 apache 服务器用户名。

    【讨论】:

      猜你喜欢
      • 2013-10-02
      • 2011-02-27
      • 2015-12-23
      • 2022-06-23
      • 2021-09-05
      • 2022-01-20
      • 2017-06-28
      • 2010-10-16
      • 1970-01-01
      相关资源
      最近更新 更多