LDAP user and group synchronization#

You can configure SEP to synchronize users and groups from an LDAP directory.

Starburst recommends LDAP provisioning instead of LDAP group mapping for synchronizing group membership.

Note

To synchronize identities using the SCIM protocol instead, see SCIM user and group synchronization.

Configuration#

To configure LDAP user and group synchronization, complete the following steps:

  • Configure an internal group provider in SEP

  • Enable LDAP user provisioning

  • Configure LDAP user provisioning properties

Configure an internal group provider#

SEP requires a group provider configuration to handle imported users and groups internally. Create an etc/group-provider.properties configuration file on the coordinator with the following contents:

group-provider.name=starburst

The SEP group provider includes an optional cache for user and group lookups, which is enabled by default. Disable the cache with the following property:

starburst-group-provider.cache.enabled=false

When you enable caching, the following optional properties are also available:

starburst-group-provider.cache.ttl=10s
starburst-group-provider.cache.maximum-size=1024

Enable LDAP user provisioning#

To enable LDAP user provisioning, add the following property to your coordinator’s config.properties file:

starburst.users.provisioning.type=LDAP

Configure LDAP user provisioning properties#

Set all LDAP user provisioning configuration properties in your config.properties file.

Configure the LDAP client connection using the same properties as the Trino LDAP password authenticator, but with the ldap-user-provisioning. prefix.

The following configuration properties are available:

LDAP user provisioning properties#

Property

Description

Required

Notes

ldap-user-provisioning.user-search-base

The base distinguished name (DN) for user searches

Yes

ldap-user-provisioning.user-search-filter

The LDAP search filter for locating user entries

Yes

For example, (objectClass=user) for Active Directory or (objectClass=inetOrgPerson) for OpenLDAP

ldap-user-provisioning.user-name-attribute

The LDAP attribute that contains the username

Yes

For example, sAMAccountName for Active Directory or uid for OpenLDAP

ldap-user-provisioning.user-unique-attribute

The LDAP attribute that contains a unique identifier for each user

No

For example, objectGUID for Active Directory or entryUUID for OpenLDAP

ldap-user-provisioning.group-search-base

The base distinguished name (DN) for group searches

Yes

ldap-user-provisioning.group-search-filter

The LDAP search filter for locating group entries

Yes

For example, (objectClass=group) for Active Directory or (objectClass=groupOfEntries) for OpenLDAP

ldap-user-provisioning.group-name-attribute

The LDAP attribute that contains the group name

Yes

For example, sAMAccountName for Active Directory or cn for OpenLDAP

ldap-user-provisioning.group-unique-attribute

The LDAP attribute that contains a unique identifier for each group

No

For example, objectGUID for Active Directory or entryUUID for OpenLDAP

ldap-user-provisioning.group-membership-attribute

The LDAP attribute on a group entry that lists its members

Yes

For example, member for Active Directory or OpenLDAP

ldap-user-provisioning.sync-interval

The frequency of synchronization. Defaults to 1h

No

Applies to all LDAP servers. See Use multiple LDAP servers.

ldap-user-provisioning.deletion-threshold-percent

The maximum percentage of users, and of groups, that a synchronization can delete. Defaults to 10

No

Applies to all LDAP servers.

ldap-user-provisioning.allow-mass-deletion

Set to true to disable the deletion threshold. Defaults to false

No

Applies to all LDAP servers.

ldap-user-provisioning.dry-run

Set to true to log the changes that a synchronization would make, without applying them. Defaults to false

No

Applies to all LDAP servers.

ldap-user-provisioning.identifier-mapping.pattern

The regular expression that transforms usernames and group names read from the LDAP attribute value.

No

For example, (.*). If identifier-mapping.file is set, don’t set this property.

ldap-user-provisioning.identifier-mapping.file

The path to a JSON file of identifier-mapping rules that transform usernames and group names read from the LDAP attribute value.

No

For example, etc/ldap-identifier-mapping.json. If identifier-mapping.pattern is set, don’t set this property.

ldap-user-provisioning.group.identifier-mapping.pattern

The regular expression that transforms group names read from the LDAP attribute value. It overrides identifier-mapping.pattern for groups.

No

If group.identifier-mapping.file is set, don’t set this property.

ldap-user-provisioning.group.identifier-mapping.file

The path to a JSON file of identifier-mapping rules that transform group names read from the LDAP attribute value. It overrides identifier-mapping.file for groups.

No

If group.identifier-mapping.pattern is set, don’t set this property.

The properties in this table configure one LDAP server, called default. To synchronize from more than one server, see Use multiple LDAP servers.

Caution

By default, synchronization keeps the original case of usernames and group names. To make all identifiers lowercase, create etc/ldap-identifier-mapping.json and set ldap-user-provisioning.identifier-mapping.file=etc/ldap-identifier-mapping.json.

{
  "rules": [
    { "pattern": "(.*)", "case": "lower" }
  ]
}

Use multiple LDAP servers#

You can synchronize users and groups from more than one LDAP server, for example when your users are in separate directories. Each server works independently. SEP records which server each user and group came from.

To add a server, give it a name that contains only letters, numbers, underscores, and hyphens. Then set the properties of that server with the prefix ldap-user-provisioning.<name>. instead of ldap-user-provisioning.. This includes the LDAP client connection properties, the search properties, and the identifier mapping properties. The following example configures two servers, corp and partners:

starburst.users.provisioning.type=LDAP
ldap-user-provisioning.corp.ldap.url=ldaps://ldap-corp:636
ldap-user-provisioning.corp.ldap.bind-user=cn=service-account,dc=corp,dc=example,dc=com
ldap-user-provisioning.corp.ldap.bind-password=<BIND_PASSWORD>
ldap-user-provisioning.corp.user-search-base=ou=people,dc=corp,dc=example,dc=com
ldap-user-provisioning.corp.user-search-filter=(objectClass=inetOrgPerson)
ldap-user-provisioning.corp.user-name-attribute=uid
ldap-user-provisioning.corp.group-search-base=ou=groups,dc=corp,dc=example,dc=com
ldap-user-provisioning.corp.group-search-filter=(objectClass=groupOfNames)
ldap-user-provisioning.corp.group-name-attribute=cn
ldap-user-provisioning.corp.group-membership-attribute=member

ldap-user-provisioning.partners.ldap.url=ldaps://ldap-partners:636
ldap-user-provisioning.partners.ldap.bind-user=cn=service-account,dc=partners,dc=example,dc=com
ldap-user-provisioning.partners.ldap.bind-password=<BIND_PASSWORD>
ldap-user-provisioning.partners.user-search-base=ou=people,dc=partners,dc=example,dc=com
ldap-user-provisioning.partners.user-search-filter=(objectClass=user)
ldap-user-provisioning.partners.user-name-attribute=sAMAccountName
ldap-user-provisioning.partners.group-search-base=ou=groups,dc=partners,dc=example,dc=com
ldap-user-provisioning.partners.group-search-filter=(objectClass=group)
ldap-user-provisioning.partners.group-name-attribute=sAMAccountName
ldap-user-provisioning.partners.group-membership-attribute=member

The properties without a name configure a server called default. You can use the default server together with named servers. Do not define the default server in both forms, with ldap-user-provisioning.ldap.url and with ldap-user-provisioning.default.ldap.url. SEP fails to start if you do.

The synchronization settings apply to all servers. These settings are sync-interval, deletion-threshold-percent, allow-mass-deletion, and dry-run. Set them once, without a server name.

How multiple servers work#

  • Each server synchronizes on its own. If a synchronization fails or stops on one server, the other servers continue.

  • SEP removes only the users and groups that came from the server that no longer lists them.

  • SEP detects conflicts. One server cannot change a user or group that came from another server.

Map group names separately#

By default, the identifier mapping of a server applies to both usernames and group names. To map group names differently, set group.identifier-mapping.pattern or group.identifier-mapping.file for the server. For a named server, the full property name is, for example, ldap-user-provisioning.corp.group.identifier-mapping.pattern. These properties override the general identifier mapping for groups.

Move accounts to another server#

If you replace or rename a server, use the ldap-user-provisioning.adopt-sources property. The new server then takes over the users and groups of the old server, and it keeps their accounts.

Set the property to a comma-separated list of <from>:<to> pairs. For example, the following value moves the accounts of the default server to the corp server:

ldap-user-provisioning.adopt-sources=default:corp

SEP removes adopted accounts that the new server does not list. The deletion threshold limits how many accounts it can remove.

Do not chain adoption. Map each old server directly to its final server. For example, do not set a:b,b:c. SEP rejects this configuration, and a pair that maps a server to itself.

Examples#

The following examples show complete config.properties configurations for LDAP user provisioning.

Secure LDAP connection (LDAPS)#

The following example configures LDAP user provisioning over a secure TLS connection:

starburst.users.provisioning.type=LDAP
ldap-user-provisioning.ldap.url=ldaps://ldapserver:636
ldap-user-provisioning.ldap.ssl.keystore.path=/etc/openldap/certs/trino-coordinator-for-ldap.pem
ldap-user-provisioning.ldap.ssl.truststore.path=/etc/openldap/certs/openldap-certificate.pem
ldap-user-provisioning.ldap.bind-user=cn=admin,dc=trino,dc=testldap,dc=com
ldap-user-provisioning.ldap.bind-password=admin
ldap-user-provisioning.user-search-base=dc=trino,dc=testldap,dc=com
ldap-user-provisioning.user-search-filter=(objectClass=inetOrgPerson)
ldap-user-provisioning.user-name-attribute=cn
ldap-user-provisioning.group-search-base=dc=trino,dc=testldap,dc=com
ldap-user-provisioning.group-search-filter=(objectClass=groupOfNames)
ldap-user-provisioning.group-name-attribute=cn
ldap-user-provisioning.group-membership-attribute=member

Insecure LDAP connection#

The following example configures LDAP user provisioning over an insecure connection. Only use this configuration for testing or development environments:

starburst.users.provisioning.type=LDAP
ldap-user-provisioning.ldap.allow-insecure=true
ldap-user-provisioning.ldap.url=ldap://ldapserver:389
ldap-user-provisioning.ldap.bind-user=cn=admin,dc=trino,dc=testldap,dc=com
ldap-user-provisioning.ldap.bind-password=admin
ldap-user-provisioning.user-search-base=dc=trino,dc=testldap,dc=com
ldap-user-provisioning.user-search-filter=(objectClass=inetOrgPerson)
ldap-user-provisioning.user-name-attribute=cn
ldap-user-provisioning.group-search-base=dc=trino,dc=testldap,dc=com
ldap-user-provisioning.group-search-filter=(objectClass=groupOfNames)
ldap-user-provisioning.group-name-attribute=cn
ldap-user-provisioning.group-membership-attribute=member
ldap-user-provisioning.sync-interval=30m