1

我正在我公司的 SSO 上构建一个 LDAP 适配器,以便人们可以通过它登录到 gitlab。

我的 LDAP 适配器是用 ldapjs 构建的,并返回以下对象:

{ dn: 'cn=test, o=sso',
  attributes: 
   { cn: 'test',
     uid: 'test',
     mail: 'test@test.com',
     objectclass: 'user' 
   } 
}

由于“凭据无效” ,我总是以无法从 Ldapmain 对您进行身份验证而告终。

  1. 我可以提供任何其他信息来帮助解决我的问题吗?
  2. 我的配置有明显的问题吗?
  3. 我在哪里可以获得更完整的日志来诊断问题?

我的测试用户

Name: test
Username: test
Email: test@test.com

配置

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: 'LDAP_SSO'
    host: 'localhost'
    port: 1389
    uid: 'mail'
    method: 'plain' # "tls" or "ssl" or "plain"
    bind_dn: 'cn=root'
    password: 'secret'
    active_directory: false
    allow_username_or_email_login: true
    block_auto_created_users: true
    base: 'o=sso'
    user_filter: ''
EOS

gitlab-rake gitlab:ldap:check RAILS_ENV=production

root@xxx:/var/log/gitlab# gitlab-rake gitlab:ldap:check RAILS_ENV=production
Checking LDAP ...

LDAP users with access to your GitLab server (only showing the first 100 results)
Server: ldapmain
    DN: cn=test, o=sso   mail: test@test.com

Checking LDAP ... Finished

日志

unicorn_stdout.log

root@xxx:/var/log/gitlab# cat /var/log/gitlab/unicorn/unicorn_stdout.log
I, [2015-11-30T13:42:37.350694 #22372]  INFO -- omniauth: (ldapmain) Callback phase initiated.
E, [2015-11-30T13:42:37.392395 #22372] ERROR -- omniauth: (ldapmain) Authentication failure!    invalid_credentials encountered.

gitlab-rails/production.log

Started POST "/users/auth/ldapmain/callback" for 127.0.0.1 at 2015-11-30 14:10:41 +0100
Processing by OmniauthCallbacksController#failure as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "username"=>"test@test.com", "password"=>"[FILTERED]"}
Redirected to http://localhost:8080/users/sign_in
Completed 302 Found in 37ms (ActiveRecord: 3.0ms)
Started GET "/users/sign_in" for 127.0.0.1 at 2015-11-30 14:10:41 +0100
Processing by SessionsController#new as HTML
Completed 200 OK in 55ms (Views: 33.2ms | ActiveRecord: 1.3ms)
4

0 回答 0