--- title: 'Configure Hue with Multi-Authentication: LDAP & DjangoBackend and Sync LDAP user/group' author: admin type: post date: 2018-09-14T20:54:23+00:00 url: /configure-hue-with-multi-authentication-ldap-djangobackend-and-sync-ldap-user-group/ sf_thumbnail_type: - none sf_thumbnail_link_type: - link_to_post sf_detail_type: - none sf_page_title: - 1 sf_page_title_style: - standard sf_no_breadcrumbs: - 1 sf_page_title_bg: - none sf_page_title_text_style: - light sf_background_image_size: - cover sf_social_sharing: - 1 sf_related_articles: - 1 sf_sidebar_config: - left-sidebar sf_left_sidebar: - Sidebar-2 sf_right_sidebar: - Sidebar-1 sf_caption_position: - caption-right ampforwp-amp-on-off: - default categories: - Version 4 --- Aloha, Hue administrators, Hue supports multi-authentication since Hue 3.9, we can turn on Hue’s multi-authentication by updating Hue configurations through CM UI or hue.ini. On any CM-managed cluster, go to hue’s configuration page and search for “safety”: http://YourCluster.com:7180/cmf/services/10/config#filterfreeText=safety Then update **Hue Service Advanced Configuration Snippet (Safety Valve) for hue_safety_valve.ini** as following:


[desktop]

[[auth]

backend=desktop.auth.backend.LdapBackend,desktop.auth.backend.AllowFirstUserDjangoBackend

Then configure Hue LDAP related configurations through CM UI: http://YourCluster.com:7180/cmf/services/10/config as following: [][1] Here is a sample of the multi-authentication with ldap for /etc/hue/conf/hue.ini in case that you don’t have CM:


[desktop]

[[auth]

backend=desktop.auth.backend.LdapBackend,desktop.auth.backend.AllowFirstUserDjangoBackend

[[ldap]]

ldap_url=ldap://ldapserver.ad.com:389

search_bind_authentication=true

create_users_on_login=true

base_dn="ou=Test,DC=ad,DC=com"

bind_dn="testadmin@ad.com"

bind_password_script={{CMF_CONF_DIR}}/altscript.sh sec-5-bind_password

#bind_password="YourBindPassword"

[[[users]]]

user_filter="objectclass=user"

user_name_attr="sAMAccountName"

[[[groups]]]

group_filter="objectclass=group"

Save Changes, re-deploy client configuration then restart Hue. Now you should be able to log in hue as any LDAP user or Django backend user. If you are using Hue 3.12 or newer, you will find following UI with the extra drop down for "LDAP" or "Local". [][2] Once you login as superuser, you will be able to sync up LDAP users/groups through "Manager Users" page: [https://YourHueHost.com:8889/hue/useradmin/users][3]. On "Users" tab, click on "**Add/Sync LDAP user"** button... [][4] Then fill in LDAP user name either like "test*" [][5] Click "**Add/Sync user"** button, all users starts with "test" will be synced. [][6] You can also sync user with LDAP distinguished name like: "**CN=atestë01,OU=huetest,OU=test,DC=ad,DC=com" **with "**Distinguished name" **checked. [][7] Similarly for LDAP group,  just navigate to "Groups" tab then click "**Add/Sync LDAP group"** button, then fill in following accordingly, then click "**Add/Sync group"**. [][8] You can always use ldapsearch command on your host to verify if the user/group exists on your LDAP server.


ldapsearch -LLL -H ldap://ldapserver.ad.com:389 -D admin@ad.com -w yourbindPassword -b "cn=testuser,ou=test,DC=ad,DC=com"

ldapsearch -LLL -H ldap://ldapserver.ad.com:389 -D admin@ad.com -w yourbindPassword -b "cn=testgroup,ou=test,DC=ad,DC=com"

As always feel free to comment and send feedback on the [hue-user][9] list or [@gethue][10]! [1]: https://cdn.gethue.com/uploads/2018/09/HUE-LDAP-Configurations.png [2]: https://cdn.gethue.com/uploads/2018/09/LDAP-login.png [3]: https://yourhuehost.com:8889/hue/useradmin/users [4]: https://cdn.gethue.com/uploads/2018/09/AddSyncLDAPUser.png [5]: https://cdn.gethue.com/uploads/2018/09/SyncUserWithWildChar.png [6]: https://cdn.gethue.com/uploads/2018/09/UserAdminPage.png [7]: https://cdn.gethue.com/uploads/2018/09/add_syncLDAPUsers_distinguishedname.png [8]: https://cdn.gethue.com/uploads/2018/09/SyncLDAPGroupWithDistinguishedName.png [9]: http://groups.google.com/a/cloudera.org/group/hue-user [10]: https://twitter.com/gethue