About configuring LDAP sync
Review how LDAP group sync works and what the sync configuration file contains so you can configure group sync for your LDAP schema.
Before you can run LDAP sync, you need a sync configuration file. This file contains the following LDAP client configuration details:
-
Configuration for connecting to your LDAP server.
-
Sync configuration options that are dependent on the schema used in your LDAP server.
-
An administrator-defined list of name mappings that maps Red Hat OpenShift Container Platform group names to groups in your LDAP server.
The format of the configuration file depends upon the schema you are using:
-
RFC 2307
-
Active Directory
-
augmented Active Directory.
LDAP client configuration
The LDAP client configuration section of the configuration defines the connections to your LDAP server. The following example shows the LDAP client configuration fields:
url: ldap://10.0.0.0:389
bindDN: cn=admin,dc=example,dc=com
bindPassword: <password>
insecure: false
ca: my-ldap-ca-bundle.crt
-
The
urlfield shows the connection protocol, IP address of the LDAP server hosting your database, and the port to connect to, formatted asscheme://host:port. -
The
bindDNfield shows an optional distinguished name (DN) to use as the Bind DN. Red Hat OpenShift Container Platform uses this if elevated privilege is required to retrieve entries for the sync operation. -
The
bindPasswordfield shows an optional password to use to bind. Red Hat OpenShift Container Platform uses this if elevated privilege is necessary to retrieve entries for the sync operation. This value may also be provided in an environment variable, external file, or encrypted file. -
The
insecurefield controls whether the LDAP connection uses TLS. When set tofalse,ldaps://URLs connect to the server using TLS, andldap://URLs are upgraded to TLS. When set totrue, no TLS connection is made to the server, and you cannot useldaps://URL schemes. -
The
cafield shows the certificate bundle to use for validating server certificates for the configured URL. If empty, Red Hat OpenShift Container Platform uses system-trusted roots. This only applies ifinsecureis set tofalse.
LDAP query definition
Sync configurations consist of LDAP query definitions for the entries that are required for synchronization. The specific definition of an LDAP query depends on the schema used to store membership information in the LDAP server. The following example shows the LDAP query definition fields:
baseDN: ou=users,dc=example,dc=com
scope: sub
derefAliases: never
timeout: 0
filter: (objectClass=person)
pageSize: 0
-
The
baseDNfield contains the distinguished name (DN) of the branch of the directory where all searches start from. It is required that you specify the top of your directory tree, but you can also specify a subtree in the directory. -
The
scopefield shows the search scope. Valid values arebase,one, andsub. If you omit this field, the default issub. For descriptions of each value, see Table 1, LDAP search scope options. -
The
derefAliasesfield shows the behavior of the search with respect to aliases in the LDAP tree. Valid values arenever,search,base, oralways. If this is left undefined, then the default is toalwaysdereference aliases. Descriptions of the dereferencing behaviors are in Table 2, LDAP dereferencing behaviors. -
The
timeoutfield shows the time limit allowed for the search by the client, in seconds. A value of0imposes no client-side limit. -
The
filterfield contains a valid LDAP search filter. If this is left undefined, then the default is(objectClass=*). -
The
pageSizefield shows the maximum number of LDAP entries the server returns per page. If set to0, no page size limit applies. Set this field when a query returns more entries than the client or server allow by default.
| LDAP search scope | Description |
|---|---|
|
Only consider the object specified by the base DN given for the query. |
|
Consider all of the objects on the same level in the tree as the base DN for the query. |
|
Consider the entire subtree rooted at the base DN given for the query. |
| Dereferencing behavior | Description |
|---|---|
|
Never dereference any aliases found in the LDAP tree. |
|
Only dereference aliases found while searching. |
|
Only dereference aliases while finding the base object. |
|
Always dereference all aliases found in the LDAP tree. |
User-defined name mapping
A user-defined name mapping explicitly maps the names of Red Hat OpenShift Container Platform groups to unique identifiers that find groups on your LDAP server. The mapping uses normal YAML syntax. A user-defined mapping can contain an entry for every group in your LDAP server or only a subset of those groups. If there are groups on the LDAP server that do not have a user-defined name mapping, the default behavior during sync is to use the attribute specified as the name of the Red Hat OpenShift Container Platform group.
The following example shows a user-defined name mapping:
groupUIDNameMapping:
"cn=group1,ou=groups,dc=example,dc=com": firstgroup
"cn=group2,ou=groups,dc=example,dc=com": secondgroup
"cn=group3,ou=groups,dc=example,dc=com": thirdgroup
About the RFC 2307 configuration file
Review the RFC 2307 LDAP sync configuration file so you can define user and group queries and the attributes used in Red Hat OpenShift Container Platform group records.
The RFC 2307 schema requires you to provide an LDAP query definition for both user and group entries, as well as the attributes with which to represent them in the internal Red Hat OpenShift Container Platform records.
For clarity, the group you create in Red Hat OpenShift Container Platform should use attributes other than the distinguished name whenever possible for user-facing or administrator-facing fields. For example, identify the users of an Red Hat OpenShift Container Platform group by their e-mail, and use the name of the group as the common name. The following configuration file creates these relationships:
|
|
If using user-defined name mappings, your configuration file differs. |
kind: LDAPSyncConfig
apiVersion: v1
url: ldap://LDAP_SERVICE_IP:389
insecure: false
bindDN: cn=admin,dc=example,dc=com
bindPassword:
file: "/etc/secrets/bindPassword"
rfc2307:
groupsQuery:
baseDN: "ou=groups,dc=example,dc=com"
scope: sub
derefAliases: never
pageSize: 0
groupUIDAttribute: dn
groupNameAttributes: [ cn ]
groupMembershipAttributes: [ member ]
usersQuery:
baseDN: "ou=users,dc=example,dc=com"
scope: sub
derefAliases: never
pageSize: 0
userUIDAttribute: dn
userNameAttributes: [ mail ]
tolerateMemberNotFoundErrors: false
tolerateMemberOutOfScopeErrors: false
where:
url-
Specifies the IP address and host of the LDAP server where the record of the group is stored.
insecure-
Specifies whether the LDAP connection uses TLS. When set to
false,ldaps://URLs connect to the server using TLS, andldap://URLs are upgraded to TLS. When set totrue, no TLS connection is made to the server, and you cannot useldaps://URL schemes. rfc2307.groupUIDAttribute-
Specifies the attribute that uniquely identifies a group on the LDAP server. You cannot specify
groupsQueryfilters when using DN forgroupUIDAttribute. For fine-grained filtering, use an allowlist file, a denylist file, or both. rfc2307.groupNameAttributes-
Specifies the attribute to use as the name of the group.
rfc2307.groupMembershipAttributes-
Specifies the attribute on the group that stores the membership information.
rfc2307.userUIDAttribute-
Specifies the attribute that uniquely identifies a user on the LDAP server. You cannot specify
usersQueryfilters when using DN for userUIDAttribute. For fine-grained filtering, use an allowlist file, a denylist file, or both. rfc2307.userNameAttributes-
Specifies the attribute to use as the name of the user in the Red Hat OpenShift Container Platform group record.
About the Active Directory configuration file
Review the Active Directory LDAP sync configuration file so you can define user queries and the attributes used in Red Hat OpenShift Container Platform group records.
The Active Directory schema requires you to provide an LDAP query definition for user entries, as well as the attributes to represent them with in the internal Red Hat OpenShift Container Platform group records.
For clarity, the group you create in Red Hat OpenShift Container Platform should use attributes other than the distinguished name whenever possible for user-facing or administrator-facing fields. For example, identify the users of an Red Hat OpenShift Container Platform group by their e-mail, but define the name of the group by the name of the group on the LDAP server. The following configuration file creates these relationships:
kind: LDAPSyncConfig
apiVersion: v1
url: ldap://LDAP_SERVICE_IP:389
activeDirectory:
usersQuery:
baseDN: "ou=users,dc=example,dc=com"
scope: sub
derefAliases: never
filter: (objectclass=person)
pageSize: 0
userNameAttributes: [ mail ]
groupMembershipAttributes: [ memberOf ]
where:
activeDirectory.userNameAttributes-
Specifies the attribute to use as the name of the user in the Red Hat OpenShift Container Platform group record.
activeDirectory.groupMembershiptAttributes-
Specifies the attribute on the user that stores the membership information.
About the augmented Active Directory configuration file
Review the augmented Active Directory LDAP sync configuration file so you can define user and group queries and the attributes used in Red Hat OpenShift Container Platform group records.
The augmented Active Directory schema requires you to provide an LDAP query definition for both user entries and group entries, as well as the attributes with which to represent them in the internal Red Hat OpenShift Container Platform group records.
For clarity, the group you create in Red Hat OpenShift Container Platform should use attributes other than the distinguished name whenever possible for user-facing or administrator-facing fields. For example, identify the users of an Red Hat OpenShift Container Platform group by their e-mail, and use the name of the group as the common name. The following configuration file creates these relationships.
kind: LDAPSyncConfig
apiVersion: v1
url: ldap://LDAP_SERVICE_IP:389
augmentedActiveDirectory:
groupsQuery:
baseDN: "ou=groups,dc=example,dc=com"
scope: sub
derefAliases: never
pageSize: 0
groupUIDAttribute: dn
groupNameAttributes: [ cn ]
usersQuery:
baseDN: "ou=users,dc=example,dc=com"
scope: sub
derefAliases: never
filter: (objectclass=person)
pageSize: 0
userNameAttributes: [ mail ]
groupMembershipAttributes: [ memberOf ]
where:
augmentedActiveDirectory.groupUIDAttribute-
Specifies the attribute that uniquely identifies a group on the LDAP server. You cannot specify
groupsQueryfilters when using DN for groupUIDAttribute. For fine-grained filtering, use an allowlist file, a denylist file, or both. augmentedActiveDirectory.groupNameAttributes-
Specifies the attribute to use as the name of the group.
augmentedActiveDirectory.userNameAttributes-
Specifies the attribute to use as the name of the user in the Red Hat OpenShift Container Platform group record.
augmentedActiveDirectory.groupMembershipAttributes-
Specifies the attribute on the user that stores the membership information.