比較バージョン

キー

  • この行は追加されました。
  • この行は削除されました。
  • 書式設定が変更されました。

...

OpenLDAPは、バージョンによって設定の方法が変わっています。バージョン2.2まではslapd.confに設定内容を定義していましたが、バージョン2.3以降で非推奨となりディレクトリサービス上に設定を格納するようになりました。
下記は、slapdCentOS 5標準のOpenLDAPは2.confで設定する方法(22までのslapd.2まで)と、ディレクトリサービス上に設定する方法(2.3以降)を記載しています。
※CentOS5標準のOpenLDAPは2.2までとなっています。
※CentOS6標準のOpenLDAPは2.3以降となり、ディレクトリサービス上で設定が行えるようになっています。confによる設定方法を採っています。
CentOS 6標準のOpenLDAPは2.3以降の、ディレクトリサービス上での設定を基本としています。
下記では、slapd.confで設定する方法(CentOS 5まで)と、ディレクトリサービス上に設定する方法(CentOS 6以降)を併記しています。

 

...

0. OpenLDAPパッケージの確認

/etc/openldap/schemaディレクトリが存在しない場合は、以下のようにしてOpenLDAPパッケージをインストールしてください。

...

インストール後、自動起動の設定を行います。

展開
titleバージョン2.3以降の場合CentOS 6以降の場合
パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# chkconfig --level 345 slapd on
展開
titleバージョン2.2までの場合CentOS 5までの場合
パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# chkconfig --level 345 ldap on

...

2. LDAPサーバのデフォルト設定

 

展開
titleバージョン2.3以降の場合CentOS 6以降の場合

ディレクトリサービス上に設定する方法は、slapd.confから変換する方法もありますが、ここではディレクトリサービスのインタフェースを介した手順を説明します。

・LDAPサーバの起動
  事前に起動させておく必要があります。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# service slapd start

 ・データベースの設定
  初期登録されている既存のドメイン情報を変更して、使用します。
  以下のような内容で、ドメイン情報変更用のldifファイルを作成します。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
dn: olcDatabase={1}monitor,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to *  by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read  by dn.base="cn=olmgr,o=test_o,dc=ac,c=JP" read  by * none

dn: olcDatabase={2}bdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: o=test_o,dc=ac,c=JP		←suffix
-
replace: olcRootDN
olcRootDN: cn=olmgr,o=test_o,dc=ac,c=JP	←rootdn
-
add: olcRootPW
olcRootPW: {CRYPT}olagW85bjtaKc$6$6e4.Of8k69uRYHNq$MxtzkEmGh7sFN7hdumuXyx8PsHqNCs3Mf9sdRcAytz3xs7sbZGathb9G5oc/vrm1zOc7kwVZScy02SJxDGDs60		←rootパスワード(暗号化したもの)

  ここで設定したolcRootPWは、LDAPのデータベースに対する管理者パスワードです。
  また、このパスワードは IdPの設定ファイルにも記述します。(後述)

 ※暗号化の例:

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
「csildap」というパスワードを暗号化
# slappasswd -h {cryptCRYPT} -c '$6$%s$' -s csildap

{CRYPT}olagW85bjtaKc    ←これをドメイン情報変更用ldifのolcRootPWに記載$6$6e4.Of8k69uRYHNq$MxtzkEmGh7sFN7hdumuXyx8PsHqNCs3Mf9sdRcAytz3xs7sbZGathb9G5oc/vrm1zOc7kwVZScy02SJxDGDs60
↑これをドメイン情報変更用ldifのolcRootPWに記載

 以下のコマンドを実行して、ドメイン情報を変更します。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# ldapmodify -Y EXTERNAL -H ldapi:// -f ドメイン情報変更用のldifファイルパス

 ・eduPersonスキーマの登録
  スキーマの登録においてもディレクトリサービスのインタフェースを介した手順となります。
  ldifファイルより行うため、eduPersonスキーマを使ってldifファイルを作成します。
  以下のような内容で、ldifファイル作成に必要な設定ファイルを作成します。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
include /etc/openldap/schema/eduperson.schema

  以下のコマンドを実行して、eduPersonスキーマのldifファイルを作成します。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# slapcat -f 作成した設定ファイルのパス -F /tmp -n0 -s "cn={0}eduperson,cn=schema,cn=config" > /etc/openldap/schema/eduperson.ldif

   作成したldifファイルから余分な情報を削除します。
  以下の手順に従って、/etc/openldap/schema/eduperson.ldifを編集してください。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
  ・ファイル先頭にある {0}eduperson を eduperson に修正
    以下は、修正後の内容です。
    dn: cn=eduperson,cn=schema,cn=config
    objectClass: olcSchemaConfig
    cn: eduperson
  
  ・ファイルの後方にある「structuralObjectClass: olcSchemaConfig」以降を全て削除
    以下は、削除対象の項目です。
    structuralObjectClass: olcSchemaConfig
    entryUUID: 		・・・ (省略)
    creatorsName: 	・・・ (省略)
    createTimestamp: 	・・・ (省略)
    entryCSN: 		・・・ (省略)
    modifiersName: 	・・・ (省略)
    modifyTimestamp: 	・・・ (省略)

   以下のコマンドを実行して、edupersonスキーマを登録します。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/schema/eduperson.ldif
展開
titleバージョン2.2までの場合CentOS 5までの場合

/etc/openldap/slapd.conf を変更します。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
(省略)
include /etc/openldap/schema/eduperson.schema ←入手したスキーマファイルを追加

suffix   "o=test_o,dc=ac,c=JP"		←suffix
rootdn   "cn=olmgr,o=test_o,dc=ac,c=JP"	←rootdn
rootpw   {CRYPT}olagW85bjtaKc			←rootパスワード(暗号化したもの)

ここで設定したパスワードは IdPの設定ファイルにも記述します。(後述)

※暗号化の例:

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
「csildap」というパスワードを暗号化
# slappasswd -h {crypt} -s csildap
{CRYPT}olagW85bjtaKc    ←これをslapd.confのrootpwに記載

 設定後、LDAPサーバを起動します。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# service ldap start

...

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
dn: o=test_o,dc=ac,c=JP
objectClass: organization
o: test_o

dn: ou=Test Unit1,o=test_o,dc=ac,c=JP objectClass: organizationalUnit ou: Test Unit1 dn: ou=Test Unit2,o=test_o,dc=ac,c=JP objectClass: organizationalUnit ou: Test Unit2 dn: ou=Test Unit3,o=test_o,dc=ac,c=JP objectClass: organizationalUnit ou: Test Unit3 dn: uid=test001,ou=Test Unit1,o=test_o,dc=ac,c=JP objectClass: eduPerson objectClass: inetOrgPerson uid: test001 ou: Test Unit1 ou;lang-ja: テスト001_学部1 sn: test001_sn sn;lang-ja: テスト001_sn cn: test001_cn userPassword: test001 givenName: test001_givenname givenName;lang-ja: テスト001_givenname displayName: test001_displayname displayName;lang-ja: テスト001_displayname mail: test001_email@nii.ac.jp eduPersonAffiliation: member dn: uid=test002,ou=Test Unit2,o=test_o,dc=ac,c=JP objectClass: eduPerson objectClass: inetOrgPerson uid: test002 ou: Test Unit2 ou;lang-ja: テスト002_学部2 sn: test002_sn sn;lang-ja: テスト002_sn cn: test002_cn userPassword: test002 givenName: test002_givenname givenName;lang-ja: テスト002_givenname displayName: test002_displayname displayName;lang-ja: テスト002_displayname mail: test002_email@nii.ac.jp eduPersonAffiliation: faculty dn: uid=test003,ou=Test Unit3,o=test_o,dc=ac,c=JP objectClass: eduPerson objectClass: inetOrgPerson uid: test003 ou: Test Unit3 ou;lang-ja: テスト003_学部3 sn: test003_sn sn;lang-ja: テスト003_sn cn: test003_cn userPassword: test003 givenName: test003_givenname givenName;lang-ja: テスト003_givenname displayName: test003_displayname displayName;lang-ja: テスト003_displayname mail: test003_email@nii.ac.jp eduPersonAffiliation: student

...