Reputation: 153
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?
Upvotes: 0
Views: 3858
Reputation: 18405
You will need to pass via system properties:
Upvotes: 1
Reputation: 706
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:
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.
Upvotes: 1
Reputation: 75456
The error indicates Kerberos is not setup correctly.
You need to set following JVM parameters either by using -D or System.setProperty()
,
java.security.krb5.realm : Default realm, like EXAMPLE.COM
java.security.krb5.kdc : KDC hostname, like ad.example.com
Upvotes: 1