Support Questions
Find answers, ask questions, and share your expertise

knox : LDAP setup : How to specify a password toconnect to the LDAP server ?



I'm currently setting up Knox (and Ranger) on my cluster, and I'm experiencing issues having Knox to connect to my OpenLDAP servers in order to authenticate users.

(For information, I did already setup Ambari and Ranger (+usersync) to sync with my OpenLDAP server and It works fine.)

While testing the following command :

# /usr/hdp/ user-auth-test --cluster default --u <mylogin> --p <my_password> --g --d

I get the following output :

org.apache.shiro.authc.AuthenticationException: LDAP authentication failed. [LDAP: error code 49 - Invalid Credentials]

This message makes sense as I don't know how to specify a password to connect to the LDAP server within my Knox configuration (topology).

Is there a specific param entries that allow to indicate this password ?

Thanks in advance.

Kind regards



Re: knox : LDAP setup : How to specify a password toconnect to the LDAP server ?

Put this into your topology .xml file, replacing systemUserName and password with your values (for production the password can be stored in a credential store). For more details check this page.


Re: knox : LDAP setup : How to specify a password toconnect to the LDAP server ?


Thanks Predrag ! The authentication works , .....but I endup with another java error.

Any clue ?

LDAP authentication successful!

java.lang.NullPointerException at javax.naming.InitialContext.getURLScheme( at javax.naming.InitialContext.getURLOrDefaultInitCtx( at at at org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm.rolesFor( at org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm.getRoles( at org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm.queryForAuthorizationInfo( at org.apache.shiro.realm.ldap.JndiLdapRealm.doGetAuthorizationInfo( at org.apache.shiro.realm.AuthorizingRealm.getAuthorizationInfo( at org.apache.shiro.realm.AuthorizingRealm.hasRole( at org.apache.shiro.authz.ModularRealmAuthorizer.hasRole( at org.apache.shiro.mgt.AuthorizingSecurityManager.hasRole( at at org.apache.hadoop.gateway.util.KnoxCLI$LDAPAuthCommand.getGroups( at org.apache.hadoop.gateway.util.KnoxCLI$LDAPAuthCommand.execute( at at at org.apache.hadoop.gateway.util.KnoxCLI.main( at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( at org.apache.hadoop.gateway.launcher.Invoker.invokeMainMethod( at org.apache.hadoop.gateway.launcher.Invoker.invoke( at org.apache.hadoop.gateway.launcher.C at org.apache.hadoop.gateway.launcher.L at org.apache.hadoop.gateway.launcher.L

Re: knox : LDAP setup : How to specify a password toconnect to the LDAP server ?

Check again all entries in your ShiroProvider (refer to sample 7 in the link I provided), in particular those related to groups, names beginning in "". You can also remove all group related entries to make sure user sync works, and then add groups alter. For user sync, besides userSearchBase and userSearchAttributeName you can also use userDnTemplate. And if my answer was helpful please consider to accept it and/or upvote it. Tnx!