我正在尝试为我们的 GitLab 添加 LDAP 功能。我们有一个运行在 Windows 上的 ActiveDirectoy 服务器。Gitlab 本身托管在 ubuntu 服务器机器上。对于身份验证,我们在广告服务器上创建了一个 serverice-user。这是我的gitlab.rb文件(仅显示 ldap 配置。)
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
main:
label: 'LDAP'
host: '1.2.3.4'
port: 389
uid: 'serviceAcc'
bind_dn: 'CN=serviceACC,OU=Org 1,DC=organisation,DC=com'
password: 'supersecurePass'
encryption: 'plain'
active_directory: true
EOS
未列出的选项被注释掉(因此将使用默认值)。接下来我执行这两个命令:
sudo gitlab-ctl reconfigure
sudo gitlab-rake gitlab:ldap:check
这是最后一条命令的结果:
Checking LDAP ...
LDAP: ... Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
Checking LDAP ... Finished
为什么我的列表是空的?不应该列出广告的所有用户吗?我还尝试应用存储用户的 base_dn 选项。
如果我做一个lsdapsearch我得到结果:
ldapsearch -H ldap://1.2.3.4 -x -W -D "serviceAcc@organisation.com" -b "dc=organisation,dc=com" "(objectClass=user)" mail
.
.
.
# serviceACC, Org 1, organisation.com
dn: CN=serviceACC,OU=Org 1,DC=organisation,DC=com
.
.
.
所以 AD 服务器可以访问并响应我的 ldapsearch 查询。我在 gitlab.rb 配置中遗漏了什么吗?
我正在使用版本 12.5.3 的 gitlab EE
更新 以下是@EricLavault 要求的详细信息:
- 用户名:user.1 ; dn:CN=用户 1,OU=公司员工,DC=公司,DC=com
- 用户提交其 AD 凭据:用户名:user.1 PW:#his AD-PW#
- 对于错误日志,我可以为您提供 production.log。如果您需要更多日志,请告诉我:
Started POST "/users/auth/ldapmain/callback" for 1.2.3.8 at 2019-12-11-07:48:59 +0000 Processing by OmniauthCallbacksController#failure as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "username"=>"user.1", "password"=>"[FILTERED]"} Redirected to https://git.company.com/users/sign_in
出于安全原因,我必须用虚拟值更改实际值。但请相信我,提供的用户详细信息与实际值相似。(带有“.”的用户名,服务用户在另一个OU中,而不是将登录到gitlab的用户)
将向用户显示以下错误消息:
无法从 Ldapmain 对您进行身份验证,因为“user.1 的凭据无效”。
凭据是正确的。