views:

418

answers:

2

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?

A: 

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
ZZ Coder
yes. got past this, but am using Kerberos/JAAS :<pre><Realm className="org.apache.catalina.realm.JAASRealm" appName="vt-ldap" userClassNames="edu.vt.middleware.ldap.jaas.LdapPrincipal" roleClassNames="edu.vt.middleware.ldap.jaas.LdapRole" /></pre>and getting this:javax.security.auth.login.LoginException: javax.naming.NamingException: [LDAP: error code 1 - 00000000: Lda, comment: In order to perform this operation a successful bind must be completed on the connection., data name 'ou=LIMUsers,dc=lim,dc=com'
A: 

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:

  1. Tomcat isn't requesting a ticket which can be forwarded/delegated.
  2. The client isn't providing such a ticket. See: 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.
  3. Tomcat isn't trying to do a SASL bind to the LDAP server using the properly requested/given ticket.

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.

James Cape