Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab LDAP scondary strategy

I'm using GitLab CE Omnibus package (gitlab_7.7.2-omnibus.5.4.2.ci-1_amd64) on a clean Debian (debian-7.8.0-amd64) installation.

I followed the installation process on https://about.gitlab.com/downloads/ and everything works fine.

I modified /etc/gitlab/gitlab.rb to use a single LDAP server for authentification. Which worked also as expected.

But when I tried to use a secondary LDAP connection "gitlab-ctl reconfigure" gives me the output:

---- Begin output of /opt/gitlab/bin/gitlab-rake cache:clear ----
STDOUT:
STDERR: rake aborted!
Devise::OmniAuth::StrategyNotFound: Could not find a strategy with name `Ldapsecondary'. Please ensure it is required or explicitly set it using the :strategy_class option                          .
Tasks: TOP => cache:clear => environment
(See full trace by running task with --trace)
---- End output of /opt/gitlab/bin/gitlab-rake cache:clear ----

So, the problem is that I can use the LDAP connection 'main' but I cannot use the connection 'secondary'.

Is there any possibility to use two different LDAP connection in the CE edition at once?

I'm new to ruby [on rails]. I found something in /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/ldap/config.rb but I'm not able to debug anything.

Here are my settings in /etc/gitlab/gitlab.rb

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: 'First Company'
    host: '192.168.100.1'
    port: 389
    uid: 'sAMAccountName'
    method: 'tls' # "tls" or "ssl" or "plain"
    bind_dn: '[email protected]'
    password: 'Passw0rd'
    active_directory: true
    allow_username_or_email_login: false
    base: 'dc=firstcompany,dc=local'
    user_filter: '(&(objectClass=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))'
    ## EE only
    group_base: ''
    admin_group: ''
    sync_ssh_keys: false

  secondary: # 'secondary' is the GitLab 'provider ID' of second LDAP server
    label: 'Second Company'
    host: '192.168.200.1'
    port: 389
    uid: 'sAMAccountName'
    method: 'tls' # "tls" or "ssl" or "plain"
    bind_dn: '[email protected]'
    password: 'Passw0rd'
    active_directory: true
    allow_username_or_email_login: false
    base: 'dc=secondcompany,dc=local'
    user_filter: '(&(objectClass=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))'
    ## EE only
    group_base: ''
    admin_group: ''
    sync_ssh_keys: false
EOS

Thank you very much!

like image 217
Lonely Island Avatar asked Feb 08 '15 13:02

Lonely Island


People also ask

What are the 2 aspects to LDAP integration?

By default, there are 2 LDAP integration sample scheduled imports: Example LDAP User Import. Example LDAP Group Import.

What is LDAP method?

In LDAP, authentication is supplied in the "bind" operation. LDAP v3 supports three types of authentication: anonymous, simple and SASL authentication. A client that sends a LDAP request without doing a "bind" is treated as an anonymous client.


1 Answers

Multiple LDAP servers is an EE feature so setting the config in CE won't do anything. You can see the feature in GitLab documentation.

like image 189
Max Avatar answered Sep 22 '22 14:09

Max