LoginSignup
2
1

More than 5 years have passed since last update.

GitLabでLDAPSを使う

Posted at

GitLabのユーザ認証にLDAPを使うケースは、社内運用なら結構あると思う。
そこで、どうせならSSL/TLSを組み合わせたLDAPSを使おうというお話

構築環境

  • Ubuntu16.04 LTS
  • GitLab v10.5.2

:warning:今回は、Let's Encryptではなく、社内のRoot CAを使ったLDAPS認証を目指す。

GitLab 10.5でLet's Encryptがものすごく使いやすくなったっぽいので、気になる人はそちらもチェック
GitLab 10.5 released with Let's Encrypt integration
Let's Encrypt Integration

導入手順

ルート証明書のインストール

$ sudo cp hoge.crt /etc/gitlab/trusted-certs/ #hoge.crtがルート証明書

$ sudo gitlab-ctl reconfigure

gitlab-ctl reconfigure後に、/opt/gitlab/embedded/ssl/certs/へシンボリックリンクが作成される。
セキュリティの観点からか、シンボリックリンクの名前は乱数っぽい名前になっており、元のRoot証明書と同じファイル名でない。

LDAPS設定

基本的に、GitLabのLDAP設定に従うだけで良い。
ここでは通常のLDAP設定は、できているものとして一部の設定を割愛する。

/etc/gitlab/gitlab.rb
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-EOS # remember to close this block with 'EOS' below
main: # 'main' is the GitLab 'provider ID' of this LDAP server
  # usually 636 for SSL
  port: 636
  #   Deprecated values: "tls" was replaced with "start_tls" and "ssl" was
  #   replaced with "simple_tls".
  encryption: 'start_tls'
  verify_certificates: true
  # Specifies the path to a file containing a PEM-format CA certificate,
  # e.g. if you need to use an internal CA.
  #
  #   Example: '/etc/ca.pem'
  ca_file: ''
  # Specifies the SSL version for OpenSSL to use, if the OpenSSL default
  # is not appropriate.
  #
  #   Example: 'TLSv1_1'
  ssl_version: 'TLSv1_1'
EOS
  • port: 636
    • 通常ポート番号は636で良い。
  • encryption: 'start_tls'
    • start_tls : TLSを使用する。
    • simple_tls : SSLを使用する。
    • plain : 暗号化しないので、まず設定しない。
  • verify_certificates: true
    • 設定した証明書が正しいかLDAPサーバと認証を行う。
    • 認証しない理由がないのでtrueで良い。
  • ca_file: /etc/hoge.pem
    • 試してないけど、ここで証明書設定すればいいのかも
  • ssl_version: 'TLSv1_1'
    • 使用するSSL/TLSのバージョン指定

GitLabの再設定

みんな大好きgitlab-ctl reconfigureで終わり

$ sudo gitlab-ctl reconfigure

終わったときには、LDAPSでユーザ認証ができる。

2
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
2
1