gitlab ldap配置

本文详细介绍了如何在GitLab中配置LDAP,包括编辑配置文件、设置LDAP参数如host、uid、bind_dn等,以及如何检查配置和重启服务。适合希望整合GitLab与企业身份验证系统的管理员阅读。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

gitlab ldap配置参考

gitlab配置文件:/etc/gitlab/gitlab.rb

编辑gitlab.rb文件:

在gitlab.rb文件中修改下面配置,其中:

1.host,是搭建的ldap的ip,根据实际情况修改;

2.uid,可以配置cn,也可以配置uid,都能识别(具体为什么没深入研究);

3.bind_dn,ldap的管理员账号,根据实际情况修改;

4.password,ldap的管理员,根据实际情况修改;

5.active_directory,似乎是针对连接是否是ad域控的标示,因为这部分是ldap的配置,故为false;

6.allow_username_or_email_login,用户登录是否用户名和邮箱都可以,方便用户故配置true;

7.base,用户列表所在的目录,因为新增的用户都在ldap的People下,故这么配置,根据实际情况修改;

我的配置如下:

  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

配置完成后进行配置更新:

  gitlab-ctl reconfigure

检查是否配置成功:

  gitlab-rake gitlab:ldap:check(列出前100个用户,若没出现用户列表,则会报错)

重启gitlab服务:

  gitlab-ctl restart

屏蔽掉注册功能【不想让人随便注册使用】

参考:https://blog.youkuaiyun.com/ouyang_peng/article/details/78562125

 

参考链接:

ldap部署:https://www.cnblogs.com/xiaojwang/p/9303601.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值