Skip to content

LDAP bind_dn credentials vs. personal LDAP credentials results in the same user being logged in

Summary

Logging in using different external credentials works, but upon login are tied to the same GitLab-side user.

Steps to reproduce

  1. You must have a GitLab CE instance that is connected to an external LDAP, and the credentials for at least two separate users.
  2. Log in using the first user (e.g., foo), and verify that you are correctly logged in as foo. Also note that foo in this case is what we use for the ldap_servers's main.bind_dn.
  3. Log out.
  4. Log in using the second user (e.g., bar), and find that you are incorrectly logged in as foo.
  5. Log out.

Example Project

N/A

What is the current bug behavior?

Logging in as either foo or bar unexpectedly results in the same GitLab-side user.

What is the expected correct behavior?

Logging in as either foo or bar results in two different GitLab-side users.

Relevant logs and/or screenshots

Using ldapsearch, I searched for two different usernames, they are indeed different users. And as I mentioned above, foo in this case is what we've configured as the bind_dn.

I further confirmed that the LDAP uid value in Admin Area > Users > selected user is actually changed depending on whether I used my foo or bar credentials.

Output of checks

This bug is currently reproducible on our self-hosted GitLab CE instance v12.7.6 (61654d25b20).

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Current User: git Using RVM: no Ruby Version: 2.6.5p114 Gem Version: 2.7.10 Bundler Version:1.17.3 Rake Version: 12.3.3 Redis Version: 5.0.7 Git Version: 2.24.1 Sidekiq Version:5.2.7 Go Version: unknown

GitLab information Version: 12.7.6 Revision: 61654d25b20 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.9 URL: REDACTED HTTP Clone URL: REDACTED SSH Clone URL: REDACTED Using LDAP: yes Using Omniauth: yes Omniauth Providers:

GitLab Shell Version: 11.0.0 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 11.0.0 ? ... OK (11.0.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 100 users of 100 limit.

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 3/1 ... yes 5/3 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.5) Git version >= 2.22.0 ? ... yes (2.24.1) Git user has default SSH configuration? ... yes Active users: ... 5 Is authorized keys file accessible? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

N/A