Install OpenLDAP on Centos7
I. Environment preparation
Echonameserver114.114.114.114>/etc/resolv. conf # Change dnsecho192.168.0.20.hello.com>/etc/hostssystemctldisablefirewalld. service & systemctlstopfirewalld. service # disable the firewall sed-I's // # SELINUX/SELINUX = disable/G'/etc/selinux/config # permanently close the selinuxsetenforce0rpm-Uvhhttp: // disable
2. Configure the Administrator Password
①. After the slappasswd or slappasswd-s password (-s password) is entered, a string of encryption strings will be generated, for example, {SSHA} 5Qiqn6d4U4U9b1G8A7dKmJAkJcUOA4fE #.
②. Vim chrootpw. ldif
# Define "olcRootPW" sectiondn: olcDatabase = {0} config, cn = configchangetype: modifyadd: olcRootPWolcRootPW: the password generated above ldapadd-YEXTERNAL-Hldapi: //-fchrootpw. ldifldapadd-YEXTERNAL-Hldapi: //-f/etc/openldap/schema/cosine. ldifldapadd-YEXTERNAL-Hldapi: //-f/etc/openldap/schema/nis. ldifldapadd-YEXTERNAL-Hldapi: //-f/etc/openldap/schema/inetorgperson. the return value of ldif is as follows:
3. Set your domain name in the database
1. Generate Password
Slappasswd
2. vi chdomain. ldif
# Replacetoyourowndomainnamefor "dc = ***, dc = ***" section # region "olcRootPW" sectiondn: olcDatabase = {1} monitor, cn = configchangetype: modifyreplace: olcAccessolcAccess: {0} to * bydn. base = "gidNumber = 0 + uidNumber = 0, cn = peercred, cn = external, cn = auth" readbydn. base = "cn = admin, dc = hello, dc = com" readby * nonedn: olcDatabase = {2} hdb, cn = configchangetype: modifyreplace: olcSuffixolcSuffix: dc = hello, dc = comdn: olcDatabase = {2} hdb, cn = configchangetype: modifyreplace: olcRootDNolcRootDN: cn = admin, dc = hello, dc = comdn: olcDatabase = {2} hdb, cn = configchangetype: modifyadd: olcRootPWolcRootPW: Password generated in step 1 dn: olcDatabase = {2} hdb, cn = configchangetype: modifyadd: olcAccessolcAccess: {0} toattrs = userPassword, shadowLastChangebydn = "cn = admin, dc = hello, dc = com" writebyanonymousauthbyselfwriteby * noneolcAccess: {1} todn. base = "" by * readolcAccess: {2} to * bydn = "cn = admin, dc = hello, dc = com" writeby * read
3. ldapmodify-y external-H ldapi: //-f chdomain. ldif
4. vi basedomain. ldif
# Pipeline "dc = ***, dc = ***" sectiondn: dc = hello, dc = comobjectClass: topobjectClass: dcObjectobjectclass: organizationo: qiqiucomdc: qiqiudn: cn = admin, dc = hello, dc = comobjectClass: organizationalRolecn: admindescription: Directoryadmindn: ou = People, dc = hello, dc = comobjectClass: organizationalUnitou: leledn: ou = Group, dc = hello, dc = comobjectClass: organizationalUnitou: Group
5. ldapadd-x-D cn = admin, dc = hello, dc = com-W-f basedomain. ldif