Browse Source

Configuration parameters for integration with LDAP and Active Directory

Jon Natkins 13 years ago
parent
commit
89806e1778
2 changed files with 86 additions and 1 deletions
  1. 43 0
      desktop/conf.dist/hue.ini
  2. 43 1
      desktop/core/src/desktop/conf.py

+ 43 - 0
desktop/conf.dist/hue.ini

@@ -68,6 +68,49 @@
     # - desktop.auth.backend.AllowFirstUserDjangoBackend
     # - desktop.auth.backend.AllowFirstUserDjangoBackend
     #     (Default. Relies on Django and user manager, after the first login)
     #     (Default. Relies on Django and user manager, after the first login)
 
 
+  # Configuration options for connecting to LDAP and Active Directory
+  # -------------------------------------------------------------------
+  [[ldap]]
+
+  # The search base for finding users and groups
+  ## base_dn="DC=mycompany,DC=com"
+
+  # The NT domain to connect to (only for use with Active Directory)
+  ## nt_domain=mycompany.com
+
+  # URL of the LDAP server
+  ## ldap_url=ldap://auth.mycompany.com
+
+  # Path to certificate for authentication over TLS
+  ## ldap_cert=
+
+  # Distinguished name of the user to bind as -- not necessary if the LDAP server
+  # supports anonymous searches
+  ## bind_dn="CN=ServiceAccount,DC=mycompany,DC=com"
+
+  # Password of the bind user -- not necessary if the LDAP server supports
+  # anonymous searches
+  ## bind_password=
+
+  # Pattern for searching for usernames -- Use <username> for the parameter
+  # For use when using LdapBackend for Hue authentication
+  ## ldap_username_pattern="uid=<username>,ou=People,dc=mycompany,dc=com"
+
+      [[[users]]]
+
+      # Base filter for searching for users
+      ## user_filter="objectclass=*"
+
+      # The username attribute in the LDAP schema
+      ## user_name_attr=sAMAccountName
+
+      [[[groups]]]
+
+      # Base filter for searching for groups
+      ## group_filter="objectclass=*"
+
+      # The username attribute in the LDAP schema
+      ## group_name_attr=cn
 
 
   # Configuration options for specifying the Desktop Database.  For more info,
   # Configuration options for specifying the Desktop Database.  For more info,
   # see http://docs.djangoproject.com/en/1.1/ref/settings/#database-engine
   # see http://docs.djangoproject.com/en/1.1/ref/settings/#database-engine

+ 43 - 1
desktop/core/src/desktop/conf.py

@@ -262,6 +262,9 @@ LDAP = ConfigSection(
   key="ldap",
   key="ldap",
   help="Configuration options for LDAP connectivity",
   help="Configuration options for LDAP connectivity",
   members=dict(
   members=dict(
+    BASE_DN=Config("base_dn",
+                   default=None,
+                   help="The base LDAP distinguished name to use for LDAP search."),
     NT_DOMAIN=Config("nt_domain",
     NT_DOMAIN=Config("nt_domain",
                      default=None,
                      default=None,
                      help="The NT domain used for LDAP authentication."),
                      help="The NT domain used for LDAP authentication."),
@@ -273,7 +276,46 @@ LDAP = ConfigSection(
                      help="The LDAP certificate for authentication over TLS."),
                      help="The LDAP certificate for authentication over TLS."),
     LDAP_USERNAME_PATTERN=Config("ldap_username_pattern",
     LDAP_USERNAME_PATTERN=Config("ldap_username_pattern",
                                  default=None,
                                  default=None,
-                                 help="A pattern to use for constructing LDAP usernames"),
+                                 help="A pattern to use for constructing LDAP usernames."),
+    BIND_DN=Config("bind_dn",
+                   default=None,
+                   help="The distinguished name to bind as, when importing from LDAP."),
+    BIND_PASSWORD=Config("bind_password",
+                   default=None,
+                   help="The password for the bind user."),
+
+    USERS = ConfigSection(
+      key="users",
+      help="Configuration for LDAP user schema and search",
+      members=dict(
+        USER_FILTER=Config("user_filter",
+                           default="objectclass=*",
+                           help="A base filter for use when searching for users."),
+        USER_NAME_ATTR=Config("user_name_attr",
+                              default="sAMAccountName",
+                              help="The username attribute in the LDAP schema. "
+                                   "Typically, this is 'sAMAccountName' for AD and 'uid' "
+                                   "for other LDAP systems."),
+      )
+    ),
+
+    GROUPS = ConfigSection(
+      key="groups",
+      help="Configuration for LDAP group schema and search",
+      members=dict(
+        GROUP_FILTER=Config("group_filter",
+                           default="objectclass=*",
+                           help="A base filter for use when searching for groups."),
+        GROUP_NAME_ATTR=Config("group_name_attr",
+                              default="cn",
+                              help="The group name attribute in the LDAP schema. "
+                                  "Typically, this is 'cn'."),
+        GROUP_MEMBER_ATTR=Config("group_member_attr",
+                                 default="member",
+                                 help="The LDAP attribute which specifies the "
+                                      "members of a group."),
+      )
+    ),
 ))
 ))