无效凭据 – git社区版中的LDAP访问错误

我想设置版本控制和持续集成的git。

我使用docker-compose文件安装了git社区版,如https://docs.gitlab.com/omnibus/docker/README.html#install-gitlab-using-docker-compose的第2步所述。 我的docker-compose.yml文件如下所示:

web: image: 'gitlab/gitlab-ce:latest' container_name: git restart: always hostname: 'gitserver' environment: GITLAB_OMNIBUS_CONFIG: | external_url 'https://gitserver.local' # Add any other gitlab.rb configuration here, each on its own line ports: - '80:80' - '443:443' - '22:22' volumes: - '/srv/gitlab/config:/etc/gitlab' - '/srv/gitlab/ssl:/etc/gitlab/ssl' - '/srv/gitlab/logs:/var/log/gitlab' - '/srv/gitlab/data:/var/opt/gitlab' 

我修改了/srv/gitlab/config/gitlab.rb以包含LDAP:

 gitlab_rails['ldap_enabled'] = true ###! **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: 'xxxx' port: 636 uid: 'sAMAccountName' method: 'ssl' # "tls" or "ssl" or "plain" bind_dn: 'CN=git ldap,OU=Utility Accounts,OU=San Diego,OU=MYDOMAIN,DC=MYCOMPANY,DC=local' password: 'MyPwd' active_directory: true allow_username_or_email_login: false block_auto_created_users: false base: 'CN=git ldap,OU=Utility Accounts,OU=San Diego,OU=MYDOMAIN,DC=MYCOMPANY,DC=local' EOS 

login时出现以下错误:

 Could not athenticate you from LDAPmain because invalid credentials 

/srv/gitlab/logs/gitlab-rails/production.log显示:

 Started POST "/users/auth/ldapmain/callback" for xxxx at 2017-07-10 21:11:06 +0000 Processing by OmniauthCallbacksController#failure as HTML Parameters: {"utf8"=>"â", "authenticity_token"=>"BKIQtjz0mu0JlS5bDLGssJFeKGFOJ2cLPKSKAc5JqeyLPBQUkhuI0qcjOTZ9osQEqqlCzPn/PNDlreeENnN28A==", "username"=>"xxx", "password"=>"[FILTERED]"} Redirected to https://gitserver.local/users/sign_in Completed 302 Found in 5ms (ActiveRecord: 0.3ms) Started GET "/users/sign_in" for xxxx at 2017-07-10 21:11:06 +0000 Processing by SessionsController#new as HTML Completed 200 OK in 143ms (Views: 92.4ms | ActiveRecord: 3.0ms) 

我已经尝试了LDAP设置的几个排列组合,但似乎没有任何工作。 用户在网上有几个类似的设置/错误和build议,他们如何解决他们的问题,但似乎没有为我工作。

我尝试的一些事情是1)注释绑定DN和密码2)设置UID而不是SAMAccountName的UID 3)尝试普通和SSL的方法4)设置allow_username_or_email_login为false。

该公司的其他应用程序使用相同的LDAP设置..所以没有错。

过去一周我一直在撞墙。 任何帮助表示赞赏。

谢谢!

更新:我试图followign,但没有运气1) Gitlab:LDAP“无效的凭据”,但凭据是正确的 2) Gitlab LDAP身份validation

更新2:请注意,只能以git ldap身份login,而不能以自己身份login。 我希望每个人都用自己的凭据login

请注意绑定DN和底部DN是完全一样的。 有基地DN的CN只允许该用户login。 将其更改为“OU = MYDOMAIN,DC = MYCOMPANY,DC = local”允许所有用户login