如何让 Tomcat 中的 JNDIRealm 使用 Kerberos 身份验证?
我正在尝试使用 Kerberos 进行身份验证(authentication =“GSSAPI”)来运行 tomcat JNDIRealm。
但是,我得到了这个:
SEVERE: Catalina.start: LifecycleException: Exception opening directory server connection: javax.naming.AuthenticationException: GSSAPI [Root exception is javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Attempt to obtain new INITIATE credentials failed! (null)) ]]
我在 server.xml 中有这个:
<Realm className="org.apache.catalina.realm.JNDIRealm" authentication="GSSAPI" connectionName="CN=XXX User,OU=XXXGenericAccounts,\ DC=xxx,DC=com" connectionPassword="blah" connectionURL="ldap://blah.xxx.com:389" alternateURL="ldap://blah.xxx.com:389" roleBase="OU=XXXGroups,DC=xxx,DC=com" roleName="cn" roleSearch="member={0}" roleSubtree="true" userBase="OU=XXXUsers,DC=xxx,DC=com" userSearch="sAMAccountName={0}" userSubtree="true"/>
知道我在这里缺少什么吗?
I am trying to run a tomcat JNDIRealm using using Kerberos for authentication (authentication="GSSAPI").
However, I'm getting this:
SEVERE: Catalina.start: LifecycleException: Exception opening directory server connection: javax.naming.AuthenticationException: GSSAPI [Root exception is javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Attempt to obtain new INITIATE credentials failed! (null)) ]]
I have this in server.xml:
<Realm className="org.apache.catalina.realm.JNDIRealm" authentication="GSSAPI" connectionName="CN=XXX User,OU=XXXGenericAccounts,\ DC=xxx,DC=com" connectionPassword="blah" connectionURL="ldap://blah.xxx.com:389" alternateURL="ldap://blah.xxx.com:389" roleBase="OU=XXXGroups,DC=xxx,DC=com" roleName="cn" roleSearch="member={0}" roleSubtree="true" userBase="OU=XXXUsers,DC=xxx,DC=com" userSearch="sAMAccountName={0}" userSubtree="true"/>
any idea what I am missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
该错误表明 Kerberos 设置不正确。
您需要使用 -D 或 System.setProperty() 设置以下 JVM 参数,
The error indicates Kerberos is not setup correctly.
You need to set following JVM parameters either by using -D or
System.setProperty()
,jorel:
除了定义领域/KDC 的初始问题之外,错误消息中还描述了您收到的 NamingException — 您的 LDAP 服务器“blah.xxx.com”不允许匿名绑定,并且 tomcat正在尝试在没有绑定的情况下运行搜索。
如果您希望使用用户的凭据搜索 LDAP,那么问题是它不会将凭据转发到 LDAP。我还不熟悉这些东西在 Java 中是如何工作的,但有几个可能的原因:
http://publib.boulder.ibm.com/infocenter/ltscnnct/v2r0/index.jsp?topic=/com.ibm.connections.25.help/t_install_kerb_edit_browsers.html 获取相关浏览器配置。
如果您尝试使用connectionName DN 作为bindDN 进行搜索,请检查LDAP 服务器上是否存在故障,即“无效凭据”(用户/密码不正确)或ACL 问题。
jorel:
In addition to the initial issue of defining the realm/KDC, the NamingException you're getting is described on in the error message---your LDAP server "blah.xxx.com" doesn't allow anonymous binds, and tomcat is trying to run a search without binding.
If you want LDAP to be searched using the user's credentials, then the problem is that it isn't forwarding the credentials along to LDAP. I'm not yet familiar with how this stuff works inside Java, but there's a couple possible causes:
http://publib.boulder.ibm.com/infocenter/ltscnnct/v2r0/index.jsp?topic=/com.ibm.connections.25.help/t_install_kerb_edit_browsers.html for the relevant browser config.
If you're trying to search using the connectionName DN as a bindDN, then check for failures on the LDAP server---i.e. "Invalid credentials" (user/pass incorrect) or ACL issues.
您需要通过系统属性:
You will need to pass via system properties: