HUE-8055 [desktop] Support multiple LDAP servers in LDAP Test command

Review Request #12626 - Created March 7, 2018 and submitted

Ying Chen
hue
master
HUE-8055
hue
enricoberti, jgauthier, johan, ranade, romain, test, weixia
commit 0accc9f1a9b9f6e97d6cc733f451173388f52512 (HEAD -> HUE-8055-ldaptest)
Author: Ying Chen <yingchen@cloudera.com>
Date:   Wed Mar 7 19:20:26 2018 -0800

    HUE-8055 [desktop] Support multiple LDAP servers in LDAP Test command

:100644 100644 3ef77273b2... 70ba41c428... M    desktop/core/src/desktop/management/commands/ldaptest.py
# build/env/bin/hue ldaptest

Leopard libedit detected.
pydev debugger: process 41873 is connecting

Connected to pydev debugger (build 172.4343.24)
[09/Mar/2018 18:21:38 -0800] settings     DEBUG    DESKTOP_DB_TEST_NAME SET: /Users/yingc/Documents/test_data/hue_unit_test/test.db
[09/Mar/2018 18:21:38 -0800] settings     DEBUG    DESKTOP_DB_TEST_USER SET: hue_test
[09/Mar/2018 18:21:45 -0800] __init__     INFO     Couldn't import snappy. Support for snappy compression disabled.
2018-03-09 18:21:46,003 - INFO - [desktop]
2018-03-09 18:21:46,003 - INFO - [[ldap]]
2018-03-09 18:21:46,004 - INFO - create_users_on_login=True
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     [desktop]
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     [[ldap]]
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     create_users_on_login=True
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     sync_groups_on_login=True
2018-03-09 18:21:46,004 - INFO - sync_groups_on_login=True
2018-03-09 18:21:46,005 - INFO - ignore_username_case=True
2018-03-09 18:21:46,005 - INFO - force_username_lowercase=True
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     ignore_username_case=True
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     force_username_lowercase=True
2018-03-09 18:21:46,006 - INFO - force_username_uppercase=False
2018-03-09 18:21:46,006 - INFO - subgroups=suboordinate
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     force_username_uppercase=False
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     subgroups=suboordinate
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     nested_members_search_depth=10
2018-03-09 18:21:46,007 - INFO - nested_members_search_depth=10
2018-03-09 18:21:46,007 - INFO - [[[ldap_servers]]]
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     [[[ldap_servers]]]
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     [[[[LDAP1]]]]
2018-03-09 18:21:46,008 - INFO - [[[[LDAP1]]]]
2018-03-09 18:21:46,009 - INFO - follow_referrals=False
2018-03-09 18:21:46,009 - INFO - debug=False
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     follow_referrals=False
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     debug=False
2018-03-09 18:21:46,010 - INFO - debug_level=255
2018-03-09 18:21:46,010 - INFO - trace_level=0
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     debug_level=255
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     trace_level=0
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     base_dn="ou=fake_ou,DC=xxx,dc=cloudera,dc=com"
2018-03-09 18:21:46,011 - INFO - base_dn="ou=fake_ou,DC=xxx,dc=cloudera,dc=com"
2018-03-09 18:21:46,011 - INFO - nt_domain="None"
2018-03-09 18:21:46,012 - INFO - ldap_url="ldap://xxx.cloudera.com"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     nt_domain="None"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     ldap_url="ldap://xxx.cloudera.com"
2018-03-09 18:21:46,013 - INFO - use_start_tls=True
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     use_start_tls=True
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     ldap_cert="None"
2018-03-09 18:21:46,013 - INFO - ldap_cert="None"
2018-03-09 18:21:46,014 - INFO - ldap_username_pattern="None"
2018-03-09 18:21:46,014 - INFO - bind_dn="test_user@xxx.cloudera.com"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     ldap_username_pattern="None"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     bind_dn="test_user@xxx.cloudera.com"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     bind_password=*******
2018-03-09 18:21:46,015 - INFO - bind_password=*******
2018-03-09 18:21:46,015 - INFO - search_bind_authentication=True
2018-03-09 18:21:46,016 - INFO - test_ldap_user="test_user"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     search_bind_authentication=True
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     test_ldap_user="test_user"
2018-03-09 18:21:46,016 - INFO - test_ldap_group="None"
2018-03-09 18:21:46,017 - INFO - [[[[[users]]]]]
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     test_ldap_group="None"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     [[[[[users]]]]]
2018-03-09 18:21:46,018 - INFO - user_filter="(objectClass=user)"
2018-03-09 18:21:46,018 - INFO - user_name_attr="sAMAccountName"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     user_filter="(objectClass=user)"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     user_name_attr="sAMAccountName"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     [[[[[groups]]]]]
2018-03-09 18:21:46,019 - INFO - [[[[[groups]]]]]
2018-03-09 18:21:46,019 - INFO - group_filter="(objectClass=group)"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     group_filter="(objectClass=group)"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     group_name_attr="cn"
2018-03-09 18:21:46,020 - INFO - group_name_attr="cn"
2018-03-09 18:21:46,020 - INFO - group_member_attr="member"
2018-03-09 18:21:46,021 - INFO - -----------------------
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     group_member_attr="member"
[09/Mar/2018 18:21:46 -0800] ldaptest     INFO     -----------------------
2018-03-09 18:21:51,216 - INFO - LDAP whoami_s() u:AD\test_user
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     LDAP whoami_s() u:AD\test_user
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     ldapsearch -x -LLL -H ldap://xxx.cloudera.com -D "test_user@xxx.cloudera.com" -w "********" -b "ou=fake_ou,DC=xxx,dc=cloudera,dc=com" "(&(objectClass=user)(sAMAccountName=test_user))" objectClass isMemberOf memberOf givenName sn mail dn sAMAccountName
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     {'dn': 'CN=Ying Chen,OU=Users,OU=fake_ou,DC=xxx,DC=cloudera,DC=com', 'username': 'test_user', 'last': 'Chen', 'first': 'Ying'}
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     Now test further by providing test ldap group in CM
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     test_ldap_group=somegroupname
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     test_ldap_group=cn=Administrators,dc=test,dc=com
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     [[[[LDAP2]]]]
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     follow_referrals=False
2018-03-09 18:21:51,221 - INFO - ldapsearch -x -LLL -H ldap://xxx.cloudera.com -D "test_user@xxx.cloudera.com" -w "********" -b "ou=fake_ou,DC=xxx,dc=cloudera,dc=com" "(&(objectClass=user)(sAMAccountName=test_user))" objectClass isMemberOf memberOf givenName sn mail dn sAMAccountName
2018-03-09 18:21:51,222 - INFO - {'dn': 'CN=Ying Chen,OU=Users,OU=fake_ou,DC=xxx,DC=cloudera,DC=com', 'username': 'test_user', 'last': 'Chen', 'first': 'Ying'}
2018-03-09 18:21:51,222 - INFO - Now test further by providing test ldap group in CM
2018-03-09 18:21:51,223 - INFO - test_ldap_group=somegroupname
2018-03-09 18:21:51,223 - INFO - test_ldap_group=cn=Administrators,dc=test,dc=com
2018-03-09 18:21:51,224 - INFO - [[[[LDAP2]]]]
2018-03-09 18:21:51,225 - INFO - follow_referrals=False
2018-03-09 18:21:51,225 - INFO - debug=False
2018-03-09 18:21:51,226 - INFO - debug_level=255
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     debug=False
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     debug_level=255
2018-03-09 18:21:51,226 - INFO - trace_level=0
2018-03-09 18:21:51,227 - INFO - base_dn="ou=fake_ou,DC=xxx,dc=cloudera,dc=com"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     trace_level=0
2018-03-09 18:21:51,228 - INFO - nt_domain="None"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     base_dn="ou=fake_ou,DC=xxx,dc=cloudera,dc=com"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     nt_domain="None"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     ldap_url="ldap://xxx.cloudera.com"
2018-03-09 18:21:51,229 - INFO - ldap_url="ldap://xxx.cloudera.com"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     use_start_tls=True
2018-03-09 18:21:51,229 - INFO - use_start_tls=True
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     ldap_cert="None"
2018-03-09 18:21:51,230 - INFO - ldap_cert="None"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     ldap_username_pattern="None"
2018-03-09 18:21:51,230 - INFO - ldap_username_pattern="None"
2018-03-09 18:21:51,231 - INFO - bind_dn="test_user@xxx.cloudera.com"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     bind_dn="test_user@xxx.cloudera.com"
2018-03-09 18:21:51,232 - INFO - bind_password=*******
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     bind_password=*******
2018-03-09 18:21:51,232 - INFO - search_bind_authentication=True
2018-03-09 18:21:51,233 - INFO - test_ldap_user="None"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     search_bind_authentication=True
2018-03-09 18:21:51,234 - INFO - test_ldap_group="None"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     test_ldap_user="None"
2018-03-09 18:21:51,234 - INFO - [[[[[users]]]]]
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     test_ldap_group="None"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     [[[[[users]]]]]
2018-03-09 18:21:51,235 - INFO - user_filter="(objectClass=user)"
2018-03-09 18:21:51,236 - INFO - user_name_attr="sAMAccountName"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     user_filter="(objectClass=user)"
2018-03-09 18:21:51,236 - INFO - [[[[[groups]]]]]
2018-03-09 18:21:51,237 - INFO - group_filter="(objectClass=group)"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     user_name_attr="sAMAccountName"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     [[[[[groups]]]]]
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     group_filter="(objectClass=group)"
2018-03-09 18:21:51,238 - INFO - group_name_attr="cn"
2018-03-09 18:21:51,238 - INFO - group_member_attr="member"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     group_name_attr="cn"
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     group_member_attr="member"
2018-03-09 18:21:51,239 - INFO - -----------------------
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     -----------------------
2018-03-09 18:21:51,253 - INFO - LDAP whoami_s() u:AD\test_user
2018-03-09 18:21:51,255 - INFO - Now test further by providing test ldap user in CM
2018-03-09 18:21:51,255 - INFO - test_ldap_user=someusername
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     LDAP whoami_s() u:AD\test_user
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     Now test further by providing test ldap user in CM
[09/Mar/2018 18:21:51 -0800] ldaptest     INFO     test_ldap_user=someusername

Process finished with exit code 0
  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
  1. Nice!

    Some nitd and do we have a test for it?

  2. desktop/core/src/desktop/management/commands/ldaptest.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Could we combine those in the same methode somehow to avoid the duplication?

  3. 
      
  1. Ship It!
  2. 
      
Review request changed

Status: Closed (submitted)

Loading...