gitlab中配置ldap

如果在gitlab中配置ldap

首先安装OpenLdap和Gitlab,网上文章很多大家可以搜一下。

添加Ldap服务器配置,参数说明详见官网 https://docs.gitlab.com/ee/administration/auth/ldap/

vi /etc/gitlab/gitlab.rb
#添加配置
gitlab_rails['ldap_enabled'] = true
gitlab_rails['prevent_ldap_sign_in'] = false
gitlab_rails['ldap_servers'] = {
'main' => {
  'label' => 'LDAP',
  'host' =>  'x.x.x.x', #ldap IP 地址
  'port' => 389,
  'uid' => 'uid',
  'encryption' => 'plain',
  'verify_certificates' => false,
  'timeout' => 10,
  'active_directory' => false,
  'allow_username_or_email_login' => false,
  'block_auto_created_users' => false,
  'base' => 'ou=users,dc=xxxx,dc=com',
  'user_filter' => '(&(objectClass=person)(memberof=CN=git,OU=groups,DC=xxx,DC=com))',
  'attributes' => {
    'username' => 'uid',
    'email' => 'mail',
    'name' => 'cn',
    'first_name' => 'givenName',
    'last_name' => 'sn'
  },
  'lowercase_usernames' => false
  }
}
#配置并重启gitlab
gitlab-ctl reconfigure

你可能感兴趣的:(linux,java,spring,boot,centos)