OpenLDAPをインストールしてみます。
setting
ここでつまった。。。
というか、設定の意味が理解できていなくて、
デフォルトで設定される内容が不明。。。
まず、yumインストールした後、
以下のファイルをコピー。
# cd /etc/openldap/ # cp -p /usr/share/openldap-servers/slapd.conf.obsolete slapd.conf
コピーしたslapd.confをベースに以下を修正。
設定ディレクトリについて
(変更前) # enable on-the-fly configuration (cn=config) database config access to * by dn.exact="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" manage by * none (変更後) # enable on-the-fly configuration (cn=config) database config rootdn "cn=admin,cn=config" rootpw {SSHA}******************************
パスワード設定
データディレクトリ管理者のパスワード設定
(変更前) database bdb suffix "dc=my-domain,dc=com" checkpoint 1024 15 rootdn "cn=Manager,dc=my-domain,dc=com" # 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 (変更後) database bdb suffix "dc=my-domain,dc=com" checkpoint 1024 15 rootdn "cn=Manager,dc=my-domain,dc=com" # 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}*******************************
パスワードの部分は以下のコマンドを利用します。
# slappasswd New password: Re-enter new password: {SSHA}************************
さらに、OpenLDAPが利用するBerkeley DBの設定について
サンプルファイルをコピーします。
# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
最後に以下のディレクトリを再作成します。
/etc/openldap/slapd.d/
# cd /etc/openldap/ # rm -rf slapd.d # mkdir slapd.d # chown -R ldap:ldap /etc/openldap/slapd.d/
この「/etc/openldap/slapd.d/」以下のファイルは
自動生成されたファイルみたいです。
例としては、以下のように手動で編集しないように書かれています。
またcheksumもあって、手動で編集して再起動すると
起動時に警告が出ました。
# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. # CRC32 5b937a8c dn: cn=config objectClass: olcGlobal cn: config
start
上記の設定ができたら、起動します。
# service slapd start slapd を起動中: [ OK ] #
ldapadd
起動したら、基本ディレクトリを登録します。
以下のようにファイルを作成します。
# cat init.ldif dn: dc=my-domain,dc=com objectclass: dcObject objectclass: organization o: test org dc: my-domain dn: cn=Manager,dc=my-domain,dc=com objectclass: organizationalRole cn: Manager
以下のコマンドを実行します。
# ldapadd -x -D "cn=Manager,dc=my-domain,dc=com" -W -f init.ldif
パスワードを確認されるので、入力したらデータが登録できます。
試しに検索のコマンドを実行してみました。
# ldapsearch -x -D "cn=Manager,dc=my-domain,dc=com" -W Enter LDAP Password: # extended LDIF # # LDAPv3 # base <> (default) with scope subtree # filter: (objectclass=*) # requesting: ALL # # search result search: 2 result: 32 No such object # numResponses: 1
とりあえず、動いてはいるようです。