2007.10.11 Thursday
openLDAP 構築(13) - クライアント設定(リモートホスト)
以下の設定は、リモートホスト(openLDAP サーバー以外のホスト)上で行います。
- ldap ユーザーが見つけられないことを確認します。
[root]# id gamba id: gamba: no such user
- 「ldap.conf」 を編集します。
[root]# cd /etc [root]# cp ldap.conf ldap.conf.org [root]# vi ldap.conf (コメント行は、ここでは省略しています) host 10.1.1.15 # LDAPサーバのホスト名またはIPアドレス base dc=examples,dc=com timelimit 120 bind_timelimit 120 idle_timelimit 3600 pam_filter objectclass=posixAccount pam_password md5
スレーブへの参照を追加する場合
「host」 に以下のようにマスターとスレーブの IPアドレス(もしくはホスト名) を記述すると、冗長性を持たせることができます。
host 10.1.1.15 10.1.1.16 10.1.2.17 または host test15.examples.com test16.examples.com test17.examples.com
- 「10.1.1.15」 が停止している場合 「10.1.1.16」 を参照し、「10.1.1.16」 も停止している場合 「10.1.2.17」 を参照します。
- 必ずしもマスターを先に記述しなくてもよく、参照する優先順に書けばよい。
- 但し、LDAPエントリーの更新は、あくまでもマスターに対してのみ行われる。
- 「nsswitch.conf」 を編集します。
[root]# vi /etc/nsswitch.conf (省略) passwd: files ldap shadow: files ldap group: files ldap (省略)
- ldap ユーザーが見つけられることを確認します。
[root]# id gamba uid=1001(gamba) gid=1001(gyomu) groups=1001(gyomu)
- getent コマンドで、passwd、group、shadow テーブルを参照してみます。
[root]# getent passwd (/etc/passwd のリストと ldap テーブルのリストが出ます。) root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin (省略) gamba:x:1001:1001:gamba user:/home/gamba:/bin/bash
[root]# getent group (/etc/group のリストと ldap テーブルのリストが出ます。) root:x:0:root bin:x:1:root,bin,daemon (省略) gyomu:x:1001:n
[root]# getent shadow (/etc/shadow のリストと ldap テーブルのリストが出ます。) root:xxxxxxxxxxxxxxxxxxxxxx:13615:0:99999:7::: bin:*:13615:0:99999:7::: (省略) gamba:x:::::::0
- ldap ユーザー用のホームディレクトリを作成します(ldap サーバーで 「slapd」 が起動した状態で実行します)。
[root]# cd /home [root]# mkdir gamba [root]# cp /etc/skel/.* gamba/. [root]# chown -R gamba:gyomu gamba [root]# ls -l drwxr-xr-x 2 gamba gyomu 4096 Apr 20 16:55 gamba/
- ldap サーバーで 「slapd」 を停止すると、uid, gid の表示になります。
[root]# ls -l /home drwxr-xr-x 2 1001 1001 4096 Apr 20 16:55 gamba/
ここまで