Kの雑記

最近忘れやすいので、備忘録がわり

OpenLDAPのインストール

OpenLDAPのインストール

CentOS6.7の場合

OpenLDAPをインストールする

# yum -y install openldap-servers

ダウンロードするだけでインストールしない場合

# yum install --downloadonly --downloaddir=<dir> openldap-servers

 以下の依存関係あり

(1/4): libtool-ltdl-2.2.6-15.5.el6.x86_64.rpm
(2/4): openldap-2.4.40-12.el6.x86_64.rpm
(3/4): openldap-servers-2.4.40-12.el6.x86_64.rpm
(4/4): portreserve-0.0.4-11.el6.x86_64.rpm

openldap-clientsの場合の依存関係

(1/2): openldap-2.4.40-12.el6.x86_64.rpm
(2/2): openldap-clients-2.4.40-12.el6.x86_64.rpm

 

# rpm -ivh <ファイル名>

以下のメッセージが出てインストールがうまくいかなかった。

ファイル /lib64/liblber-2.4.so.2.10.3 (パッケージ openldap-2.4.40-12.el6.x86_64 から) は、パッケージ openldap-2.4.40-5.el6.x86_64 からのファイルと競合しています。

 パッケージをUpdateオプションでインストールすることで回避
# rpm -Uvh <ファイル名>

OpenLDAPのDB設定

# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
# chown ldap. /var/lib/ldap/DB_CONFIG

 OpenLDAPの管理者パスワード設定

パスワードの生成
# slappasswd New password:[パスワード入力] Re-enter new password:[パスワード入力]
{SSHA}GF5r8kq3MlX60I/FHN3nBw0OkIxrmaJr

 パスワードの設定は/etc/openldap/slapd.d/cn=config/olcDatabase={0}config.ldifに行う。

olcRootPWの項目を追加し、上記パスワードを設定。

 

# vi /etc/openldap/slapd.d/cn=config/olcDatabase={0}config.ldif

------------------------------

# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.
# CRC32 839a310a
dn: olcDatabase={0}config
objectClass: olcDatabaseConfig
olcDatabase: {0}config
olcAccess: {0}to *  by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=exter
 nal,cn=auth" manage  by * none
olcAddContentAcl: TRUE
olcLastMod: TRUE
olcMaxDerefDepth: 15
olcReadOnly: FALSE
olcRootDN: cn=config
olcRootPW: {SSHA}GF5r8kq3MlX60I/FHN3nBw0OkIxrmaJr
olcSyncUseSubentry: FALSE
olcMonitoring: FALSE
structuralObjectClass: olcDatabaseConfig
entryUUID: eeecbbd2-2d05-1036-874a-85ca7c3c3447
creatorsName: cn=config
createTimestamp: 20161023004652Z
entryCSN: 20161023004652.390768Z#000000#000#000000
modifiersName: cn=config
modifyTimestamp: 20161023004652Z

LDAPをスタート

# /etc/rc.d/init.d/slapd start
# chkconfig slapd on
 iptablesの停止も忘れずに。
# chkconfig iptables off
# chkconfig ip6tables off
# service iptables stop
# service iptables stop