比較バージョン

キー

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

本ページはIdPテスト用のLDAPサーバ構築を行うものですので、別途構築されているLDAPサーバに接続する場合は不要です。次ページより先に進んでください。

OpenLDAPの設定

OpenLDAPは、バージョンによって設定の方法が変わっています。バージョン2.2まではslapd.confに設定内容を定義していましたが、バージョン2.3以降で非推奨となりディレクトリサービス上に設定を格納するようになりました。
CentOS 5標準のOpenLDAPは2.2までのslapd.confによる設定方法を採っています。
CentOS 6標準のOpenLDAPは23以降で非推奨となりディレクトリサービス上に設定を格納するようになりました。CentOS 6と7標準のOpenLDAPは2.3以降の、ディレクトリサービス上での設定を基本としています。
以下ではCentOS 6を想定してディレクトリサービス上に設定する方法で記述しています。CentOS 5をご使用の場合は適宜読み替えてください。 7を想定してディレクトリサービス上に設定する方法で記述しています。


...

0. OpenLDAPパッケージの確認

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

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# yum install openldap-clients openldap-servers

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

パネル
borderColor#cccccc
bgColor#eeeeee
titleBGColor#ffffff
borderStylesolid
titleCentOS7の場合
# systemctl enable slapd
展開
titleCentOS6の場合
パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# chkconfig --level 345 slapd on

 

...


...

1. 追加のスキーマファイル

以下のURLには、edupersonスキーマの内容が記載されています。
/etc/openldap/schema 配下に「eduperson.schema」を作成し、スキーマの内容をコピーしてください。
※edupersonスキーマの追加は必須ではありません。
(既に統合認証基盤が構築されており、必要な属性値が存在する場合など)

https://spaces.at.internet2.edu/display/macedir/OpenLDAP+eduPerson 


...

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

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

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

パネル
borderColor#cccccc
bgColor#eeeeee
titleBGColor#ffffff
borderStylesolid
titleCentOS7の場合
# systemctl start slapd
展開
titleCentOS6の場合
パネル
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}bdbhdb,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}$6$6e4.Of8k69uRYHNq$MxtzkEmGh7sFN7hdumuXyx8PsHqNCs3Mf9sdRcAytz3xs7sbZGathb9G5oc/vrm1zOc7kwVZScy02SJxDGDs60		←rootパスワード(暗号化したもの)

...

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/schema/eduperson.ldif

 

...



...

3. LDAPのテストデータ作成

以下のサンプルを基に、テスト用データを作成し、LDAPへ登録します。
Shibboleth を利用したID/パスワードでの認証に使用されるIDはuid 、パスワードは userPassword になります。
※IDに使用する属性については、ldap.propertiesidp.authn.LDAP.userFilterの修正で他の属性に変更できます。
 ただし、同様に送信属性値取得の設定がattribute-resolver.xmlもしくはldap.propertiesのidp.attribute.resolver.LDAP.searchFilterで行われており、
 こちらのLDAP検索キーも同様に変更しなければ不整合が起きるので、注意してください。 


・test.ldif ファイル作成
  ※環境にもよりますが、文字コードは「UTF-8」で作成してください。

パネル
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 employeeNumber: 0001

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 employeeNumber: 0002

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
employeeNumber: 0003 

・LDAPへの登録

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
# ldapadd -x -h localhost -D "cn=olmgr,o=test_o,dc=ac,c=JP" -w csildap -f test.ldif
注意

ldapaddコマンドで以下のエラーが出る場合は

書式設定済み
adding new entry "uid=test001,ou=Test Unit1,o=test_o,dc=ac,c=JP"
ldap_add: Invalid syntax (21)
    additional info: objectClass: value #1 invalid per syntax

以下のコマンドでスキーマを読み込んで、さらにtest.ldifのtest001より上の行を削除から、再度お試しください。

パネル

# ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/schema/cosine.ldif
# ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/schema/inetorgperson.ldif


Prevnextbuttons