Setting up LDAP sign-in
If you have an LDAP directory service such as Active Directory, you can configure GitLab so that your users can sign in with their LDAP credentials. Add the following to /etc/gitlab/gitlab.rb
, edited for your server.
For GitLab Community Edition:
以下是我ldap的配置
### LDAP Settings
###! Docs: https://docs.gitlab.com/omnibus/settings/ldap.html
###! **Be careful not to break the indentation in the ldap_servers block. It is
###! in yaml format and the spaces must be retained. Using tabs will not work.**
gitlab_rails['ldap_enabled']
=
true
gitlab_rails['prevent_ldap_sign_in']
=
false
gitlab_rails['ldap_servers']
= YAML.load <<-EOS
main:
label:
'LDAP'
host:
'192.168.x.x'
port:
389
uid:
'cn'
encryption:
'plain'
bind_dn:
'cn=admin,dc=xxx,dc=com'
password:
'xxx'
smartcard_auth:
false
active_directory:
true
allow_username_or_email_login:
true
lowercase_usernames:
false
-
base:
'ou=People,dc=xxx,dc=com'
user_filter:
''
EOS
gitlab-ctl reconfigure
gitlab-ctl restart