LDAP 配置不适用于 Gitlab CE 8.12

LDAP Configuration not working on Gitlab CE 8.12

我们正在尝试将本地 Gitlab CE 安装(omnibus,版本 8.12)与我们的 LDAP 服务器集成。不幸的是,经过多次更改以下配置,我们一直无法找出正确的配置。

gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-EOS # remember to close this block with 'EOS' below
main: # 'main' is the GitLab 'provider ID' of this LDAP server
  label: 'LDAP'
  host: '******.******.***'
  port: 389
  uid: 'sAMAccountName'
  method: 'plain' # "tls" or "ssl" or "plain"

  bind_dn: 'uid=******,ou=******,o=Applications,o=******,c=******'
  password: '**********'

  timeout: 10

  active_directory: true

  allow_username_or_email_login: false

  block_auto_created_users: false

  base: 'o=******'

  user_filter: ''

  attributes:
    username: ['uid', 'userid', 'sAMAccountName']
    email:    ['mailExterno', 'mail', 'email', 'userPrincipalName']

    name:       'cn'
    first_name: 'givenName'
    last_name:  'sn'

  ## EE only

  group_base: ''

  admin_group: ''

  sync_ssh_keys: false

EOS

执行 LDAP 检查显示零个用户:

[root@myserver mydir]# gitlab-rake gitlab:ldap:check
Checking LDAP ...

LDAP users with access to your GitLab server (only showing the first 100 results)
Server: ldapmain

Checking LDAP ... Finished

我们的 LDAP 服务器中有数十个用户,许多应用程序(例如 Redmine、Jenkins、Svn...)与其集成没有问题...

关于我们在 Gitlab 上做错了什么有什么想法吗?

非常感谢您的帮助。

我们终于找到了解决办法。我将答案张贴在这里,以防其他人阅读这篇文章并遇到类似问题可能会觉得它有用。

我连接的 LDAP 服务器不是 Active Directory,因此我需要在以下位置进行配置更改:

  #...

  uid: 'uid'

  #...

  active_directory: false

  #...

一个非常重要要考虑的方面是,为了应用更改,重新启动gitlab是不够的,我们应该执行重新配置:

sudo gitlab-ctl reconfigure