参考链接:

背景:

搭建了Openldap维护公司域账户信息,Gerrit用户验证接入了LDAP。
gerrit.config配置如下(信息请更新为各自公司节点):

1
2
3
4
5
[ldap]
server = ldap://ldap.example.com
username = ldapuser
accountBase = ou=people,dc=example,dc=com
groupBase = ou=groups,dc=example,dc=com

业务需求:

公司特定合作伙伴 有 访问代码库 进行 联合开发的需求。

方案设计:

  1. 在现有LDAP节点的基础上,增加一个ou(custom),用来维护合作伙伴账号;
  2. 同步 这个ou(custom)的人员到Gerrit上。

配置Gerrit支持多ou user信息:

根据Gerrit官方文档:

1
2
3
ldap.accountBase
Root of the tree containing all user accounts. This is typically of the form ou=people,dc=example,dc=com.
This setting may be added multiple times to specify more than one root.

我们调整gerrit.config配置如下:

1
2
3
4
5
6
[ldap]
server = ldap://ldap.example.com
username = ldapuser
accountBase = ou=people,dc=example,dc=com
accountBase = ou=custom,dc=example,dc=com
groupBase = ou=groups,dc=example,dc=com

然后重启Gerrit后,custom里面的人员也可以登录Gerrit了。


配置Gerrit支持多group信息:

方法和上面同步多个ou user信息相似,增加ldap.groupBase行即可。
根据Gerrit官方文档:

1
2
3
ldap.groupBase
Root of the tree containing all group objects. This is typically of the form ou=groups,dc=example,dc=com.
This setting may be added multiple times to specify more than one root.

关于LDAP group信息:

一般系统接入LDAP做账户验证,只需同步LDAP的user信息,不直接使用LDAP的group信息。
各个系统自行创建系统组进行人员权限管理,这样更加灵活。
同时,也不建议LDAP里面维护太多group,更加推荐LDAP轻量化使用。

Comment and share

  • page 1 of 1
Author's picture

Weilong

    Write something about work-life:

PM


Shenzhen