与JumpCloud的GitLab LDAP集成无法正常工作

时间:2016-12-29 14:18:25

标签: ldap cloud gitlab

我正在尝试将GitLab服务器配置为使用JumpCloud LDAP作为服务,但无法使其正常工作。 GitLab rake命令显示与LDAP服务器的连接成功,但是当我尝试登录时,错误无法通过Ldapmain对您进行身份验证,因为“无效的凭据”。显示

ldapsearch命令正确生成输出:

ldapsearch -H ldap://ldap.jumpcloud.com:389 -D "uid=username,ou=Users,o=org12345,dc=jumpcloud,dc=com" -w "password"  -b "ou=Users,o=org12345,dc=jumpcloud,dc=com" "(objectClass=inetOrgPerson)" sAMAccountName

# extended LDIF
#
# LDAPv3
# base <ou=Users,o=org12345,dc=jumpcloud,dc=com> with scope subtree
# filter: (objectClass=inetOrgPerson)
# requesting: sAMAccountName 
#

# username, Users, org12345, jumpcloud.com
dn: uid=username,ou=Users,o=org12345,dc=jumpcloud,dc=com

# user1, Users, org12345, jumpcloud.com
dn: uid=user1,ou=Users,o=org12345,dc=jumpcloud,dc=com

# search result
search: 2
result: 0 Success

# numResponses: 3
# numEntries: 2

Gitlab rake check

sudo gitlab-rake gitlab:ldap:check

Checking LDAP ...

Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)

Checking LDAP ... Finished

unicorn_stdout.log中的错误

I, [2016-12-29T05:52:50.947393 #7067]  INFO -- omniauth: (ldapmain) Callback phase initiated.
E, [2016-12-29T05:52:51.834803 #7067] ERROR -- omniauth: (ldapmain) Authentication failure! invalid_credentials encountered.

向用户显示错误

enter image description here

GitLab LDAP配置

gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below
 main:
  label: 'LDAP'
  host: 'ldap.jumpcloud.com'
  port: 389 #Change to 636 if using LDAPS
  method: 'plain' # Change to "tls" if using LDAPS
  uid: 'sAMAccountName' # Don't change this
  bind_dn: 'uid=username,ou=Users,o=org12345,dc=jumpcloud,dc=com'
  password: 'password'
  active_directory: true
  allow_username_or_email_login: false
  block_auto_created_users: false
  base: 'ou=Users,o=org12345,dc=jumpcloud,dc=com'
  user_filter: '(objectClass=inetOrgPerson)'
EOS

我确信提供的用户名和密码是正确的。如果我在配置中出错或有什么其他我可以检查以解决此问题,有人可以检查并告诉我吗?

非常感谢您的帮助

我在12月29日收到了来自JumpCloud支持的回复:

除了gitlab之外,在查看了你的配置后,看起来有必要使用uid字段= sAMAccountName。这是一个samba属性,我们目前不支持。在JumpCloud中,uid = uid。如果您能够更改该字段,它看起来应该连接,但看起来gitlab需要samba模式通过LDAP进行身份验证。

2 个答案:

答案 0 :(得分:1)

bind_dn 应该是用于连接到ldap服务器的域\用户名。 bind_dn和密码用于使用LDAP服务对GitLab进行身份验证。

以下是我的看法:

  

bind_dn:'gintra \ gitlab-registrar'

答案 1 :(得分:1)

在配置中将uid: 'sAMAccountName'更改为uid: 'uid'应该可以:

gitlab_rails['ldap_enabled'] = true
gitlab_rails['prevent_ldap_sign_in'] = false

##! **remember to close this block with 'EOS' below**
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
 main: # 'main' is the GitLab 'provider ID' of this LDAP server
 label: 'Gitlab LDAP'
 host: 'ldap.jumpcloud.com'
 port: 636
 uid: 'uid'
 bind_dn: 'uid=xxx,ou=Users,o=xxx,dc=jumpcloud,dc=com'
 password: 'xxx'
 encryption: 'simple_tls' # "start_tls" or "simple_tls" or "plain"
 #     verify_certificates: true
 smartcard_auth: false
 active_directory: true
 allow_username_or_email_login: false
 lowercase_usernames: false
 block_auto_created_users: false
 base: 'ou=Users,o=xxx,dc=jumpcloud,dc=com'
 user_filter: '(objectClass=inetOrgPerson)'
 EOS