Gitlab与LDAP登录的集成失败,其中包含"无效的凭据"

时间:2015-09-02 08:25:47

标签: ldap gitlab qnap

我安装了" gitlab-ce-7.14.1-ce.0.el6.x86_64.rpm"在Centos.Everything正常,但当我尝试与我的Qnap NAS上的LDAP运行集成。它显示错误。

我的LDAP帐户肯定是对的。 测试LDAP帐户

ldapwhoami -D "cn=admin,dc=test,dc=net" -w "ldap" -h 192.168.1.10

响应

dn:cn=admin,dc=test,dc=net

当我尝试从gitlab web登录LDAP帐户时。 GitLab Web登录页面上的错误

Could not authorize you from Ldapmain because "Invalid credentials".
production.log中的

错误

Started POST "/users/auth/ldapmain/callback" for 127.0.0.1 at 2015-09-02 15:41:59 +0800
Processing by OmniauthCallbacksController#failure as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "username"=>"user", "password"=>"[FILTERED]"}
Redirected to http://192.168.1.81/users/sign_in
Completed 302 Found in 38ms (ActiveRecord: 6.0ms)
Started GET "/users/sign_in" for 127.0.0.1 at 2015-09-02 15:41:59 +0800
Processing by SessionsController#new as HTML
Completed 200 OK in 75ms (Views: 36.2ms | ActiveRecord: 5.2ms)

我的配置文件/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: 'LDAP'
  host: '192.168.1.10'
  port: 389
  uid: 'admin'
  method: 'plain' # "tls" or "ssl" or "plain"
  allow_username_or_email_login: true
  bind_dn: 'cn=admin,dc=test,dc=net'
  password: 'ldap'
  active_directory: false
  base: 'ou=people,dc=test,dc=net'
  user_filter: ''
EOS

此问题与Gitlab: LDAP "Invalid credentials", but credentials are right类似 但它是Gitlab的不同版本。

1 个答案:

答案 0 :(得分:0)

我的朋友已经解决了这个问题。只需改变

 uid: 'admin'

 uid: 'uid'

这是/etc/gitlab/gitlab.rb

的完整配置
external_url 'http://192.168.1.11'

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'
  host: '192.168.1.10'
  port: 389
  uid: 'uid'
  method: 'plain' # "tls" or "ssl" or "plain"
  allow_username_or_email_login: true
  bind_dn: 'cn=admin,dc=test,dc=net'
  password: 'ldap'
  active_directory: false
  base: 'ou=People,dc=test,dc=net'
  user_filter: ''
EOS

谢谢大家。

相关问题