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
相关推荐
子兮曰8 小时前
async/await高级模式:async迭代器、错误边界与并发控制
前端·javascript·github
崔庆才丨静觅21 小时前
Claude Code GitHub Actions 使用教程
github·api·claude
砖厂小工2 天前
用 GLM + OpenClaw 打造你的 AI PR Review Agent — 让龙虾帮你审代码
android·github
程序员鱼皮2 天前
又一个新项目完结,我要出海了!
ai·github·开源项目
徐小夕2 天前
pxcharts-vue:一款专为 Vue3 打造的开源多维表格解决方案
前端·vue.js·github
Moment2 天前
想要长期陪伴你的助理?先从部署一个 OpenClaw 开始 😍😍😍
前端·后端·github
我叫黑大帅2 天前
前端如何利用 GitHub Actions 自动构建并发布到 GitHub Pages?
前端·面试·github
YuMiao2 天前
gstatic连接问题导致Google Gemini / Studio页面乱码或图标缺失问题
服务器·网络协议