0%

gitlab 集成 ldap

修改配置文件

vim /etc/gitlab/gitlab.rb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'LDAP'
host: '10.0.2.1'
port: 389
uid: 'SamAccountName'
bind_dn: 'cn=bkapi,ou=Admin,ou=jusda,dc=jusda,dc=int'
password: 'uYKmhz53fhF1'
encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
verify_certificates: true
smartcard_auth: false
active_directory: true
allow_username_or_email_login: true
lowercase_usernames: false
block_auto_created_users: false
base: 'ou=jusda,dc=jusda,dc=int'
user_filter: ''
EOS

重启gitlab

加载配置文件

1
gitlab-ctl reconfigure

检查配置文件

1
gitlab-rake gitlab:ldap:check

重启gitlab

1
gitlab-ctl restart

问题

如检测配置文件失败

1
2
3
4
5
6
7
安装ldapsearch 工具检查

### 安装ldapsearch
yum install openldap-servers openldap-clients -y

### 检测
ldapsearch -x -H ldap://10.0.2.1:389 -b "CN=bkapi,OU=Admin,OU=JUSDA,DC=JUSDA,DC=INT" -D "CN=bkapi,OU=Admin,OU=JUSDA,DC=JUSDA,DC=INT" -w uYKmhz53fhF1