gpt4 book ai didi

kerberos - Keycloak + Kerberos 认证 : Mechanism level: Invalid argument (400) - Cannot find key of appropriate type to decrypt AP REP - RC4 with HMAC

转载 作者:行者123 更新时间:2023-12-05 07:12:40 25 4
gpt4 key购买 nike

我有以下内容

  1. JBoss EAP 7.2.2 上的 spring web 应用程序 - Machine CentOs
  2. CentOs 上的 Keycloak 3.3.4
  3. 事件目录

我们在 OpenJDK 8 上运行

用户使用他们的 Active Directory 帐户从 Windows 计算机登录。

Keycloak 配置了 kerberos 使用联盟。在 CentOs 机器上使用

安装 kerberos 客户端
yum install krb5-user krb5-doc
yum install krb5-pkinit krb5-workstation
yum install krb5-libs krb5-devel
yum install krb5-server krb5-workstation pam_krb5

在 keycloak 用户联盟中,keytab 文件路径和其他配置都是正确的。 keycloak 日志文件证实了这一点。领域:XYZ.COM服务器主体 HTTP/principal-name@REALM

Keytab文件是使用

生成的
ktpass.exe /out file.keytab /mapuser user-name@REALM /mapop set /princ HTTP/principal-name@REALM /ptype KRB5_NT_PRINCIPAL /pass XXXXXX /crypto RC4-HMAC-NT

在krb5.conf中输入以下内容

default_tgs_enctypes = arcfour-hmac
default_tkt_enctypes = arcfour-hmac
permitted_enctypes = arcfour-hmac

问题是登录时出现异常

Looking for keys for: HTTP/principal-name@REALM
2020-02-24 09:34:06,327 WARN [org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator] (default task-13) SPNEGO login failed: java.security.PrivilegedActionException: GSSException: Failure unspecified at GSS-API level (Mechanism level: Invalid argument (400) - Cannot find key of appropriate type to decrypt AP REP - RC4 with HMAC)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator.authenticate(SPNEGOAuthenticator.java:68)
at org.keycloak.storage.ldap.LDAPStorageProvider.authenticate(LDAPStorageProvider.java:677)
at org.keycloak.credential.UserCredentialStoreManager.authenticate(UserCredentialStoreManager.java:296)
at org.keycloak.authentication.authenticators.browser.SpnegoAuthenticator.authenticate(SpnegoAuthenticator.java:89)
at org.keycloak.authentication.DefaultAuthenticationFlow.processFlow(DefaultAuthenticationFlow.java:200)
at org.keycloak.authentication.AuthenticationProcessor.authenticateOnly(AuthenticationProcessor.java:853)
at org.keycloak.authentication.AuthenticationProcessor.authenticate(AuthenticationProcessor.java:722)
at org.keycloak.protocol.AuthorizationEndpointBase.handleBrowserAuthenticationRequest(AuthorizationEndpointBase.java:145)

at ...
Caused by: GSSException: Failure unspecified at GSS-API level (Mechanism level: Invalid argument (400) - Cannot find key of appropriate type to decrypt AP REP - RC4 with HMAC)
at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:856)
at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:342)
at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:285)
at sun.security.jgss.spnego.SpNegoContext.GSS_acceptSecContext(SpNegoContext.java:906)
at sun.security.jgss.spnego.SpNegoContext.acceptSecContext(SpNegoContext.java:556)
at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:342)
at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:285)
at org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator.establishContext(SPNEGOAuthenticator.java:169)
at org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator$AcceptSecContext.run(SPNEGOAuthenticator.java:132)
at org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator$AcceptSecContext.run(SPNEGOAuthenticator.java:122)
... 72 more
Caused by: KrbException: Invalid argument (400) - Cannot find key of appropriate type to decrypt AP REP - RC4 with HMAC
at sun.security.krb5.KrbApReq.authenticate(KrbApReq.java:278)
at sun.security.krb5.KrbApReq.<init>(KrbApReq.java:149)
at sun.security.jgss.krb5.InitSecContextToken.<init>(InitSecContextToken.java:108)
at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:829)
... 81 more

2020-02-24 09:34:06,328 INFO [stdout] (default task-13) [Krb5LoginModule]: Entering logout
2020-02-24 09:34:06,328 INFO [stdout] (default task-13) [Krb5LoginModule]: logged out Subject

我已经做了很多研究,不幸的是排除了所有可能的原因。进行了以下测试:klist -k {keytab 文件的路径} -e

结果 4 HTTP/principal-name@REALM arcfour-hmac在事件目录中,msDS-KeyVersionNumber = 4

kinit HTTP/principal-name@REALMklist -e

结果: ... Etype (skey, TKT) arcfour-hmac, aes256-cts-hmac-sha1-96

总而言之,Keycloak 能够读取 key 表,但无法查找解密 key 。

有人可以帮忙吗?

我已经看过这篇文章 Kerberos - Cannot find key of appropriate type to decrypt AP REP - RC4 with HMAC

以及以下链接: https://bugs.openjdk.java.net/browse/JDK-8193855

和许多其他帖子,但没有成功。

最佳答案

您正在使用以下配置:/crypto RC4-HMAC-NT

我有同样的错误,因为 keytab 文件是用错误的 /crypto 配置生成的。

Failure unspecified at GSS-API level (Mechanism level: Invalid argument (400)
Cannot find key of appropriate type to decrypt AP-REQ - RC4 with HMAC)

您可以尝试使用 /crypto ALLktpass 命令生成一个新的 key 表文件。

关于kerberos - Keycloak + Kerberos 认证 : Mechanism level: Invalid argument (400) - Cannot find key of appropriate type to decrypt AP REP - RC4 with HMAC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60380712/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com