Gitlab服务器配置LDAP指导

  1. ssh登录gitlab服务器:192.168.1.203
  2. 修改配置文件
powershell 复制代码
sudo su
vim /etc/gitlab/gitlab.rb

找到ldap_enabledldap_servers关键字并修改参数

  1. 保存配置文件并重新载入配置
powershell 复制代码
gitlab-ctl reconfigure
  1. 检查ldap相关配置是否成功(列出前100个用户,若没出现用户列表,则会报错)
powershell 复制代码
 gitlab-rake gitlab:ldap:check

  1. 重启gitlab服务
powershell 复制代码
 gitlab-ctl restart

6.配置参数含义

powershell 复制代码
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服务器的DN(Distinguished 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.参考配置文件

powershell 复制代码
  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
相关推荐
谢慧琼12 小时前
2026零基础做企业网站,低成本搭建官方网站
服务器·前端·javascript
wangruofeng13 小时前
20822 star 的开源录屏软件弃 Tauri 换 Electron:表层是换壳,里子是 46 个 Rust 模块
github·音视频开发
世人万千丶15 小时前
去重插入与超限淘汰:ArkTS 实现鸿蒙搜索历史的 LIMIT 艺术
运维·服务器·学习·华为·harmonyos·鸿蒙
CAD老兵15 小时前
一行代码集成 DWG/DXF 图纸查看:测量批注,数据不出站
前端·javascript·github
程序员与背包客_CoderZ15 小时前
Linux D-Bus通信协议详解:从入门到C/C++编码实战
linux·服务器·c语言·c++·嵌入式硬件·嵌入式软件·dbus
Android系统攻城狮15 小时前
Linux PipeWire深度解析之pw_properties_iterate调用流程与实战(六十五)
linux·运维·服务器·音频进阶·pipewire音频进阶
ITyunwei098716 小时前
内存溢出报错,实战处理记录
运维·服务器·企业微信
zh_xuan17 小时前
github搭建个人主页
html·github
fthux17 小时前
装闭 RenoPit 源码解析(10):AI如何审查装修合同与报价单
人工智能·ai·开源·github·open source·renopit
谷哥的小弟18 小时前
腾讯云服务器安装Redis Stack图文教程
服务器·redis·腾讯云·redis stack