Skip to main content

LDAP Authentication Source

LDAP authentication sources support importing users and groups from LDAP, including Microsoft Active Directory (MSAD), OpenLDAP, and generic LDAP servers.

Domain, user, and group definitions come from LDAP. Adding and deleting are not allowed. Fields that cannot be modified are shown in the following table.

ResourceNon-modifiable Field Names
Domainname
Groupname, displayname
Username, displayname, enabled, mobile, email, password

Basic configuration for LDAP authentication sources is as follows:

Configuration ItemDescriptionExample
urlServer address, must start with ldap:// or ldaps://ldap://192.168.222.201:389
suffixDN of LDAP root pathDC=ipa,DC=yunionyun,DC=com
userUsername of read-only account for accessing LDAP. For AD, it's the username. For OpenLDAP, it's the user's DNUID=dcadmin,CN=users,CN=accounts,DC=ipa,DC=yunionyun,DC=com
passwordPassword of read-only account for accessing LDAP

For templates that import a single domain, you need to specify the user_tree_dn and group_tree_dn parameters

Configuration ItemDescriptionExample
user_tree_dnUser search root path, will recursively search for users under this pathCN=users,CN=accounts,DC=ipa,DC=yunionyun,DC=com
group_tree_dnGroup search root path, will recursively search for groups under this pathCN=groups,CN=accounts,DC=ipa,DC=yunionyun,DC=com

For templates that import multiple domains, you need to specify domain_tree_dn

Configuration ItemDescriptionExample
domain_tree_dnDomain search root path, will search for domains in first-level child nodes under this pathOU=集团公司,DC=yuniondc,DC=com

For non-template LDAP configurations, there are the following configuration items:

Configuration ItemDescriptionmsad_one_domain Default Valuemsad_multi_domain Default Valueopenldap_one_domain Default Value
query_scopeDefault search scope: entire subtree (sub) under tree_dn or current level (one)NANANA
import_domainWhether to import domainfalsetruefalse
domain_tree_dnIf import_domain is true, root path for importing domain informationNA-NA
domain_filterFilter for searching domainsNA-NA
domain_objectclassObject class corresponding to domainNAorganizationalUnitNA
domain_id_attributeAttribute name corresponding to domain IDNAobjectGUIDNA
domain_name_attributeAttribute name corresponding to domain nameNAnameNA
domain_query_scopeScope for searching domain information: sub or oneNAoneNA
user_tree_dnDN of root node for importing user information. If import_domain is true, this field is meaningless-NA-
user_filterFilter for searching users---
user_objectclassObject class corresponding to userorganizationalPersonorganizationalPersonperson
user_id_attributeObject attribute name corresponding to user IDsAMAccountNamesAMAccountNameuid
user_name_attributeObject attribute name corresponding to usernamesAMAccountNamesAMAccountNameuid
user_enabled_attributeAttribute name for user enabled statususerAccountControluserAccountControlnsAccountLock
user_enabled_maskMask corresponding to user enabled attribute2 (0x10)2 (0x10)0
user_enabled_defaultDefault value for user enabled attribute512512FALSE
user_enabled_invertWhether user enabled attribute is invertedtruetruetrue
user_additional_attribute_mappingMapping table for additional user attributesmail:emailmail:emailmail:email
user_query_scopeScope for searching user information: sub or onesubsubsub
group_tree_dnRoot path for importing group information---
group_filterFilter for searching groups---
group_objectclassObject class corresponding to groupgroupgroupipausergroup
group_id_attributeObject attribute name corresponding to group IDsAMAccountNamesAMAccountNamecn
group_name_attributeObject attribute name corresponding to group namenamenamecn
group_member_attributeObject attribute name corresponding to group member attributemembermembermember
group_members_are_idsWhether group member list contains user IDs or usernamesfalsefalsefalse
group_query_scopeScope for searching group information: sub or onesubsubsub

Authentication Source Synchronization

For authentication sources such as LDAP that can be fully synchronized, domain, user, and group information will be fully synchronized periodically. The synchronization cycle is 15 minutes by default and can be configured through the parameter default_sync_interval_seoncds.

Configuration Commands

LDAP authentication sources support three modes:

  1. Single Domain Mode

Import users and groups under the specified LDAP dn_tree into a specified domain. This mode supports two import templates: msad_one_domain, which is the MSAD import template, and openldap_one_domain, which is the OpenLDAP import template.

climc idp-create-ldap-single-domain --target-domain example_domain --url ldap://192.168.222.102 --suffix 'DC=ipa,DC=example,DC=com' --user 'UID=dcadmin,CN=users,CN=accounts,DC=ipa,DC=example,DC=com' --password <password> --user-tree-dn 'CN=users,CN=accounts,DC=ipa,DC=example,DC=com' --group-tree-dn 'CN=groups,CN=accounts,DC=ipa,DC=example,DC=com' mainLdap openldap_one_domain
  1. Multi-Domain Mode

Import each OU under the specified LDAP dn_tree as a new domain, and import users and groups under the corresponding OU into the corresponding domain. This mode only supports one template msad_multi_domain, which only supports MSAD import (because only MSAD supports the OU concept).

climc idp-create-ldap-multi-domain --url 'ldap://192.168.222.102' --suffix 'DC=example,DC=com' --user 'dcadmin' --password <password> --domain-tree-dn 'OU=集团公司,DC=example,DC=com' multildap msad_multi_domain
  1. Custom Mode

Fully custom mode, requiring users to specify all LDAP parameters. This mode has complex parameters and is only recommended when the above modes do not work.

climc idp-create-ldap [--no-auto-create-project] [--target-domain TARGET_DOMAIN] [--auto-create-project] [--query-scope {one,sub}] [--user USER] [--password PASSWORD] [--disable-user-on-import] [--domain-tree-dn DOMAIN_TREE_DN] [--domain-filter DOMAIN_FILTER] [--domain-objectclass DOMAIN_OBJECTCLASS] [--domain-id-attribute DOMAIN_ID_ATTRIBUTE] [--domain-name-attribute DOMAIN_NAME_ATTRIBUTE] [--domain-query-scope {one,sub}] [--user-tree-dn USER_TREE_DN] [--user-filter USER_FILTER] [--user-objectclass USER_OBJECTCLASS] [--user-id-attribute USER_ID_ATTRIBUTE] [--user-name-attribute USER_NAME_ATTRIBUTE] [--user-enabled-attribute USER_ENABLED_ATTRIBUTE] [--user-enabled-mask USER_ENABLED_MASK] [--user-enabled-default USER_ENABLED_DEFAULT] [--user-enabled-invert] [--user-additional-attribute USER_ADDITIONAL_ATTRIBUTE] [--user-query-scope {one,sub}] [--group-tree-dn GROUP_TREE_DN] [--group-filter GROUP_FILTER] [--group-objectclass GROUP_OBJECTCLASS] [--group-id-attribute GROUP_ID_ATTRIBUTE] [--group-name-attribute GROUP_NAME_ATTRIBUTE] [--group-member-attribute GROUP_MEMBER_ATTRIBUTE] [--group-members-are-ids] [--group-query-scope {one,sub}] <--url URL> <--suffix SUFFIX> <NAME>