无法从 Ldapmain 对您进行身份验证,因为 "Invalid credentials for <username>" - 通过 Helm Chart 安装的 Gitlab 社区版

Could not authenticate you from Ldapmain because "Invalid credentials for <username>" - Gitlab Community Edition installed via Helm Chart

我有 installed Gitlab CE using Helm, but our AD users can't login to the platform. The following error is shown in the login UI: Could not authenticate you from Ldapmain because "Invalid credentials for userX" Invalid credentials for user(但凭据没问题!)

安装

helm upgrade --install gitlab gitlab/gitlab --namespace my-ns --tiller-namespace tiller-ns  --timeout 600 --set global.edition=ce --set global.hosts.domain=example.com --set global.hosts.externalIP=<ExternalIPAddressAllocatedToTheNGINXIngressControllerLBService> --set nginx-ingress.enabled=false --set global.ingress.class=mynginx-ic --set certmanager.install=false --set global.ingress.configureCertmanager=false --set gitlab-runner.install=false --set prometheus.install=false --set registry.enabled=false --set gitlab.gitaly.persistence.enabled=false --set postgresql.persistence.enabled=false --set redis.persistence.enabled=false --set minio.persistence.enabled=false --set global.appConfig.ldap.servers.main.label='LDAP' --set global.appConfig.ldap.servers.main.host=<IPAddressOfMyDomainController> --set global.appConfig.ldap.servers.main.port='389' --set global.appConfig.ldap.servers.main.uid='sAMAccountName' --set global.appConfig.ldap.servers.main.bind_dn='CN=testuser,OU=sampleOU3,OU=sampleOU2,OU=sampleOU1,DC=example,DC=com' --set global.appConfig.ldap.servers.main.password.secret='gitlab-ldap-secret' --set global.appConfig.ldap.servers.main.password.key='password' 

备注:
-我之前已经单独安装了自己的 NGINX Ingress Controller:

helm install stable/nginx-ingress --name nginx-ingress --namespace my-ns --tiller-namespace tiller-ns --set controller.ingressClass=mynginx-ic  

-我之前已经为配置为 bind_dn ('CN=testuser,OU=sampleOU3,OU=sampleOU2,OU=sampleOU1,DC=example,DC=com') 的用户创建了密码密码。密码使用base64编码,如the documentation

所示

文件:gitlab-ldap-secret.yaml

apiVersion: v1  
kind: Secret  
metadata:  
 name: gitlab-ldap-secret  
data:  
 password: encodedpass-blablabla 

-我没有在图表安装期间在命令行中提供所有这些参数,而是尝试在 this Gitlab Helm chart 提供的各种 values.yaml 中配置所有内容,但在这里记录似乎更容易这样,用于复制目的。

-我试过添加这些参数,没有成功:

--set global.appConfig.ldap.servers.main.encryption='plain'  
--set global.appConfig.ldap.servers.main.base='OU=sampleOU1,DC=example,DC=com'  

-为了让它更简单,我们不考虑任何组件的持久性。这就是为什么,这些都设置为 false:

--set gitlab.gitaly.persistence.enabled=false  
--set postgresql.persistence.enabled=false  
--set redis.persistence.enabled=false  
--set minio.persistence.enabled=false   

*我确实需要持久性,但这次我们只关注 LDAP 身份验证,这是我目前的主要问题。

-我已与我的系统管理员核实过,我们在 Active Directory 中使用纯 389。无加密

我的环境

kubectl.exe version  
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T09:18:22Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"windows/amd64"}  
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T09:09:21Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}  

helm version  
Client: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}  
Server: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}  

helm ls --tiller-namespace tiller-ns  
NAME                    REVISION        UPDATED                         STATUS          CHART                   APP VERSION     NAMESPACE
gitlab                  1               Tue Oct 29 18:16:06 2019        DEPLOYED        gitlab-2.3.7            12.3.5          my-ns

kubectl.exe get nodes
NAME                                    STATUS   ROLES    AGE     VERSION
kubernetes01.example.com                Ready    master   102d    v1.15.1
kubernetes02.example.com                Ready    <none>   7h16m   v1.15.1
kubernetes03.example.com                Ready    <none>   102d    v1.15.1
kubernetes04.example.com                Ready    <none>   11d     v1.15.1

安装此图表后,一切正常:

kubectl.exe get pods
NAME                                                   READY   STATUS      RESTARTS   AGE
gitlab-gitaly-0                                        1/1     Running     0          65m
gitlab-gitlab-exporter-5b649bfbb-5pn7q                 1/1     Running     0          65m
gitlab-gitlab-shell-7d9497fcd7-h5478                   1/1     Running     0          65m
gitlab-gitlab-shell-7d9497fcd7-jvt9p                   1/1     Running     0          64m
gitlab-migrations.1-gf8jr                              0/1     Completed   0          65m
gitlab-minio-cb5945f79-kztmj                           1/1     Running     0          65m
gitlab-minio-create-buckets.1-d2bh5                    0/1     Completed   0          65m
gitlab-postgresql-685b68b4d7-ns2rw                     2/2     Running     0          65m
gitlab-redis-5cb5c8b4c6-jtfnr                          2/2     Running     0          65m
gitlab-sidekiq-all-in-1-5b997fdffd-n5cj2               1/1     Running     0          65m
gitlab-task-runner-5777748f59-gkf9v                    1/1     Running     0          65m
gitlab-unicorn-764f6548d5-fmggl                        2/2     Running     0          65m
gitlab-unicorn-764f6548d5-pqcm9                        2/2     Running     0          64m

现在,如果我尝试使用 LDAP 用户登录,我会收到前面提到的错误。如果我进入 unicorn pod,我可以在 /var/log/gitlab/production.log 中看到以下消息: Production.log

我错过了什么?我还需要配置什么吗?我已经配置了提到的 LDAP 身份验证的所有参数 here,但我仍然无法尝试进行身份验证。

抱歉,我是 Gitlab 及其所有内部组件的新手。我似乎找不到在哪里编辑这个文件,例如:/etc/gitlab/gitlab.rb我应该进入哪个 pod?我逐字逐句地输入了每个 pod,但没有找到这个配置文件).另外,我注意到一些文档说可以执行一些诊断工具,例如 gitlab-rake gitlab:ldap:check,或 gitlab-ctl reconfigure 等实用程序,但同样......在哪里 运行 这些??在独角兽吊舱上? gitlab-shell?我注意到各种 Gitlab 文档页面都引用了其中一些工具来解决问题,但我不认为这个图表遵循相同的架构。

例如,我查看了 ,因为它似乎是同一个问题,但我找不到 /etc/gitlab/gitlab.rb

任何帮助将不胜感激。自从我处理这个问题以来已经有几个星期了。

我忘了回答这个问题。我设法通过再次添加基本参数解决了这个问题。

我已经按照我原来的 post 中的解释尝试了这个,但事实证明我需要转义逗号:

--set global.appConfig.ldap.servers.main.base='OU=sampleOU1\,DC=example\,DC=com'

*和你的bind_dn一样,逗号需要转义。

多亏了 LDAP 诊断工具 gitlab-rake,我才意识到这一点,在这个 helm chart 中它有点不同。你必须进入 unicorn 容器的 /srv/gitlab 目录,然后执行 ./bin/rake gitlab:ldap:check。这帮助我了解了问题出在哪里。您还可以检查 /srv/gitlab/config/gitlab.yaml 文件以查看您的 LDAP 参数是否成功 loaded/parsed.

您还可以运行以下命令来查看有关您的 Gitlab 部署的更多信息:./bin/rake gitlab:env:info