yum -y install openldap compat-openldap openldap-clients openldap-servers openldap-servers-sql openldap-devel
systemctl start slapd
systemctl enable slapd
systemctl status slapd
slappasswd
cd /etc/openldap/slapd.d/cn=config
ll
mkdir ldap
vim db.ldif
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=wxbz,dc=com
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=admin,dc=wxbz,dc=com
dn: olcDatabase={2}hdb,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}+vRu28ebQ3oa6uOmzs0t2rjIzDRkBqyf
ldapmodify -Y EXTERNAL -H ldapi:/// -f db.ldif
vim monitor.ldif
dn: olcDatabase={1}monitor,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external, cn=auth" read by dn.base="cn=admin,dc=wxbz,dc=com" read by * none
ldapmodify -Y EXTERNAL -H ldapi:/// -f monitor.ldif
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
chown ldap:ldap /var/lib/ldap/*
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif
vim base.ldif
dn: dc=wxbz,dc=com
dc: wxbz
objectClass: top
objectClass: domain
dn: cn=admin,dc=wxbz,dc=com
objectClass: organizationalRole
cn: admin
description: LDAP Manager
dn: ou=People,dc=wxbz,dc=com
objectClass: organizationalUnit
ou: People
dn: ou=Group,dc=wxbz,dc=com
objectClass: organizationalUnit
ou: Group
ldapadd -x -W -D "cn=admin,dc=wxbz,dc=com" -f base.ldif
至此,ldap服务器基础配置完成
官网:LDAP Admin - a free LDAP directory browser and editor
百度网盘:链接:https://pan.baidu.com/s/13kau93reCkAx7-GgSe3oAQ 提取码:oc4d
yum install -y phpldapadmin # yum安装时,会自动安装apache和php的依赖
yum localinstall http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
vim /etc/httpd/conf.d/phpldapadmin.conf
PS:执行 rpm -qa|grep httpd 查看apache版本
vim /etc/phpldapadmin/config.php
$servers->setValue('login','attr','cn');
$servers->setValue('login','anon_bind',false);
$servers->setValue('unique','attrs',array('mail','uid','uidNumber','cn','sn'));
systemctl restart httpd.service
systemctl enable httpd.service
systemctl status httpd.service
至此,全部完成