Various options supported in Ranger Usersync with AD/LDAP as the sync source
This article mainly focuses mainly on what all supported options available in User sync and how they can be used to target specific use cases. For some common use cases examples and how ranger can be configured in those cases, please refer to Configuring Ranger UserSync with AD/LDAP
- User based search without enable group sync:
- This configuration can be used in cases where customers want to sync users based on a OU or a user search filter and get all the groups the users belong to.
- This case is supported only when the user object has the group membership attributes like “memberof” or “ismemberof”.
- This option is available only in Full sync case (i.e., when Incremental sync is disabled in Ranger User sync configuration)
- User based search with enable group sync:
- This configuration can be used in cases where -
- customers want to sync users based on a OU or a user search filter and want to limit the groups that these user belong to based on the OU or a group search filter.
- Group membership attributes like “memberof” is not available for the user objects.
- This is the default option when “Incremental Sync” is enabled in Ranger Usersync configuration
- This option is available for both “Incremental Sync” or “Full Sync”
- This configuration can be used in cases where -
- This option is available for both “Incremental Sync” or “Full Sync”
- This option cannot be used in cases where customers want to sync the users with “sAMAccountName” instead if “CN”
- This is the default option when “Group Search First Enable” is set to “true”
- This configuration can be used in cases where -
- customers want to sync groups based on a OU or a group search filter and get all the users that belong to those groups.
- customers want to sync the groups that don’t have any users
- This configuration can be used in cases where
- customers want to sync groups based on a OU or a group search filter and limit the users that belong to those groups based on a OU or a user search filter.
- customers want to sync groups based on a OU or a group search filter and use the “sAMAccountName” for the user instead of “CN”
- customers want to sync the groups that don’t have any users
- This configuration can be used in cases where customers want to sync users and/or groups from multiple OUs
- Multiple OUs can be specified in the User search base and/or Group search base using “;” separated like ou=OU1,dc=hortonworks,dc=com;ou=OU2,dc=hortonworks,dc=com;ou=OU3,dc=hortonworks,dc=com
- Multiple OUs are supported for both User based search and Group based search
- Incremental Sync -
- Ranger Usersync can be configured to perform full sync only during startup and incremental sync for the subsequent sync cycles.
- This is the default option for fresh installs of HDP version 2.6 onwards
- With this option, “Enable Group Sync” is mandatory
- This option is highly recommended in order to improve usersync performance and decrease the startup time of Ranger.
- Ranger Usersync can be configured to perform full sync from AD/LDAP for every sync cycle.
- This is the default option for clusters upgraded to 2.6 or higher
- “None” is the default option for case conversion
- This option must be configured to be same as the hdfs users/groups as ranger authorization is case sensitive for username and/or groupname.
- Ranger usersync properties for case conversion are:
- ranger.usersync.ldap.username.caseconversion
- ranger.usersync.ldap.groupname.caseconversion
- Ranger Usersync can be configured to perform username and/or groupname transformations in order to make them POSIX compliant.
- The value for these properties should be in the following format (similar to Sed format):“s/regex/replacement/g”s – stands for substitution and is mandatory/ - delimiter and is mandatoryRegex – regular expression to matchReplacement – value to replace and is optional. If not specified, the found pattern is removed from the resulting string.g – for replacing all the occurrences. It is optional and if not specified, default to “g” as well.
- In order to enable this feature, following properties should be added as custom usersync site properties in Ambari:
- ranger.usersync.mapping.username.handler - value as “org.apache.ranger.usergroupsync.RegEx”
- ranger.usersync.mapping.groupname.handler - value as “org.apache.ranger.usergroupsync.RegEx”
- ranger.usersync.mapping.username.regex - value must be in the format defined in section #b above
- ranger.usersync.mapping.groupname.regex - value must be in the format defined in #b above
- new regex properties can be added as: ranger.usersync.mapping.<attribute name>.<tranformation>.1, ranger.usersync.mapping.<attribute name>.<tranformation>.2, etc…
- All these transformations will be applied in the order they were configured.
- Ranger Usersync support both secure and non-secure communication to AD/LDAP server for performing the sync operation.
- Ranger usersync can be configure with LDAPS or STARTTLS for secure communication
- For LDAP/LDAPS, ldap url must be configured accordingly with the corresponding port. For example -
- For non-secure/LDAP communication, sample ldap url value is “ldap://10.10.10.10:389”
- For secure with LDAPS communication, sample ldap url value is “ldaps://ad.hortonworks.COM:636”
- Add “ranger.usersync.ldap.starttls” with value “true” in custom usersync site properties in Ambari
- Set LdapURL property to be in the format “ldap://10.10.10.10:389”

