Contents
Overview
CentOS 5 における LDAP サーバーの構築手順です。
インストール
openldap-servers, openldap-clients, samba をインストールします。この LDAP サーバーは、Samba との連携も想定しており、OpenLDAP が Samba と連携するには専用のスキーマが必要となります。Samba スキーマは Samba パッケージに含まれるため、合わせてインストールしています。
[root@centos-5 ~]# yum -y install openldap-servers openldap-clients sambaSamba スキーマの配置
Samba スキーマを配置します。
[root@centos-5 ~]# cp -a /usr/share/doc/samba-*/LDAP/samba.schema /etc/openldap/schema/rootdn パスワードの暗号化
LDAP 管理者のパスワードを暗号化します。出力結果は後述の設定ファイル内に記述します。本項の例では、password をパスワードとして設定しています。
[root@centos-5 ~]# openssl passwd/etc/openldap/slapd.conf
/etc/openldap/slapd.conf をバックアップし、エディターで開きます。
[root@centos-5 ~]# cp /etc/openldap/slapd.conf /etc/openldap/slapd.conf.orig
[root@centos-5 ~]# vim /etc/openldap/slapd.conf/etc/openldap/slapd.conf を編集します。
include /etc/openldap/schema/samba.schema
suffix "dc=si1230,dc=com"
rootdn "cn=myadmin,dc=si1230,dc=com"
rootpw {crypt}EozvrHt0GozC.サービス起動設定
ldap サービスを起動し、システムの起動時に有効になるように設定します。
[root@centos-5 ~]# service ldap start && chkconfig ldap on
[root@centos-5 ~]# chkconfig ldap --list初期情報の登録
/root/init.ldif をエディターで開きます。
[root@centos-5 ~]# vim /root/init.ldif/root/init.ldif を編集します。
dn: dc=si1230,dc=com
objectClass: dcObject
objectclass: organization
o: si1230
dc: si1230
dn: cn=myadmin,dc=si1230,dc=com
objectclass: organizationalRole
cn: myadmin
dn: ou=users,dc=si1230,dc=com
objectClass: organizationalUnit
ou: users
dn: ou=groups,dc=si1230,dc=com
objectClass: organizationalUnit
ou: groupsdn: dn (Distinguished Name)は、LDAP データベース内でエントリを一意に識別するための名前です。objectClass: objectClass は、LDAP エントリーの種類や属性のセットを示します。o: o (Organization) は、組織の名前を示します。dc: dc (Domain Component) は、DNS のドメイン構造を LDAP に反映するためのコンポーネントです。cn: cn (Common Name) は、LDAP エントリーの共通名です。ou: ou (Organizational Unit) は、組織内の特定の部門やグループを示すためのコンテナです。
/root/init.ldif を登録します。
[root@centos-5 ~]# ldapadd -x -D "cn=myadmin,dc=si1230,dc=com" -W -f /root/init.ldifユーザー登録
Apache Directory Studio を使用して登録します。本稿の例では、g5000 グループと u5000 ユーザーを登録しています。
LDAP を使用した Linux ユーザーのログイン設定
setup コマンドで設定します。
CentOS 5 OpenLDAP LDAP サーバー構築




