LDAP Configuration not working on Gitlab CE 8.12


We are trying to integrate our local Gitlab CE installation with our LDAP server. Unfortunately, after several changes to the following configuration, we have not been able to figure out the right config.

Our current LDAP config is as follows:

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=metadirectorio'

  user_filter: ''

    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


Executing the LDAP check displays zero users:

[root@francisco otp]# 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

We have dozens of users in our LDAP server and many applications (such as Redmine, Jenkins, Svn…) integrated with it without problems…

Any ideas on what are we doing wrong with Gitlab?

Help would be very much appreciated.

UPDATE: Solved.

More details here: