Gitlab服务器配置LDAP指导-CSDN博客

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
  1. ssh登录gitlab服务器192.168.1.203
  2. 修改配置文件
sudo su
vim /etc/gitlab/gitlab.rb

找到ldap_enabledldap_servers关键字并修改参数
在这里插入图片描述

  1. 保存配置文件并重新载入配置
gitlab-ctl reconfigure

在这里插入图片描述

  1. 检查ldap相关配置是否成功列出前100个用户若没出现用户列表则会报错
 gitlab-rake gitlab:ldap:check

在这里插入图片描述在这里插入图片描述
5. 重启gitlab服务

 gitlab-ctl restart

在这里插入图片描述

6.配置参数含义

gitlab_rails['ldap_enabled'] = true #启用LDAP认证。
gitlab_rails['ldap_servers'] #指定LDAP服务器的配置信息。

label #LDAP服务器的标签这里是"LDAP"。
host #LDAP服务器的IP地址或主机名。
port #LDAP服务器的端口号这里是389。
uid  #用户在LDAP中的唯一标识字段这里是"sAMAccountName"。
bind_dn  #用于绑定LDAP服务器的DNDistinguished Name。
password  #用于绑定LDAP服务器的密码。
encryption  #使用的加密方式可以是"start_tls"、"simple_tls"或"plain"。
verify_certificates  #是否验证证书。
active_directory  #是否是Active Directory服务器。
allow_username_or_email_login  #是否允许使用用户名或电子邮件登录。
lowercase_usernames  #是否将用户名转换为小写。
block_auto_created_users  #是否阻止自动创建的用户登录。
base  #在LDAP中搜索用户的基础DN。
user_filter  #用户过滤器用于限制从LDAP服务器检索用户的条件。

7.参考配置文件

  gitlab_rails['ldap_enabled'] = true 
 
###! **remember to close this block with 'EOS' below** 
 gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' 
   main: # 'main' is the GitLab 'provider ID' of this LDAP server 
     label: 'LDAP' 
     host: '**.**.**.**' 
     port: 389 
     uid: 'sAMAccountName' 
     bind_dn: 'cn=***,cn=Users,dc=***,dc=****,dc=COM' 
     password: '*****' 
     encryption: 'plain' # "start_tls" or "simple_tls" or "plain" 
     verify_certificates: true 
     active_directory: true 
     allow_username_or_email_login: true 
     lowercase_usernames: false 
     block_auto_created_users: false 
     base: 'OU=Users,OU=*****,DC=***,DC=*****,DC=COM' 
     user_filter: '' 
     ## EE only 
#     group_base: '' 
#     admin_group: '' 
#     sync_ssh_keys: false 
# 
#   secondary: # 'secondary' is the GitLab 'provider ID' of second LDAP server 
#     label: 'LDAP' 
#     host: '_your_ldap_server' 
#     port: 389 
#     uid: 'sAMAccountName' 
#     bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' 
#     password: '_the_password_of_the_bind_user' 
#     encryption: 'plain' # "start_tls" or "simple_tls" or "plain" 
#     verify_certificates: true 
#     active_directory: true 
#     allow_username_or_email_login: false 
#     lowercase_usernames: false 
#     block_auto_created_users: false 
#     base: '' 
#     user_filter: '' 
#     ## EE only 
#     group_base: '' 
#     admin_group: '' 
#     sync_ssh_keys: false 
 EOS
阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: 服务器