CentOS6 OpenLDAPサーバで認証する。TLS接続しない場合
パッケージのインストールを行います。
[text]
# yum -y install openldap-servers
# yum -y install openldap-clients
[/text]
基本的なファイルを用意する。
[text]
# rm -rf /etc/openldap/slapd.d
# rm -rf /var/lib/ldap/*
# cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf
[/text]
confファイルを編集する。
[text]
vi /etc/openldap/slapd.conf
[/text]
内容を修正
OPenLdapに接続するときのパスワードはとりあえず secret にする。後でかえた方がいい
[text]
suffix “dc=hogehoge,dc=com”
rootdn “cn=manager,dc=hogehoge,dc=com”
rootpw secret
[/text]
OS起動時にOpenLDAPを起動するようにする。
OpenLDAPを起動する。
[text]
# chkconfig slapd on
# /etc/init.d/slapd start
[/text]
動いているかを確認する。OKならばよい。
[text]
# ldapsearch -x -D “cn=manager,dc=hogehoge,dc=com” -w secret
[/text]
ベースとなるDNを作成するためLDIFファイルを作成する。
[text]
# cat schema.ldif
dn: dc=hogehoge,dc=com
objectClass: dcObject
objectClass: organization
dc: hogehoge
o: hogehoge
dn: ou=users,dc=hogehoge,dc=com
objectclass: organizationalUnit
ou: users
dn: ou=groups,dc=hogehoge,dc=com
objectclass: organizationalUnit
ou: groups
[/text]
LDIFファイルをLDAPサーバにインポートする。
[text]
# ldapadd -x -D “cn=manager,dc=hogehoge,dc=com” -w secret -f schema.ldif
[/text]
LINUX をTSLなしでLDAP認証にするにはsssdを削除しておく。SSSDを使いたい場合はTLSの設定が必要。
[text]
# yum -y erase sssd
[/text]
必要なパッケージを追加
[text]
# yum -y install pam_ldap nss-pam-ldapd
[/text]
authconfig-tui コマンドでLDAP認証の設定をする
[text]
最初のページで以下のように設定
LDAPを使用
LDAP認証を使用
次のページで以下のように設定する
TLSを使用にはチェックをいれない
サーバー :ldap://127.0.0.1/
ベースDN :dc=hogehoge,dc=com
[/text]
これで十分使える。