如何使用LDAP组成员同步设置TeamCity [英] How to setup TeamCity with LDAP group membership synchronization

查看:8
本文介绍了如何使用LDAP组成员同步设置TeamCity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个简短的操作方法,帮助您开始进行TeamCity的LDAP设置。 我个人挣扎了很久,才设法让同步运行。默认配置文件有许多设置和文本,这可能更令人困惑,而不是有帮助。在JetBrains和StackOverflow上都可以看到许多关于设置组同步问题的帖子。

此设置假定您没有用于导入成员的嵌套组,而是单个组。 如果您想对TeamCity使用嵌套组,请查看https://www.jetbrains.com/help/teamcity/typical-ldap-configurations.html?_ga=2.213872598.374019039.1565610915-964155662.1565610915

中的"按同步限制组数"部分

相应地更改Teamciy.users.筛选器。

teamcity.users.filter=(&(objectClass=user)(memberOf:1.2.840.113556.1.4.1941:=CN=TeamCity Users,OU=Accounts,DC=domain,DC=com))

JetBrains希望您有一个嵌套的组,其中顶层节点是您的TeamCity组。然而,这并不是我现在想要设置同步的方式。

假设

推荐答案

以下是我如何设置TeamCity LDAP配置文件以同步AD组:

ldap-config.properties文件

java.naming.provider.url=ldap://<your server or domain>:3268/DC=YOUR,DC=Domain,DC=Here
java.naming.security.principal=<username>
java.naming.security.credentials=<password>
teamcity.users.login.filter=(sAMAccountName=$capturedLogin$)
teamcity.users.username=sAMAccountName

### USERS SETTINGS ###
teamcity.options.users.synchronize=true
teamcity.users.filter=(objectClass=user)
teamcity.users.property.displayName=displayName
teamcity.users.property.email=mail

# Automatic user creation and deletion during users synchronization
teamcity.options.createUsers=true
teamcity.options.deleteUsers=true

### GROUPS SETTINGS ###
# These settings are mandatory if groups synchronization is turned on (ldap-mapping.xml exists)
# Set to "true" to enable the synchronization for groups listed in ldap-mapping.xml file.
# IMPORTANT NOTE: TeamCity groups should be already created manually and listed in ldap-mapping.xml file.
teamcity.options.groups.synchronize=true

# The group search LDAP filter used to retrieve groups to synchronize.
# The search is performed inside the LDAP entry denoted by "teamcity.groups.base". The result should include all the groups configured in the ldap-mapping.xml file.
teamcity.groups.filter=(objectClass=group)

### OPTIONAL SETTINGS ###

# The time interval between synchronizations (in milliseconds). By default, it is one hour.
teamcity.options.syncTimeout=3600000

# The LDAP attribute of a group storing it's members.
# Note: LDAP attribute should contain the full DN of the member, one attribute per member. See also "teamcity.users.property.memberId".
teamcity.groups.property.member=member

注意:我使用端口3268而不是389,这是因为默认端口使TeamCity登录非常慢。在大多数情况下,登录389需要5分钟,而立即登录需要3268分钟。

ldap-mapping.xml文件

<!DOCTYPE mapping SYSTEM "ldap-mapping.dtd">
<mapping>
  <!-- Example mapping entry:
  <group-mapping teamcityGroupKey="GROUP" ldapGroupDn="CN=Group,DC=Example,DC=Com"/>
  -->
   <group-mapping teamcityGroupKey="YourGroupKey" ldapGroupDn="CN=<DNName>" />
</mapping>

PowerShell和RSAT

为了获得我添加的每个组的唯一判别名,我使用了一台安装了RSAT(远程服务器管理工具)的计算机https://www.microsoft.com/en-us/download/details.aspx?id=45520。RSAT向PowerShell添加了一些Active Directory功能,使您可以更轻松地获取所需的LDAP设置。

PowerShell命令:

get-adgroup <Group name> -properties *

将DistinguishedName添加到ldap-mapping.xml文件中的ldapGroupDn字段以及TeamcityGroupKey,您就应该可以开始了。

这篇关于如何使用LDAP组成员同步设置TeamCity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆