Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

Kerberos and LDAP integration


I am creating a kerberised HDP cluster on AWS. For managing the user and groups I am using openLDAP (on RHEL 7 machine) and want to configure it to work with Kerberos.

I am following the official tutorial for setting up kerberos with existing AD but while testing connection during the setup it constantly fails (see screenshot).

I have LDAPS setup and working fine - I am able to sync users using ambari-server sync-ldap command over ldaps and also able to login to the ambari-server using the users created on openLDAP. Telnet to (my LDAP server) from my edge node (where ambari-sevrer is installed) also works fine.

It is only while setting up kerberos that the connection fails.

Just for testing I installed krb5-server on the edge node and tried installing kerberos with a existing MIT KDC which works fine. I hope to make it work with openLDAP (existing AD)




This problem has been solved!

Want to get a detailed solution you have to login/registered on the community



This problem has been solved!

Want to get a detailed solution you have to login/registered on the community



@Robert Levas thank you for the quick response.

I tried your suggestion and passed through the initial step (see pic1).

However on proceeding further, I get an error while testing the kerberos client (see pic2 and pic3).

On checking ambari-server logs, I notice the error:

Caused by: org.apache.ambari.server.AmbariException: Unexpected error condition
at org.apache.ambari.server.controller.KerberosHelperImpl.validateKDCCredentials(
at org.apache.ambari.server.controller.KerberosHelperImpl.handleTestIdentity(
at org.apache.ambari.server.controller.KerberosHelperImpl.createTestIdentity(
at org.apache.ambari.server.controller.AmbariManagementControllerImpl.createAction(
at org.apache.ambari.server.controller.internal.RequestResourceProvider$1.invoke(
at org.apache.ambari.server.controller.internal.RequestResourceProvider$1.invoke(
at org.apache.ambari.server.controller.internal.AbstractResourceProvider.invokeWithRetry(
at org.apache.ambari.server.controller.internal.AbstractResourceProvider.createResources(
Caused by: javax.naming.InvalidNameException: [LDAP: error code 34 - invalid DN]
at com.sun.jndi.ldap.LdapCtx.processReturnCode(
at com.sun.jndi.ldap.LdapCtx.processReturnCode(
at com.sun.jndi.ldap.LdapCtx.connect(
at com.sun.jndi.ldap.LdapCtx.<init>(
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(
at javax.naming.spi.NamingManager.getInitialContext(
at javax.naming.InitialContext.getDefaultInitCtx(
at javax.naming.InitialContext.init(
at javax.naming.ldap.InitialLdapContext.<init>(
at org.apache.ambari.server.serveraction.kerberos.ADKerberosOperationHandler.createInitialLdapContext(
at org.apache.ambari.server.serveraction.kerberos.ADKerberosOperationHandler.createLdapContext(
... 102 more

I am not sure what is causing this error and couldn't find any support online either.

My base domain for LDAP is dc=testhdp,dc=com which works fine while authenticating using (open)LDAP alone (see pic4).

But here I get the error "Caused by: javax.naming.InvalidNameException: [LDAP: error code 34 - invalid DN]"

Can you please help me what I am doing wrong to setup LDAP working with kerberos. I have attached relevant ambari-server logs.logs.txt







the container, 'dc=testhdp,dc=com', seems to be rather high up in the LDAP tree. Maybe your admin user credential does not have privs to write there. Usually a container is created for the hadoop principals... like 'ou=hadoop,dc=testhdp,dc=com' and a user in the AD is delegated administrative access to manage user accounts in that container (some times referred to as an "O U" - I prefer "container" though).

Try to create a container and ensure the AD account that Ambari is using has privileges to create users in that container.


@Robert Levas thank you so very much. Your answer makes a lot of sense and I think this is exactly what is causing the problem. I'll create a new "OU" 'ou=hadoop,dc=testhdp,dc=com' in openLDAP right? Now my admin user in ambari is (admin) and for kerberos it is (root/admin), how do I provide it access to create the users in there? Can you please help me there? - sorry to bug you again.


OpenLDAP? I thought this was Active Directory. If you are not using an Active Directory, you will need to choose a different KDC type when enabling Kerberos.

Ambari does not generally create users in an LDAP directory. However when enabling Kerberos, it needs to create accounts in the KDC to store the principal names and password. This is done differently depending on the type of KDC you are using. For Active Directory, the method Ambari uses is to connect to its LDAP interface and create user accounts with the needed attributes. For MIT KDC, it uses the MIT kadmin utility to request the creation of new principals and export keytab files. And for IPA, it uses the ipa client utilities to request the creation of new principals and export keytab files. In each case, you tell Ambari what the administrator credentials are in the Enable Kerberos wizard - like you have in the screen shots above.


@Robert Levas thank you for the clarification - I understand things better. So, now that I am using openLDAP, what KDC type then should I use then? Ambari setup only gives me two types for automated kerberos setup: AD and MIT KDC.


@Rohan Goel

Active Directory is a Microsoft product that runs on a Microsoft Windows server. It provides a lot of services for a (Windows) network. In this case, it can also provide LDAP and KDC services for a your Hadoop cluster. If you do not already have an Active Directory set up, or if you do not wish to use your Active Directory as a KDC for Kerberos authentication, then you probably want to install an MIT KDC. However, if using Ambari 2.7.0 or above, you might consider IPA (or FreeIPA), since it is sort of similar to an Active Directory. An IPA server provides several services for a network like DNS, LDAP, and KCD; however, it will take some learning to get it all installed and working.

That said, if you are already set on using OpenLDAP, you should use the MIT KDC option. See for information on installing this KDC. You can even configure it to use OpenLDAP as it's backend - see

I have a script that will install an MIT KDC using the most simple options (I use it for testing) - install-kdc-centossh.txt (I needed to add the .txt extension to the .sh file to upload it here). If you do not edit the script, it will create a KDC with the following properties:

administrator principal: admin/admin@EXAMPLE.COM
administrator password: hadoop

I hope this helps.


If you are on a newer version of Ambari I recommend you take advantage of using FreeIPA option. (Basically AD for Redhat)


Thank you @Robert Levas @dvillarreal

Yes, I am using a newer version of ambari and also tried FreeIPA since openLDAP didn't seem to work art all with kerberos.

I followed the exact steps as on - everything seems to be working fine but fails when kerberizing the cluster. I get the following error:

Also, important to note that while I get the following error:

DNS query for A failed: The DNS operation timed out after 30.0005660057 seconds DNS resolution for hostname failed: The DNS operation timed out after 30.0005660057 seconds Failed to update DNS records. Missing A/AAAA record(s) for host Missing reverse record(s) for address(es): 	

I installed server as:

ipa-server-install \ --realm=TESTHDP.COM \ \ --setup-dns \ --forwarder= \

and the clients on each node as

ipa-client-install \ \
    --realm=TESTHDP.COM \

Also, that post doing the following step:

echo "nameserver" > /etc/resolv.conf

my yum is broken and I need to revert to make it work.

Do you guys have any idea about it? I thought that there is no need of DNS as I have resolution of * in my hostfile on all nodes.