Procure por "LDAP Settings" no arquivo gitlab.rd e insira o bloco abaixo ajustar as configurações de acordo com seu ambiente:
# vi /etc/gitlab/gitlab.rb
....
### LDAP Settings
###! Docs: https://docs.gitlab.com/ee/administration/auth/ldap/index.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['ldap_servers'] = YAML.load <<-'EOS'
main: # 'main' é o ID interno do servidor LDAP
label: 'LDAP'
host: '10.1.10.251'
port: 389
uid: 'uid'
bind_dn: 'uid=binddngitlab,cn=users,cn=accounts,dc=ipa,dc=domain,dc=internal'
password: '<SENHA>'
encryption: 'plain'
active_directory: false
allow_username_or_email_login: false
lowercase_usernames: true
block_auto_created_users: false
# Base de busca para usuários, abaixo os dois exemplos funcionam
#base: 'cn=users,cn=accounts,dc=ipa,dc=domain,dc=internal'
base: 'dc=ipa,dc=domain,dc=internal'
# Filtro opcional: apenas usuários de um grupo específico do IPA podem logar
user_filter: '(memberof=cn=g_user_gitlab,cn=groups,cn=accounts,dc=ipa,dc=domain,dc=internal)'
# Mapeamento de atributos
attributes:
username: ['uid']
email: ['mail']
name: ['displayName']
first_name: ['givenName']
last_name: ['sn']
EOS
....
Reconfigurar o GitLab:
# gitlab-ctl reconfigure
O comando abaixo ajuda realizar teste de funcionamento:
# 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)
DN: uid=<User>,cn=users,cn=accounts,dc=ipa,dc=domain,dc=internal uid: <User>
Checking LDAP ... Finished
Acesse a pagina do GitLab
https://hl155.domain.internal/
Procure por "LDAP Settings" no arquivo gitlab.rd e insira o bloco abaixo ajustar as configurações de acordo com seu ambiente:
# vi /etc/gitlab/gitlab.rb
....
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
main: # 'main' é o ID interno do servidor LDAP
label: 'LDAP'
host: 'hl251.ipa.domain.internal'
port: 636
uid: 'uid'
bind_dn: 'uid=binddngitlab,cn=users,cn=accounts,dc=ipa,dc=domain,dc=internal'
password: '<SENHA>'
encryption: 'simple_tls'
verify_certificates: true
active_directory: false
allow_username_or_email_login: false
lowercase_usernames: true
block_auto_created_users: false
# Base de busca para usuários, abaixo os dois exemplos funcionam
#base: 'cn=users,cn=accounts,dc=ipa,dc=domain,dc=internal'
base: 'dc=ipa,dc=domain,dc=internal'
# Filtro opcional: apenas usuários de um grupo específico do IPA podem logar
user_filter: '(memberof=cn=g_user_gitlab,cn=groups,cn=accounts,dc=ipa,dc=domain,dc=internal)'
# Mapeamento de atributos
attributes:
username: ['uid']
email: ['mail']
name: ['displayName']
first_name: ['givenName']
last_name: ['sn']
EOS
....
OBs.: Se usar o parâmetro host com o hostname do servidor e possível usar o parâmetro verify_certificates como true.
Acesse o servidor FreeIPA e visualize o conteúdo do arquivo ca.crt e copie:
# cat /etc/ipa/ca.crt
-----BEGIN CERTIFICATE-----
MIIEaTCCAtGgAwIBAgIQZbNHl8ltUkQOejUomjANBgkqhkiG9w0BAQsFADA+
.......
nhvKt3hXQyOTII8g+dBfGejqeoz8S8SiQb+g=
-----END CERTIFICATE-----
Acesse o servidor GitLab e crie um arquivo e cole o conteúdo do arquivo ca.crt do servidor FreeIPA:
# vi /etc/gitlab/trusted-certs/freeipa-ca.crt
-----BEGIN CERTIFICATE-----
MIIEaTCCAtGgAwIBAgIQZbNHl8ltUkQOejUomjANBgkqhkiG9w0BAQsFADA+
.......
nhvKt3hXQyOTII8g+dBfGejqeoz8S8SiQb+g=
-----END CERTIFICATE-----
Reconfigurar o GitLab:
# gitlab-ctl reconfigure
O comando abaixo ajuda realizar teste de funcionamento:
# 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)
DN: uid=<USER>,cn=users,cn=accounts,dc=ipa,dc=domain,dc=internal uid: <USER>
Checking LDAP ... Finished
Acesse a pagina do GitLab
https://hl155.domain.internal/