LoginSignup
0
1

More than 5 years have passed since last update.

GitLab10×LDAP Integration on CentOS7

Posted at

概要

社内のGitlabが古いので最新のGitLabEnterpriseEditionを検証しました
LDAP連携で手こずったところがあるので共有します

GitLabは現時点最新のVer10
LDAPはAWS Directory Service の SimpleAD
OSはCentOS7

インストール

一応インストール方法載せておきます
OSの設定などは省きます

# sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee

コンフィグ

動いた例をそのまま記載。設定不要な箇所はあるはずなのでそこは注意して下さい。

# vim /etc/gitlab/gitlab.rb

gitlab_rails['ldap_enabled'] = true ※有効にする
###! **remember to close this block with 'EOS' below**
gitlab_rails['ldap_servers'] = YAML.load <<-EOS
  main:
    label: 'LDAP'  ※デフォルト
    host: 10.0.0.209 ※SimpleADでいうとDNSアドレスの値です
    port: 389  ※デフォルト
    uid: 'sAMAccountName'  ※デフォルト
    bind_dn: 'CN=Administrator,CN=Users,DC=hoge,DC=fuga,DC=net' ※AD接続ユーザdistinguishedName。とりあえずAD上のAdministoratorにした
    password: 'passsword_hoge' ※AD上のAdministoratorのパスワード
    encryption: 'plain' # "start_tls" or "simple_tls" or "plain" ※デフォルト
    verify_certificates: true ※デフォルト
    ca_file: '' ※デフォルト
    ssl_version: '' ※デフォルト
    active_directory: true ※有効にする
    allow_username_or_email_login: true ※デフォルト
    block_auto_created_users: false ※デフォルト
    base: 'DC=hoge,DC=fuga,DC=net' ※ユーザ検索ルート。不要らしいが一応設定した
    user_filter: '' ※デフォルト
#    attributes:
#      username: ['uid', 'userid', 'sAMAccountName']
#      email:    ['mail', 'email', 'userPrincipalName']
#      name:       'cn'
#      first_name: 'givenName'
##      last_name:  'sn'
    ## EE only
    group_base: '' ※デフォルト
    admin_group: '' ※デフォルト
    sync_ssh_keys: false ※デフォルト


#   secondary: # 'secondary' is the GitLab 'provider ID' of second LDAP server
#     label: 'LDAP'
#     host: '_your_ldap_server'
#     port: 389
#     uid: 'sAMAccountName'
#     bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
#     password: '_the_password_of_the_bind_user'
#     encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
#     verify_certificates: true
#     ca_file: ''
#     ssl_version: ''
#     active_directory: true
#     allow_username_or_email_login: false
#     block_auto_created_users: false
#     base: ''
#     user_filter: ''
#     attributes:
#       username: ['uid', 'userid', 'sAMAccountName']
#       email:    ['mail', 'email', 'userPrincipalName']
#       name:       'cn'
#       first_name: 'givenName'
#       last_name:  'sn'
#     ## EE only
#     group_base: ''
#     admin_group: ''
#     sync_ssh_keys: false
EOS

設定を有効

# gitlab-ctl reconfigure

注意

ここが躓いたところ。いくら

# gitlab-ctl restart

を実行したところで有効にならなかった。やはり公式のマニュアルを確認するのが一番ですね~

公式マニュアルLDAP連携
https://docs.gitlab.com/omnibus/settings/ldap.html#setting-up-ldap-sign-in

成功した場合のログイン画面

image.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1