Gitlab CE:使用ldapjs进行LDAP身份验证

时间:2015-11-30 14:48:11

标签: ldap gitlab ldapjs

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

我的LDAP adapther使用ldapjs构建并返回以下对象:

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

我总是最终使用无法通过Ldapmain对您进行身份验证,因为"凭据无效"。

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

    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-导轨/ 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)
    

0 个答案:

没有答案