LoginSignup
2
3

More than 5 years have passed since last update.

CentOS 6.7 で OpenLDAP サーバーを構築

Last updated at Posted at 2016-04-05

基本設定

以下の設定でLDAPサーバーを構築するものとする

項目 設定値
基本ドメイン example.co.jp
管理者のDN cn=Manager, dc=example, dc=co, dc=jp
管理者のパスワード password
管理者のパスワードのhash値(※) {SSHA}WYEroAc4FZocN2Qn6fzV08nlu/IwKG7h

※ slappasswdコマンドで確認する

# slappasswd -s password
{SSHA}WYEroAc4FZocN2Qn6fzV08nlu/IwKG7h

パッケージのインストール

# yum install openldap openldap-servers openldap-clients

デフォルト設定ファイルの配置

# cp -pr /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf
# cp -pr /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG

※ 一時的な設定ファイル(slapd.conf)は、上記のパスに置いて運用するものとする。

設定値の変更

ドメイン

suffixの値を変更する

(snip)
database        bdb
suffix          "dc=example,dc=co,dc=jp"
(snip)

管理者

rootdnとrootpwの値を変更する

rootdn          "cn=Manager,dc=example,dc=co,dc=jp"
# Cleartext passwords, especially for the rootdn, should
# be avoided.  See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
# rootpw                secret
# rootpw                {crypt}ijFYNcSNctBYg
rootpw          {SSHA}WYEroAc4FZocN2Qn6fzV08nlu/IwKG7h

※ monitorをしたければ、そちらの方も変更する必要があるかもしれない(未確認)

設定ファイルを slap.d/ ディレクトリ配下に変換

サービス起動時に、/etc/openldap/slapd.d ディレクトリがあれば、sladp.confディレクトリ下の設定ファイルが優先されて読み込まれるので、/etc/slapd.conf を /etc/openldap/slapd.d/ 以下のフォーマットに変換する

slapd.conf のテスト

# slaptest -f /etc/openldap/slapd.conf
config file testing succeeded

パッケージインストール時に追加された初期設定ファイルを削除

# rm -rf /etc/openldap/slapd.d/*

変換とパーミッション変更

# slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
config file testing succeeded

# chown -R ldap. /etc/openldap/slapd.d

サービス起動

# /etc/rc.d/init.d/slapd start
Starting slapd:                                            [  OK  ]
2
3
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
3