centos搭建gitlab并配置ldap统一验证

Gitlab搭建社区版

参考地址:https://zhuanlan.zhihu.com/p/62042884

其中gitlab资源包地址显示不全,可使用浏览器下载到本地再拷到服务器

最后搭建完成会出现访问不了,需关闭防火墙

systemctl disable firewalld
#重启
reboot

配置ldap

Gitlab搭建完成后配置ldap

1.打开配置文件

vi /etc/gitlab/gitlab.rb

2.找到LDAP Setting

 

里面提供了例子,没有改里面的例子,直接在后面添加配置

gitlab_rails['ldap_enabled'] = true

gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'

   main: # 'main' is the GitLab 'provider ID' of this LDAP server

     label: 'LDAP'

     host: 'xxxxx'

     port: 389

     uid: 'uid'

     bind_dn: 'cn=admin,c=cn'

     password: 'xxxxx'

     encryption: 'plain' # "start_tls" or "simple_tls" or "plain"

     verify_certificates: true

     active_directory: false

     allow_username_or_email_login: true

     lowercase_usernames: false

     block_auto_created_users: false

     base: 'c=cn'

     user_filter: ''

     attributes:

       username: ['uid', 'userid', 'sAMAccountName']

       email: ['mail', 'email', 'userPrincipalName']

       name: 'cn'

       first_name: 'givenName'

       last_name:  'sn'

EOS

当前搭建的LDAP服务如下

(1)host,是搭建的openldapip,根据实际情况修改;

(2)uid,根据实际情况填uid或者cn等,应该会根据这个属性来取到所有可用的用户

(3)bind_dnopenldap的管理员账号,根据实际情况修改;

(4)passwordopenldap的管理员,根据实际情况修改;

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

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

(7)base,用户列表所在的目录

编辑完成保存退出

3.重新加载配置

gitlab-ctl reconfigure

运行后最后一行为“gitlab Reconfigured!”才说明是加载新配置成功,否则就是根据报错信息找错误

4.查看是否能正常获取用户列表

gitlab-rake gitlab:ldap:check
正常连接的情况下执行之后能看到用户的列表

 

5.重启gitlab

gitlab-ctl restart

6.重启成功后浏览器登录显示LDAP登录选项,即可使用ldap账户登录,原有的管理员账户使用standard方式进行登录

 

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值