Skip to content

500 on /profile after disabling LDAP

Summary

After migrating users from LDAP to Google OAuth2 (adding google_oauth2 identity and removing the ldapmain one on all of our users) we have disabled LDAP and that is when we started to notice this issue.

Steps to reproduce

Sign in using LDAP and let GitLab to create the account automatically. After that, add another auth provider (eg., google_oauth2), connect an account using the provider, remove LDAP identity, disable LDAP and remove or comment out all LDAP-related settings in GitLab configuration.

What is the current bug behavior?

Whoops, something went wrong on our end. message is shown when trying to access /profile, accompanied by 500 HTTP status code.

What is the expected correct behavior?

Profile settings are shown.

Relevant logs and/or screenshots

ActionView::Template::Error (Missing setting 'servers' in 'ldap' section in /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml):
    50:         = f.text_field :id, readonly: true, label: 'User ID', wrapper: { class: 'col-md-3' }
    51: 
    52:       - if @user.external_email?
    53:         = f.text_field :email, required: true, readonly: true, help: "Your email address was automatically set based on your #{email_provider_label} account."
    54:       - else
    55:         = f.text_field :email, required: true, value: (@user.email unless @user.temp_oauth_email?),
    56:           help: user_email_help_text(@user)
  lib/gitlab/ldap/config.rb:18:in `servers'
  lib/gitlab/ldap/config.rb:28:in `providers'
  lib/gitlab/ldap/config.rb:32:in `valid_provider?'
  lib/gitlab/o_auth/provider.rb:25:in `config_for'
  lib/gitlab/o_auth/provider.rb:37:in `label_for'
  app/helpers/profiles_helper.rb:5:in `email_provider_label'
  app/views/profiles/show.html.haml:53:in `block in _app_views_profiles_show_html_haml__649189244153273714_69978741509920'
  app/views/profiles/show.html.haml:5:in `_app_views_profiles_show_html_haml__649189244153273714_69978741509920'
  lib/gitlab/i18n.rb:46:in `with_locale'
  lib/gitlab/i18n.rb:52:in `with_user_locale'
  app/controllers/application_controller.rb:326:in `set_locale'
  lib/gitlab/middleware/multipart.rb:93:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  lib/gitlab/middleware/go.rb:16:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/request_context.rb:18:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'

Output of checks

This issue may share the root cause with #19787 (closed).

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.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 12.0.0 Redis Version: 3.2.5 Git Version: 2.13.5 Sidekiq Version:5.0.4 Go Version: unknown

GitLab information Version: 9.5.3 Revision: 789cc67 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: Private information stripped HTTP Clone URL: Private information stripped SSH Clone URL: Private information stripped Using LDAP: no Using Omniauth: yes Omniauth Providers: google_oauth2

GitLab Shell Version: 5.8.0 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab Shell ...

GitLab Shell version >= 5.8.0 ? ... OK (5.8.0) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 4/1 ... ok 4/2 ... ok 4/3 ... ok 7/4 ... ok 9/5 ... ok 5/6 ... ok 4/8 ... ok 4/9 ... ok 12/18 ... ok 12/19 ... ok 12/20 ... ok 12/21 ... ok 4/22 ... ok 4/23 ... ok 4/24 ... ok 4/26 ... ok 4/27 ... ok 12/28 ... ok 4/30 ... ok 4/31 ... ok 12/32 ... ok 12/36 ... ok 12/38 ... ok 4/40 ... ok 12/41 ... ok 4/43 ... ok 12/47 ... ok 12/50 ... ok 12/51 ... ok 12/52 ... ok 4/53 ... ok 4/56 ... ok 12/57 ... ok 12/58 ... ok 4/59 ... ok 12/60 ... ok 4/61 ... ok 12/62 ... ok 12/63 ... ok 4/66 ... ok 12/67 ... ok 12/68 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK Send ping to redis server: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

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

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

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? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 4/1 ... yes 4/2 ... yes 4/3 ... yes 7/4 ... yes 9/5 ... yes 5/6 ... yes 4/8 ... yes 4/9 ... yes 12/18 ... yes 12/19 ... yes 12/20 ... yes 12/21 ... yes 4/22 ... yes 4/23 ... yes 4/24 ... yes 4/26 ... yes 4/27 ... yes 12/28 ... yes 4/30 ... yes 4/31 ... yes 12/32 ... yes 12/36 ... yes 12/38 ... yes 4/40 ... yes 12/41 ... yes 4/43 ... yes 12/47 ... yes 12/50 ... yes 12/51 ... yes 12/52 ... yes 4/53 ... yes 4/56 ... yes 12/57 ... yes 12/58 ... yes 4/59 ... yes 12/60 ... yes 4/61 ... yes 12/62 ... yes 12/63 ... yes 4/66 ... yes 12/67 ... yes 12/68 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.3) Git version >= 2.7.3 ? ... yes (2.13.5) Active users: ... 16

Checking GitLab ... Finished

Possible fixes

To work around this issue, make sure to leave your ldap_servers settings present and uncommented even though ldap_enabled is false or commented out.

Edited by Ľubomír Kučera