Gitlab身份验证返回无效的用户名或密码缺少LDAP窗格

问题描述

我在活动目录LDAP中有用户(每个用户都有用户名和电子邮件集)。 我在gitlab.rb中配置了LDAP身份验证,并运行了“ gitlab-ctl重新配置”。 我使用了Gitlab社区版。 以下命令返回用户,因此配置看起来不错“ sudo gitlab-rake gitlab:ldap:check”。 返回:

LDAP:...服务器:ldapmain LDAP认证...成功 有权访问您的GitLab服务器的LDAP用户(仅显示前100个结果)

DN:cn = Mike Gordon,cn = users,dc = ad,dc = mydomain,dc = com sAMAccountName:mike.gordon

...这里是其他用户

我正在尝试使用LDAP用户名mike.gordon和“登录” gitlab窗格上的相应密码登录,但是却收到“无效的用户名或密码”。 一些屏幕截图显示一个LDAP窗格,但即使显示以下内容也不会显示: gitlab_rails ['prevent_ldap_sign_in'] = false

这是我的配置:

main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'LDAP'
host: 'myAdUrl'
port: 3268
uid: 'sAMAccountName'
bind_dn: 'CN=serveur-ovh,CN=Users,dc=ad,dc=mydomain,dc=com'
password: 'adpassword'
encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
active_directory: true
allow_username_or_email_login: false
base: 'dc=ad,dc=com'
user_filter: ''
#lowercase_usernames: false
#block_auto_created_users: false
#verify_certificates: true
#smartcard_auth: false
### EE only

非常感谢您的帮助。

解决方法

与您的配置进行比较,我有一个user_filter值

###! **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: 'LDAP'
host: 'ADHostname.example.com'
port: 636
uid: 'sAMAccountName'
method: 'ssl' # "tls" or "ssl" or "plain"
bind_dn: 'cn=UserID,ou=SystemAccounts,dc=example,dc=com'
password: 'AccountPasswordGoesHere'
active_directory: true
allow_username_or_email_login: false
block_auto_created_users: false
base: 'ou=ResourceUsers,dc=com'
user_filter: '(&(sAMAccountName=*))' # Can add attribute value to restrict authorized users to GitLab access,we leave open to all valid user accounts in the OU. Should be able to authorize based on group membership using linked attribute value like (&(memberOf=cn=group,ou=groupOU,dc=com))
attributes:
username: ['uid','userid','sAMAccountName']
email: ['mail','email','userPrincipalName']
name: 'cn'
first_name: 'givenName'
last_name: 'sn'

EOS