url: ldap://10.0.0.0:389 (1)
bindDN: cn=admin,dc=example,dc=com (2)
bindPassword: <password> (3)
insecure: false (4)
ca: my-ldap-ca-bundle.crt (5)
作为拥有 `dedicated-admin` 角色的管理员,您可以使用组来管理用户、更改其权限并增强协作。您的组织可能已经创建了用户组并将它们存储在 LDAP 服务器中。OpenShift Dedicated 可以将这些 LDAP 记录与内部 OpenShift Dedicated 记录同步,使您能够在一个位置管理您的组。OpenShift Dedicated 当前支持使用三种常用的定义组成员资格的模式与 LDAP 服务器同步组:RFC 2307、Active Directory 和增强的 Active Directory。
有关配置 LDAP 的更多信息,请参见 配置 LDAP 身份提供程序。
您必须拥有 `dedicated-admin` 权限才能同步组。 |
在运行 LDAP 同步之前,您需要一个同步配置文件。此文件包含以下 LDAP 客户端配置详细信息
连接到 LDAP 服务器的配置。
取决于 LDAP 服务器中使用的模式的同步配置选项。
管理员定义的名称映射列表,将 OpenShift Dedicated 组名映射到 LDAP 服务器中的组。
配置文件的格式取决于您使用的模式:RFC 2307、Active Directory 或增强的 Active Directory。
配置的 LDAP 客户端配置部分定义了与 LDAP 服务器的连接。
配置的 LDAP 客户端配置部分定义了与 LDAP 服务器的连接。
url: ldap://10.0.0.0:389 (1)
bindDN: cn=admin,dc=example,dc=com (2)
bindPassword: <password> (3)
insecure: false (4)
ca: my-ldap-ca-bundle.crt (5)
1 | 连接协议、承载数据库的 LDAP 服务器的 IP 地址以及连接端口,格式为scheme://host:port 。 |
2 | 可选的区分名称 (DN),用作绑定 DN。如果需要提升的权限来检索同步操作的条目,OpenShift Dedicated 将使用此名称。 |
3 | 可选的绑定密码。如果需要提升的权限来检索同步操作的条目,OpenShift Dedicated 将使用此密码。此值也可以在环境变量、外部文件或加密文件中提供。 |
4 | 当值为false 时,安全 LDAP (ldaps:// ) URL 使用 TLS 连接,不安全 LDAP (ldap:// ) URL 将升级到 TLS。当值为true 时,不会与服务器建立 TLS 连接,并且您无法使用ldaps:// URL 方案。 |
5 | 用于验证已配置 URL 的服务器证书的证书包。如果为空,OpenShift Dedicated 将使用系统信任的根证书。这仅在insecure 设置为false 时适用。 |
同步配置包含需要同步条目的 LDAP 查询定义。LDAP 查询的具体定义取决于用于在 LDAP 服务器中存储成员信息模式。
baseDN: ou=users,dc=example,dc=com (1)
scope: sub (2)
derefAliases: never (3)
timeout: 0 (4)
filter: (objectClass=person) (5)
pageSize: 0 (6)
1 | 目录分支的区分名称 (DN),所有搜索都将从此处开始。您需要指定目录树的顶部,但也可以指定目录中的子树。 |
2 | 搜索范围。有效值为base 、one 或sub 。如果未定义此值,则假定范围为sub 。下表中提供了范围选项的描述。 |
3 | 搜索相对于 LDAP 树中别名的行为。有效值为never 、search 、base 或always 。如果未定义此值,则默认为always 取消别名引用。下表中提供了取消引用行为的描述。 |
4 | 客户端允许的搜索时间限制(以秒为单位)。值为0 表示没有客户端限制。 |
5 | 有效的 LDAP 搜索过滤器。如果未定义此值,则默认为(objectClass=*) 。 |
6 | 来自服务器的响应页面的可选最大大小(以 LDAP 条目为单位)。如果设置为0 ,则不会对响应页面的大小进行任何限制。当查询返回的条目多于客户端或服务器默认允许的数量时,需要设置分页大小。 |
LDAP 搜索范围 | 描述 |
---|---|
|
仅考虑查询给定的 base DN 指定的对象。 |
|
考虑与查询的 base DN 在树中位于同一级别的所有对象。 |
|
考虑查询给定的 base DN 为根的整个子树。 |
取消引用行为 | 描述 |
---|---|
|
从不取消引用在 LDAP 树中找到的任何别名。 |
|
仅取消引用在搜索过程中找到的别名。 |
|
仅在查找 base 对象时取消引用别名。 |
|
始终取消引用在 LDAP 树中找到的所有别名。 |
用户定义的名称映射将 OpenShift Dedicated 组的名称显式映射到在您的 LDAP 服务器上查找组的唯一标识符。映射使用标准 YAML 语法。用户定义的映射可以包含 LDAP 服务器中每个组的条目,也可以只包含这些组的子集。如果 LDAP 服务器上存在没有用户定义名称映射的组,则同步期间的默认行为是使用指定为 OpenShift Dedicated 组名称的属性。
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
RFC 2307 模式要求您为用户和组条目提供 LDAP 查询定义,以及在内部 OpenShift Dedicated 记录中表示它们的属性。
为清楚起见,您在 OpenShift Dedicated 中创建的组应尽可能使用除区分名称以外的属性作为用户或管理员可见的字段。例如,使用其电子邮件标识 OpenShift Dedicated 组的用户,并使用组的名称作为通用名称。以下配置文件创建了这些关系
如果使用用户定义的名称映射,您的配置文件将有所不同。 |
rfc2307_config.yaml
kind: LDAPSyncConfig
apiVersion: v1
url: ldap://LDAP_SERVICE_IP:389 (1)
insecure: false (2)
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 (3)
groupNameAttributes: [ cn ] (4)
groupMembershipAttributes: [ member ] (5)
usersQuery:
baseDN: "ou=users,dc=example,dc=com"
scope: sub
derefAliases: never
pageSize: 0
userUIDAttribute: dn (6)
userNameAttributes: [ mail ] (7)
tolerateMemberNotFoundErrors: false
tolerateMemberOutOfScopeErrors: false
1 | 存储此组记录的 LDAP 服务器的 IP 地址和主机。 |
2 | 当值为false 时,安全 LDAP (ldaps:// ) URL 使用 TLS 连接,不安全 LDAP (ldap:// ) URL 将升级到 TLS。当值为true 时,不会与服务器建立 TLS 连接,并且您无法使用ldaps:// URL 方案。 |
3 | 唯一标识 LDAP 服务器上组的属性。使用 DN 作为groupUIDAttribute 时,不能指定groupsQuery 过滤器。对于细粒度过滤,请使用白名单/黑名单方法。 |
4 | 用作组名称的属性。 |
5 | 存储成员信息的组上的属性。 |
6 | 唯一标识 LDAP 服务器上用户的属性。使用 DN 作为 userUIDAttribute 时,不能指定 usersQuery 过滤器。对于细粒度过滤,请使用白名单/黑名单方法。 |
7 | 用作 OpenShift Dedicated 组记录中用户名属性。 |
Active Directory 模式要求您为用户条目提供 LDAP 查询定义,以及在内部 OpenShift Dedicated 组记录中表示它们的属性。
为清楚起见,您在 OpenShift Dedicated 中创建的组应尽可能使用除区分名称以外的属性作为用户或管理员可见的字段。例如,使用其电子邮件标识 OpenShift Dedicated 组的用户,但使用 LDAP 服务器上组的名称定义组的名称。以下配置文件创建了这些关系
active_directory_config.yaml
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 ] (1)
groupMembershipAttributes: [ memberOf ] (2)
1 | 用作 OpenShift Dedicated 组记录中用户名属性。 |
2 | 存储成员信息的用户信息属性。 |
增强的 Active Directory 模式要求您为用户条目和组条目提供 LDAP 查询定义,以及在内部 OpenShift Dedicated 组记录中表示它们的属性。
为清楚起见,您在 OpenShift Dedicated 中创建的组应尽可能使用除区分名称以外的属性作为用户或管理员可见的字段。例如,使用其电子邮件标识 OpenShift Dedicated 组的用户,并使用组的名称作为通用名称。以下配置文件创建了这些关系。
augmented_active_directory_config.yaml
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 (1)
groupNameAttributes: [ cn ] (2)
usersQuery:
baseDN: "ou=users,dc=example,dc=com"
scope: sub
derefAliases: never
filter: (objectclass=person)
pageSize: 0
userNameAttributes: [ mail ] (3)
groupMembershipAttributes: [ memberOf ] (4)
1 | 唯一标识 LDAP 服务器上组的属性。使用 DN 作为 groupUIDAttribute 时,不能指定 groupsQuery 过滤器。对于细粒度过滤,请使用白名单/黑名单方法。 |
2 | 用作组名称的属性。 |
3 | 用作 OpenShift Dedicated 组记录中用户名属性。 |
4 | 存储成员信息的用户信息属性。 |
创建同步配置文件后,您可以开始同步。OpenShift Dedicated 允许管理员对同一服务器执行多种不同的同步类型。
您可以将 LDAP 服务器上的所有组与 OpenShift Dedicated 同步。
创建一个同步配置文件。
您具有作为具有dedicated-admin
角色的用户访问集群的权限。
将 LDAP 服务器上的所有组与 OpenShift Dedicated 同步
$ oc adm groups sync --sync-config=config.yaml --confirm
默认情况下,所有组同步操作都是试运行,因此您必须在 |
您可以同步 OpenShift Dedicated 中已存在的所有组,这些组对应于配置文件中指定的 LDAP 服务器中的组。
创建一个同步配置文件。
您具有作为具有dedicated-admin
角色的用户访问集群的权限。
将 OpenShift Dedicated 组与 LDAP 服务器同步
$ oc adm groups sync --type=openshift --sync-config=config.yaml --confirm
默认情况下,所有组同步操作都是试运行,因此您必须在 |
您可以使用白名单文件、黑名单文件或两者结合来同步OpenShift Dedicated与LDAP服务器的部分组。
您可以组合使用黑名单文件、白名单文件或白名单字面量。白名单和黑名单文件每行必须包含一个唯一的组标识符,您可以在命令中直接包含白名单字面量。这些准则适用于LDAP服务器上找到的组以及OpenShift Dedicated中已存在的组。 |
创建一个同步配置文件。
您具有作为具有dedicated-admin
角色的用户访问集群的权限。
要同步OpenShift Dedicated与LDAP服务器的部分组,请使用以下任何命令:
$ oc adm groups sync --whitelist=<whitelist_file> \
--sync-config=config.yaml \
--confirm
$ oc adm groups sync --blacklist=<blacklist_file> \
--sync-config=config.yaml \
--confirm
$ oc adm groups sync <group_unique_identifier> \
--sync-config=config.yaml \
--confirm
$ oc adm groups sync <group_unique_identifier> \
--whitelist=<whitelist_file> \
--blacklist=<blacklist_file> \
--sync-config=config.yaml \
--confirm
$ oc adm groups sync --type=openshift \
--whitelist=<whitelist_file> \
--sync-config=config.yaml \
--confirm
默认情况下,所有组同步操作都是试运行,因此您必须在 |
管理员还可以选择从OpenShift Dedicated记录中删除组,如果创建这些记录的LDAP服务器上的记录不再存在。修剪作业将接受与同步作业相同的同步配置文件以及白名单或黑名单。
例如
$ oc adm prune groups --sync-config=/path/to/ldap-sync-config.yaml --confirm
$ oc adm prune groups --whitelist=/path/to/whitelist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
$ oc adm prune groups --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
本节包含RFC 2307、Active Directory和增强型Active Directory模式的示例。
这些示例假设所有用户都是其各自组的直接成员。具体来说,没有组将其他组作为成员。有关如何同步嵌套组的信息,请参阅嵌套成员资格同步示例。 |
对于RFC 2307模式,以下示例同步名为admins
的组,该组有两个成员:Jane
和Jim
。这些示例说明:
如何在LDAP服务器上添加组和用户。
同步后OpenShift Dedicated中的结果组记录是什么。
这些示例假设所有用户都是其各自组的直接成员。具体来说,没有组将其他组作为成员。有关如何同步嵌套组的信息,请参阅嵌套成员资格同步示例。 |
在RFC 2307模式中,用户(Jane和Jim)和组都作为一等实体存在于LDAP服务器上,并且组成员资格存储在组上的属性中。以下ldif
代码段定义了此模式的用户和组:
rfc2307.ldif
dn: ou=users,dc=example,dc=com
objectClass: organizationalUnit
ou: users
dn: cn=Jane,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Jane
sn: Smith
displayName: Jane Smith
mail: [email protected]
dn: cn=Jim,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Jim
sn: Adams
displayName: Jim Adams
mail: [email protected]
dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: groups
dn: cn=admins,ou=groups,dc=example,dc=com (1)
objectClass: groupOfNames
cn: admins
owner: cn=admin,dc=example,dc=com
description: System Administrators
member: cn=Jane,ou=users,dc=example,dc=com (2)
member: cn=Jim,ou=users,dc=example,dc=com
1 | 该组是LDAP服务器中的一等实体。 |
2 | 组成员列在其属性上,并带有标识性引用。 |
创建配置文件。
您具有作为具有dedicated-admin
角色的用户访问集群的权限。
使用rfc2307_config.yaml
文件运行同步。
$ oc adm groups sync --sync-config=rfc2307_config.yaml --confirm
OpenShift Dedicated创建以下组记录作为上述同步操作的结果:
rfc2307_config.yaml
文件创建的OpenShift Dedicated组apiVersion: user.openshift.io/v1
kind: Group
metadata:
annotations:
openshift.io/ldap.sync-time: 2015-10-13T10:08:38-0400 (1)
openshift.io/ldap.uid: cn=admins,ou=groups,dc=example,dc=com (2)
openshift.io/ldap.url: LDAP_SERVER_IP:389 (3)
creationTimestamp:
name: admins (4)
users: (5)
- [email protected]
- [email protected]
1 | 此OpenShift Dedicated组上次与LDAP服务器同步的时间(ISO 6801格式)。 |
2 | LDAP服务器上组的唯一标识符。 |
3 | 存储此组记录的 LDAP 服务器的 IP 地址和主机。 |
4 | 同步文件指定的组名称。 |
5 | 作为组成员的用户,名称由同步文件指定。 |
使用用户定义的名称映射同步组时,配置文件会更改为包含如下所示的这些映射。
rfc2307_config_user_defined.yaml
kind: LDAPSyncConfig
apiVersion: v1
groupUIDNameMapping:
"cn=admins,ou=groups,dc=example,dc=com": Administrators (1)
rfc2307:
groupsQuery:
baseDN: "ou=groups,dc=example,dc=com"
scope: sub
derefAliases: never
pageSize: 0
groupUIDAttribute: dn (2)
groupNameAttributes: [ cn ] (3)
groupMembershipAttributes: [ member ]
usersQuery:
baseDN: "ou=users,dc=example,dc=com"
scope: sub
derefAliases: never
pageSize: 0
userUIDAttribute: dn (4)
userNameAttributes: [ mail ]
tolerateMemberNotFoundErrors: false
tolerateMemberOutOfScopeErrors: false
1 | 用户定义的名称映射。 |
2 | 用于用户定义名称映射中键的唯一标识符属性。使用DN作为groupUIDAttribute时,不能指定groupsQuery 过滤器。对于细粒度的过滤,请使用白名单/黑名单方法。 |
3 | 如果其唯一标识符不在用户定义的名称映射中,则用于命名OpenShift Dedicated组的属性。 |
4 | 唯一标识 LDAP 服务器上用户的属性。使用 DN 作为 userUIDAttribute 时,不能指定 usersQuery 过滤器。对于细粒度过滤,请使用白名单/黑名单方法。 |
创建配置文件。
您具有作为具有dedicated-admin
角色的用户访问集群的权限。
使用rfc2307_config_user_defined.yaml
文件运行同步。
$ oc adm groups sync --sync-config=rfc2307_config_user_defined.yaml --confirm
OpenShift Dedicated创建以下组记录作为上述同步操作的结果:
rfc2307_config_user_defined.yaml
文件创建的OpenShift Dedicated组apiVersion: user.openshift.io/v1
kind: Group
metadata:
annotations:
openshift.io/ldap.sync-time: 2015-10-13T10:08:38-0400
openshift.io/ldap.uid: cn=admins,ou=groups,dc=example,dc=com
openshift.io/ldap.url: LDAP_SERVER_IP:389
creationTimestamp:
name: Administrators (1)
users:
- [email protected]
- [email protected]
1 | 用户定义的名称映射指定的组名称。 |
默认情况下,如果要同步的组包含其条目在成员查询中定义的范围之外的成员,则组同步将失败并出现错误。
Error determining LDAP group membership for "<group>": membership lookup for user "<user>" in group "<group>" failed because of "search for entry with dn="<user-dn>" would search outside of the base dn specified (dn="<base-dn>")".
这通常表示usersQuery
字段中的baseDN
配置错误。但是,在baseDN
有意不包含组的某些成员的情况下,设置tolerateMemberOutOfScopeErrors: true
允许组同步继续。范围外的成员将被忽略。
同样,当组同步过程无法找到组的成员时,它将直接失败并出现错误。
Error determining LDAP group membership for "<group>": membership lookup for user "<user>" in group "<group>" failed because of "search for entry with base dn="<user-dn>" refers to a non-existent entry". Error determining LDAP group membership for "<group>": membership lookup for user "<user>" in group "<group>" failed because of "search for entry with base dn="<user-dn>" and filter "<filter>" did not return any results".
这通常表示usersQuery
字段配置错误。但是,在组包含已知缺失的成员条目的情况下,设置tolerateMemberNotFoundErrors: true
允许组同步继续。有问题的成员将被忽略。
启用LDAP组同步的容错率会导致同步过程忽略有问题的成员条目。如果LDAP组同步配置不正确,这可能会导致同步的OpenShift Dedicated组缺少成员。 |
rfc2307_problematic_users.ldif
dn: ou=users,dc=example,dc=com
objectClass: organizationalUnit
ou: users
dn: cn=Jane,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Jane
sn: Smith
displayName: Jane Smith
mail: [email protected]
dn: cn=Jim,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Jim
sn: Adams
displayName: Jim Adams
mail: [email protected]
dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: groups
dn: cn=admins,ou=groups,dc=example,dc=com
objectClass: groupOfNames
cn: admins
owner: cn=admin,dc=example,dc=com
description: System Administrators
member: cn=Jane,ou=users,dc=example,dc=com
member: cn=Jim,ou=users,dc=example,dc=com
member: cn=INVALID,ou=users,dc=example,dc=com (1)
member: cn=Jim,ou=OUTOFSCOPE,dc=example,dc=com (2)
1 | LDAP服务器上不存在的成员。 |
2 | 可能存在的成员,但不属于同步作业的用户查询中的baseDN 。 |
要容忍上述示例中的错误,必须对同步配置文件进行以下更改:
rfc2307_config_tolerating.yaml
kind: LDAPSyncConfig
apiVersion: v1
url: ldap://LDAP_SERVICE_IP:389
rfc2307:
groupsQuery:
baseDN: "ou=groups,dc=example,dc=com"
scope: sub
derefAliases: never
groupUIDAttribute: dn
groupNameAttributes: [ cn ]
groupMembershipAttributes: [ member ]
usersQuery:
baseDN: "ou=users,dc=example,dc=com"
scope: sub
derefAliases: never
userUIDAttribute: dn (1)
userNameAttributes: [ mail ]
tolerateMemberNotFoundErrors: true (2)
tolerateMemberOutOfScopeErrors: true (3)
1 | 唯一标识 LDAP 服务器上用户的属性。使用 DN 作为 userUIDAttribute 时,不能指定 usersQuery 过滤器。对于细粒度过滤,请使用白名单/黑名单方法。 |
2 | 当为true 时,同步作业会容忍找不到某些成员的组,并且忽略找不到其LDAP条目的成员。同步作业的默认行为是在找不到组的成员时失败。 |
3 | 当为true 时,同步作业会容忍某些成员位于usersQuery 基本DN中给定的用户范围之外的组,并且忽略成员查询范围之外的成员。同步作业的默认行为是在成员超出范围时失败。 |
创建配置文件。
您具有作为具有dedicated-admin
角色的用户访问集群的权限。
使用rfc2307_config_tolerating.yaml
文件运行同步。
$ oc adm groups sync --sync-config=rfc2307_config_tolerating.yaml --confirm
OpenShift Dedicated创建以下组记录作为上述同步操作的结果:
rfc2307_config.yaml
文件创建的OpenShift Dedicated组apiVersion: user.openshift.io/v1
kind: Group
metadata:
annotations:
openshift.io/ldap.sync-time: 2015-10-13T10:08:38-0400
openshift.io/ldap.uid: cn=admins,ou=groups,dc=example,dc=com
openshift.io/ldap.url: LDAP_SERVER_IP:389
creationTimestamp:
name: admins
users: (1)
- [email protected]
- [email protected]
1 | 作为组成员的用户,由同步文件指定。查找遇到可容忍错误的成员不存在。 |
在Active Directory模式中,用户(Jane和Jim)都作为一等实体存在于LDAP服务器上,并且组成员资格存储在用户的属性中。以下ldif
代码段定义了此模式的用户和组:
active_directory.ldif
dn: ou=users,dc=example,dc=com
objectClass: organizationalUnit
ou: users
dn: cn=Jane,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: testPerson
cn: Jane
sn: Smith
displayName: Jane Smith
mail: [email protected]
memberOf: admins (1)
dn: cn=Jim,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: testPerson
cn: Jim
sn: Adams
displayName: Jim Adams
mail: [email protected]
memberOf: admins
1 | 用户的组成员资格列在用户属性中,组在服务器上不存在作为条目。memberOf 属性不必是用户上的字面量属性;在某些LDAP服务器中,它是在搜索期间创建的并返回给客户端,但不会提交到数据库。 |
创建配置文件。
您具有作为具有dedicated-admin
角色的用户访问集群的权限。
使用active_directory_config.yaml
文件运行同步。
$ oc adm groups sync --sync-config=active_directory_config.yaml --confirm
OpenShift Dedicated创建以下组记录作为上述同步操作的结果:
active_directory_config.yaml
文件创建的OpenShift Dedicated组apiVersion: user.openshift.io/v1
kind: Group
metadata:
annotations:
openshift.io/ldap.sync-time: 2015-10-13T10:08:38-0400 (1)
openshift.io/ldap.uid: admins (2)
openshift.io/ldap.url: LDAP_SERVER_IP:389 (3)
creationTimestamp:
name: admins (4)
users: (5)
- [email protected]
- [email protected]
1 | 此OpenShift Dedicated组上次与LDAP服务器同步的时间(ISO 6801格式)。 |
2 | LDAP服务器上组的唯一标识符。 |
3 | 存储此组记录的 LDAP 服务器的 IP 地址和主机。 |
4 | LDAP服务器中列出的组名称。 |
5 | 作为组成员的用户,名称由同步文件指定。 |
在增强的Active Directory模式中,用户(Jane和Jim)和组都作为一等公民条目存在于LDAP服务器中,并且组成员身份存储在用户的属性中。以下ldif
代码片段定义了此模式的用户和组
augmented_active_directory.ldif
dn: ou=users,dc=example,dc=com
objectClass: organizationalUnit
ou: users
dn: cn=Jane,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: testPerson
cn: Jane
sn: Smith
displayName: Jane Smith
mail: [email protected]
memberOf: cn=admins,ou=groups,dc=example,dc=com (1)
dn: cn=Jim,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: testPerson
cn: Jim
sn: Adams
displayName: Jim Adams
mail: [email protected]
memberOf: cn=admins,ou=groups,dc=example,dc=com
dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: groups
dn: cn=admins,ou=groups,dc=example,dc=com (2)
objectClass: groupOfNames
cn: admins
owner: cn=admin,dc=example,dc=com
description: System Administrators
member: cn=Jane,ou=users,dc=example,dc=com
member: cn=Jim,ou=users,dc=example,dc=com
1 | 用户的组成员身份列在其属性中。 |
2 | 该组是LDAP服务器上的一等公民条目。 |
创建配置文件。
您具有作为具有dedicated-admin
角色的用户访问集群的权限。
使用augmented_active_directory_config.yaml
文件运行同步
$ oc adm groups sync --sync-config=augmented_active_directory_config.yaml --confirm
OpenShift Dedicated创建以下组记录作为上述同步操作的结果:
augmented_active_directory_config.yaml
文件创建的OpenShift Dedicated组apiVersion: user.openshift.io/v1
kind: Group
metadata:
annotations:
openshift.io/ldap.sync-time: 2015-10-13T10:08:38-0400 (1)
openshift.io/ldap.uid: cn=admins,ou=groups,dc=example,dc=com (2)
openshift.io/ldap.url: LDAP_SERVER_IP:389 (3)
creationTimestamp:
name: admins (4)
users: (5)
- [email protected]
- [email protected]
1 | 此OpenShift Dedicated组上次与LDAP服务器同步的时间(ISO 6801格式)。 |
2 | LDAP服务器上组的唯一标识符。 |
3 | 存储此组记录的 LDAP 服务器的 IP 地址和主机。 |
4 | 同步文件指定的组名称。 |
5 | 作为组成员的用户,名称由同步文件指定。 |
OpenShift Dedicated中的组不会嵌套。在使用数据之前,LDAP服务器必须先展平组成员关系。Microsoft的Active Directory服务器通过LDAP_MATCHING_RULE_IN_CHAIN
规则(OID为1.2.840.113556.1.4.1941
)支持此功能。此外,使用此匹配规则时,只能同步显式列入白名单的组。
本节提供了一个增强Active Directory模式的示例,该模式同步名为admins
的组,该组具有一个用户Jane
和一个组otheradmins
作为成员。otheradmins
组具有一个用户成员:Jim
。此示例说明
如何在LDAP服务器上添加组和用户。
LDAP同步配置文件是什么样的。
同步后OpenShift Dedicated中的结果组记录是什么。
在增强的Active Directory模式中,用户(Jane
和Jim
)和组都作为一等公民条目存在于LDAP服务器中,并且组成员身份存储在用户或组的属性中。以下ldif
代码片段定义了此模式的用户和组
augmented_active_directory_nested.ldif
dn: ou=users,dc=example,dc=com
objectClass: organizationalUnit
ou: users
dn: cn=Jane,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: testPerson
cn: Jane
sn: Smith
displayName: Jane Smith
mail: [email protected]
memberOf: cn=admins,ou=groups,dc=example,dc=com (1)
dn: cn=Jim,ou=users,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: testPerson
cn: Jim
sn: Adams
displayName: Jim Adams
mail: [email protected]
memberOf: cn=otheradmins,ou=groups,dc=example,dc=com (1)
dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: groups
dn: cn=admins,ou=groups,dc=example,dc=com (2)
objectClass: group
cn: admins
owner: cn=admin,dc=example,dc=com
description: System Administrators
member: cn=Jane,ou=users,dc=example,dc=com
member: cn=otheradmins,ou=groups,dc=example,dc=com
dn: cn=otheradmins,ou=groups,dc=example,dc=com (2)
objectClass: group
cn: otheradmins
owner: cn=admin,dc=example,dc=com
description: Other System Administrators
memberOf: cn=admins,ou=groups,dc=example,dc=com (1) (3)
member: cn=Jim,ou=users,dc=example,dc=com
1 | 用户和组的成员身份列在对象的属性中。 |
2 | 组是LDAP服务器上的一等公民条目。 |
3 | otheradmins 组是admins 组的成员。 |
使用Active Directory同步嵌套组时,必须为用户条目和组条目提供LDAP查询定义,以及在内部OpenShift Dedicated组记录中表示它们的属性。此外,此配置需要进行某些更改
oc adm groups sync
命令必须显式列入组白名单。
用户的groupMembershipAttributes
必须包含"memberOf:1.2.840.113556.1.4.1941:"
,以符合LDAP_MATCHING_RULE_IN_CHAIN
规则。
groupUIDAttribute
必须设置为dn
。
groupsQuery
不得设置filter
。
必须设置有效的derefAliases
。
不应设置baseDN
,因为该值将被忽略。
不应设置scope
,因为该值将被忽略。
为清楚起见,您在 OpenShift Dedicated 中创建的组应尽可能使用除区分名称以外的属性作为用户或管理员可见的字段。例如,使用其电子邮件标识 OpenShift Dedicated 组的用户,并使用组的名称作为通用名称。以下配置文件创建了这些关系
augmented_active_directory_config_nested.yaml
kind: LDAPSyncConfig
apiVersion: v1
url: ldap://LDAP_SERVICE_IP:389
augmentedActiveDirectory:
groupsQuery: (1)
derefAliases: never
pageSize: 0
groupUIDAttribute: dn (2)
groupNameAttributes: [ cn ] (3)
usersQuery:
baseDN: "ou=users,dc=example,dc=com"
scope: sub
derefAliases: never
filter: (objectclass=person)
pageSize: 0
userNameAttributes: [ mail ] (4)
groupMembershipAttributes: [ "memberOf:1.2.840.113556.1.4.1941:" ] (5)
1 | 无法指定groupsQuery 过滤器。groupsQuery 的base DN和scope值将被忽略。groupsQuery 必须设置有效的derefAliases 。 |
2 | 唯一标识LDAP服务器上组的属性。它必须设置为dn 。 |
3 | 用作组名称的属性。 |
4 | 用作OpenShift Dedicated组记录中用户名属性。在大多数安装中,mail 或sAMAccountName 是首选。 |
5 | 存储用户成员信息的用户属性。注意LDAP_MATCHING_RULE_IN_CHAIN 的使用。 |
创建配置文件。
您具有作为具有dedicated-admin
角色的用户访问集群的权限。
使用augmented_active_directory_config_nested.yaml
文件运行同步
$ oc adm groups sync \
'cn=admins,ou=groups,dc=example,dc=com' \
--sync-config=augmented_active_directory_config_nested.yaml \
--confirm
必须显式列入 |
OpenShift Dedicated创建以下组记录作为上述同步操作的结果:
augmented_active_directory_config_nested.yaml
文件创建的OpenShift Dedicated组apiVersion: user.openshift.io/v1
kind: Group
metadata:
annotations:
openshift.io/ldap.sync-time: 2015-10-13T10:08:38-0400 (1)
openshift.io/ldap.uid: cn=admins,ou=groups,dc=example,dc=com (2)
openshift.io/ldap.url: LDAP_SERVER_IP:389 (3)
creationTimestamp:
name: admins (4)
users: (5)
- [email protected]
- [email protected]
1 | 此OpenShift Dedicated组上次与LDAP服务器同步的时间(ISO 6801格式)。 |
2 | LDAP服务器上组的唯一标识符。 |
3 | 存储此组记录的 LDAP 服务器的 IP 地址和主机。 |
4 | 同步文件指定的组名称。 |
5 | 该组的成员用户,名称由同步文件指定。请注意,由于Microsoft Active Directory服务器已展平组成员关系,因此包含嵌套组的成员。 |
配置文件的对象规范如下。请注意,不同的模式对象具有不同的字段。例如,v1.ActiveDirectoryConfig没有groupsQuery
字段,而v1.RFC2307Config和v1.AugmentedActiveDirectoryConfig都有。
不支持二进制属性。来自LDAP服务器的所有属性数据必须为UTF-8编码字符串格式。例如,切勿使用二进制属性(例如 |
LDAPSyncConfig
包含定义LDAP组同步所需的配置选项。
名称 | 描述 | 模式 |
---|---|---|
|
表示此对象所代表的REST资源的字符串值。服务器可以从客户端提交请求的端点推断出这一点。无法更新。使用驼峰式大小写。更多信息:https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
字符串 |
|
定义此对象表示的版本化模式。服务器应将识别的模式转换为最新的内部值,并可能拒绝无法识别的值。更多信息:https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#resources |
字符串 |
|
Host是LDAP服务器的方案、主机和端口: |
字符串 |
|
用于绑定到LDAP服务器的可选DN。 |
字符串 |
|
在搜索阶段绑定时使用的可选密码。 |
v1.StringSource |
|
如果为 |
布尔值 |
|
向服务器发出请求时使用的可选受信任证书颁发机构捆绑包。如果为空,则使用默认系统根证书。 |
字符串 |
|
LDAP组UID到OpenShift Dedicated组名称的可选直接映射。 |
对象 |
|
包含从以类似于RFC2307的方式设置的LDAP服务器提取数据的配置:一等公民组和用户条目,组成员关系由组条目上列出其成员的多值属性确定。 |
v1.RFC2307Config |
|
包含从以类似于Active Directory中使用的LDAP服务器提取数据的配置:一等公民用户条目,组成员关系由成员上列出他们所属组的多值属性确定。 |
v1.ActiveDirectoryConfig |
|
包含从以类似于上述Active Directory中使用的LDAP服务器提取数据的配置,并增加一项:存在一等公民组条目,用于保存元数据,但不保存组成员关系。 |
v1.AugmentedActiveDirectoryConfig |
StringSource
允许内联指定字符串,或者通过环境变量或文件外部指定。当它只包含一个字符串值时,它将编组为一个简单的JSON字符串。
名称 | 描述 | 模式 |
---|---|---|
|
指定明文值,如果指定了 |
字符串 |
|
指定包含明文值的环境变量,如果指定了 |
字符串 |
|
引用包含明文值的文件,如果指定了 |
字符串 |
|
引用包含用于解密值的关键的文件。 |
字符串 |
LDAPQuery
包含构建LDAP查询所需的选项。
名称 | 描述 | 模式 |
---|---|---|
|
所有搜索应从中开始的目录分支的DN。 |
字符串 |
|
搜索的可选范围。可以是 |
字符串 |
|
关于别名的搜索行为的可选设置。可以是 |
字符串 |
|
任何对服务器的请求在等待响应超时之前可以保持未完成的时间限制(以秒为单位)。如果为 |
integer |
|
有效的LDAP搜索过滤器,用于从具有基本DN的LDAP服务器检索所有相关条目。 |
字符串 |
|
最大首选页面大小(以LDAP条目为单位)。页面大小为 |
integer |
RFC2307Config
包含必要的配置选项,用于定义LDAP组同步如何使用RFC2307模式与LDAP服务器交互。
名称 | 描述 | 模式 |
---|---|---|
|
包含返回组条目的LDAP查询模板。 |
v1.LDAPQuery |
|
定义LDAP组条目中哪个属性将被解释为其唯一标识符。( |
字符串 |
|
定义LDAP组条目中哪些属性将被解释为其名称,用于OpenShift Dedicated组。 |
string array |
|
定义LDAP组条目中哪些属性将被解释为其成员。这些属性中包含的值必须可以通过您的 |
string array |
|
包含返回用户条目的LDAP查询模板。 |
v1.LDAPQuery |
|
定义LDAP用户条目中哪个属性将被解释为其唯一标识符。它必须与 |
字符串 |
|
定义LDAP用户条目中哪些属性将按顺序用作其OpenShift Dedicated用户名。将使用第一个具有非空值属性。这应与您的 |
string array |
|
确定遇到缺少用户条目时LDAP同步作业的行为。如果为 |
布尔值 |
|
确定遇到超出范围的用户条目时LDAP同步作业的行为。如果为 |
布尔值 |
ActiveDirectoryConfig
包含必要的配置选项,用于定义LDAP组同步如何使用Active Directory模式与LDAP服务器交互。
名称 | 描述 | 模式 |
---|---|---|
|
包含返回用户条目的LDAP查询模板。 |
v1.LDAPQuery |
|
定义LDAP用户条目中哪些属性将被解释为其OpenShift Dedicated用户名。用作OpenShift Dedicated组记录中用户名的属性。在大多数安装中, |
string array |
|
定义LDAP用户条目中哪些属性将被解释为其所属的组。 |
string array |
AugmentedActiveDirectoryConfig
包含必要的配置选项,用于定义LDAP组同步如何使用增强的Active Directory模式与LDAP服务器交互。
名称 | 描述 | 模式 |
---|---|---|
|
包含返回用户条目的LDAP查询模板。 |
v1.LDAPQuery |
|
定义LDAP用户条目中哪些属性将被解释为其OpenShift Dedicated用户名。用作OpenShift Dedicated组记录中用户名的属性。在大多数安装中, |
string array |
|
定义LDAP用户条目中哪些属性将被解释为其所属的组。 |
string array |
|
包含返回组条目的LDAP查询模板。 |
v1.LDAPQuery |
|
定义LDAP组条目中哪个属性将被解释为其唯一标识符。( |
字符串 |
|
定义LDAP组条目中哪些属性将被解释为其名称,用于OpenShift Dedicated组。 |
string array |