关上gitlab在linux上的默认装置门路

vim /etc/gitlab/gitlab.rb

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: 'localhost'      port: 389      uid: 'uid'      bind_dn: 'cn=admin,dc=zdpoc,dc=com'      password: '666666'      encryption: 'plain' # "start_tls" or "simple_tls" or "plain"# verify_certificates: true# smartcard_auth: false      active_directory: true      allow_username_or_email_login: false# lowercase_usernames: false# block_auto_created_users: false      base: 'ou=people,dc=zdpoc,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# smartcard_auth: false# 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 会报 500 谬误, 例如 active_directory: true``
  • hostport 是 LDAP 服务的主机地址及端口
  • bind_dnpassword 是一个治理 LDAP 的 dn 及明码,须要有管理员权限,对应着 LDAP 服务的顶级域和明码
  • base 示意 LDAP 将以该 dn 为 节点,向下查找用户
  • user_filter 示意以某种过滤条件筛选用户,比方假如咱们只心愿所属组为 Developers 的用户来拜访 GitLab,则能够在这里设置 (memberOf=cn=Developers,cn=Groups,dc=xinhua,dc=org)
  • attributes 示意 GitLab 中的字段与 LDAP 中哪些字段能够互相对应
  • uid示意gitlab的登录名,对应ldap中用户的哪个参数

配置完后重启服务 gitlab-ctl reconfigure

可通过 gitlab-rake gitlab:ldap:check 校验配置是否胜利,胜利返回如下图(需重启后校验)