MIT Kerberos的失败找到TGT在MSLSA缓存 [英] MIT Kerberos fails to locate TGT in MSLSA cache

查看:798
本文介绍了MIT Kerberos的失败找到TGT在MSLSA缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我挣扎与一个Windows应用程序使用MIT Kerberos进行身份验证。

如果一个用户登录到Windows域用户帐户, klist输出显示,他从公元预期的门票,包括这一个:

  1>客户:jalf @ TESTREALM.COM
        服务器:KRBTGT / TESTREALM.COM @ TESTREALM.COM
        KerbTicket加密类型:RSADSI RC4-HMAC(NT)
        票务标志0x40e00000  - >转发可再生最初的pre_authent
        开始时间:2012/1/12 9时46分27秒(本地)
        结束时间:2012/1/12十九时46分27秒(本地)
        更新时间:2012年1月19日九时46分27秒(本地)
        会话密钥类型:RSADSI RC4-HMAC(NT)
 

然而,当我们试图用这张票在我们的应用程序,Kerberos库似乎并没有找到那一个。

下面是有关code的简化版本:

  //打开MSLSA缓存
krb5_cc_resolve(kcontextMSLSA:,&安培; mslsa_ccache);
//创建一个游标遍历缓存
krb5_cc_start_seq_get(kcontext,mslsa_ccache,和放大器;光标);
//检查缓存中的所有凭证
而((code = krb5_cc_next_cred(kcontext,mslsa_ccache,和放大器;!光标,和放大器; creds))){
    //找到一个与最初的标志设置
    如果(creds.ticket_flags&安培; TKT_FLG_INITIAL){
        //票发现
        krb5_free_cred_contents(kcontext,和放大器; creds);
        打破;
    }
    krb5_free_cred_contents(kcontext,和放大器; creds);
}

krb5_cc_end_seq_get(kcontext,mslsa_ccache,和放大器;光标);
 

不过,无论出于何种原因,我们从来没有进入 //票结果部分。 在调试器中运行code,我可以看到它找到几张由 klist输出显示其他门票,但由于某种原因,它永远不会找到一个我们是感兴趣的

任何人都可以解释这种现象,或者怎么去解决呢?天真,我会期望从 klist输出输出匹配遍历缓存与 krb5_cc_next_cred 的结果。

我是比较新的Kerberos和继承同事谁离开了这个code,所以它可能是我失去了一些重要的基础资料片。

解决方案

您可能没有获得在LSA会话密钥。只有SSPI可以访问。你可以试试这个

  

原因2:此异常使用某些Windows平台上本地票证缓存时抛出。微软增加了一个新功能中,他们不再出口会话密钥的票证授予票证(的TGT)。其结果是,获得在Windows本地TGT有一个空会话密钥和空ETYPE。受影响的平台包括:Windows Server 2003和Windows 2000 Server服务包4(SP4)和Windows XP SP2。

     

解决方案2:你需要更新Windows注册表来禁用此新功能。该注册表项allowtgtsessionkey应加 - 并正确设置 - 允许会话密钥在Kerberos票据授予票据发送

     

在Windows Server 2003和Windows 2000 SP4,这里是所需的注册表设置:

  HKEY_LOCAL_MACHINE \系统\ CurrentControlSet \控制\ LSA \ Kerberos的\参数
值名称:allowtgtsessionkey
值类型:REG_DWORD
值:0x01(默认为0)
 

  

在默认情况下,该值为0;其设置为0×01,允许一个会话密钥包括在TGT。   下面是注册表设置在Windows XP SP2中的位置:

  HKEY_LOCAL_MACHINE \系统\ CurrentControlSet \控制\ LSA \ Kerberos的\
值名称:allowtgtsessionkey
值类型:REG_DWORD
值:0x01
 

Java的GSS实现了一套失败也在这里。这是Oracle推荐。你可能患上了同样的问题与MIT Kerberos的。

这变化只在重新启动后变为有效。

I'm struggling with a Windows application which uses MIT Kerberos for authentication.

If a user logs on to Windows with a domain user account, klist shows that he gets the expected tickets from the AD, including this one:

#1>     Client: jalf @ TESTREALM.COM
        Server: krbtgt/TESTREALM.COM @ TESTREALM.COM
        KerbTicket Encryption Type: RSADSI RC4-HMAC(NT)
        Ticket Flags 0x40e00000 -> forwardable renewable initial pre_authent
        Start Time: 1/12/2012 9:46:27 (local)
        End Time:   1/12/2012 19:46:27 (local)
        Renew Time: 1/19/2012 9:46:27 (local)
        Session Key Type: RSADSI RC4-HMAC(NT)

However, when we try to use this ticket in our application, the Kerberos library does not seem to find that one.

Here's a simplified version of the relevant code:

// Open the MSLSA cache
krb5_cc_resolve(kcontext, "MSLSA:", &mslsa_ccache);
// Create a cursor for traversing the cache
krb5_cc_start_seq_get(kcontext, mslsa_ccache, &cursor);
// Check all the credentials in the cache
while (!(code = krb5_cc_next_cred(kcontext, mslsa_ccache, &cursor, &creds)))  {
    // Find the one with the INITIAL flag set
    if ( creds.ticket_flags & TKT_FLG_INITIAL ) {
        // ticket found
        krb5_free_cred_contents(kcontext, &creds);
        break;
    }
    krb5_free_cred_contents(kcontext, &creds);
}

krb5_cc_end_seq_get(kcontext, mslsa_ccache, &cursor);

But for whatever reason, we never enter the // ticket found part. Running the code in the debugger, I can see that it finds several of the other tickets shown by klist, but for some reason it never finds the one we're interested in.

Can anyone explain this behavior, or how to get around it? Naively, I'd expect the output from klist to match the results of iterating over the cache with krb5_cc_next_cred.

I'm relatively new to Kerberos, and inherited this code from a coworker who left, so it's possible that I'm missing some vital fundamental piece of information.

解决方案

You probably do not have access to the session key in the LSA. Only SSPI can access. You can try this

Cause 2: This exception is thrown when using native ticket cache on some Windows platforms. Microsoft has added a new feature in which they no longer export the session keys for Ticket-Granting Tickets (TGTs). As a result, the native TGT obtained on Windows has an "empty" session key and null EType. The effected platforms include: Windows Server 2003, Windows 2000 Server Service Pack 4 (SP4) and Windows XP SP2.

Solution 2: You need to update the Windows registry to disable this new feature. The registry key allowtgtsessionkey should be added--and set correctly--to allow session keys to be sent in the Kerberos Ticket-Granting Ticket.

On the Windows Server 2003 and Windows 2000 SP4, here is the required registry setting:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\Kerberos\Parameters
Value Name: allowtgtsessionkey
Value Type: REG_DWORD
Value: 0x01  ( default is 0 )

By default, the value is 0; setting it to "0x01" allows a session key to be included in the TGT. Here is the location of the registry setting on Windows XP SP2:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\Kerberos\
Value Name: allowtgtsessionkey
Value Type: REG_DWORD
Value: 0x01

Java's GSS impl fails here too. This is recommended by Oracle. You may suffer from the same problem with MIT Kerberos.

This change goes in effect after a reboot only.

这篇关于MIT Kerberos的失败找到TGT在MSLSA缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆