gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = {
'main' => {
'label' => 'Company LDAP', # 登录页显示的名称
'host' => 'ldap.example.com',
'port' => 389, # 636为LDAPS端口
'uid' => 'sAMAccountName', # AD使用'sAMAccountName',OpenLDAP通常用'uid'
'encryption' => 'plain', # 'start_tls'或'simple_tls'(对应LDAPS)
'verify_certificates' => true,
'bind_dn' => 'CN=GitLab Sync,OU=Service Accounts,DC=example,DC=com',
'password' => 'your_service_account_password',
'active_directory' => true, # AD设为true,OpenLDAP设为false
'base' => 'OU=Users,DC=example,DC=com',
'user_filter' => '(memberOf=CN=GitLab Users,OU=Groups,DC=example,DC=com)',
# 属性映射(根据LDAP结构调整)
'attributes' => {
'username' => ['sAMAccountName'],
'email' => ['mail'],
'name' => ['displayName'],
'first_name' => ['givenName'],
'last_name' => ['sn']
}
}
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.