{"id":7659,"date":"2018-07-05T09:45:31","date_gmt":"2018-07-05T01:45:31","guid":{"rendered":"http:\/\/rmohan.com\/?p=7659"},"modified":"2018-07-05T09:45:31","modified_gmt":"2018-07-05T01:45:31","slug":"install-ldap-slapd-conf-mode","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7659","title":{"rendered":"Install LDAP-slapd.conf mode"},"content":{"rendered":"<p>Install LDAP-slapd.conf mode<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;start installation&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nQuery whether to install<\/p>\n<p># rpm -qa openldap-servers<\/p>\n<p>Remove ldap<br \/>\n# yum remove openldap<\/p>\n<p># yum remove openldap-servers<\/p>\n<p>Installation Environment<br \/>\nCentos7<br \/>\nApache\/2.4.6 (CentOS)<br \/>\nPHP 7.1.11<\/p>\n<p>Install LDAP Server<\/p>\n<p>Openldap-servers-2.4.44-5.el7.x86_64<\/p>\n<p># yum install openldap-servers openldap-clients migrationtools<\/p>\n<p># rpm -qa | grep openldap<\/p>\n<p>Delete all files in the slapd.d folder and copy a copy of slapd.conf<br \/>\n# rm -rvf \/etc\/openldap\/slapd.d<br \/>\n# mkdir \/etc\/openldap\/slapd.d<\/p>\n<p>Generate password<\/p>\n<p># \/sbin\/slappasswd<br \/>\nNew password:<br \/>\nRe-enter new password:<\/p>\n<p>{SSHA}XXXXXXXXXXXXXXXXX&#8230;.<\/p>\n<p>Ldap-server configuration file<br \/>\n# cp \/usr\/share\/openldap-servers\/slapd.ldif \/etc\/openldap\/slapd.conf<\/p>\n<p>Modify the slapd.conf file<br \/>\n# vi \/etc\/openldap\/slapd.conf<\/p>\n<p>Put<\/p>\n<p>olcAccess: to * by dn.base=&#8221;gidNumber=0+uidNumber=0,cn=peercred,cn=external,c n=auth&#8221; read by dn.base=&#8221;cn=Manager,dc=my-domain,dc= Com&#8221; read by * none<br \/>\nolcSuffix: dc=my-domain,dc=com olcRootDN: cn=Manager,dc=my-domain,dc=com<\/p>\n<p>Change to<\/p>\n<p>olcAccess: to * by dn.base=&#8221;gidNumber=0+uidNumber=0,cn=peercred,cn=external,c n=auth&#8221; read by dn.base=&#8221; cn=Manager,dc=rmohan,dc=com &#8221; read by * none olcSuffix: dc=rmohan,dc=com<br \/>\nolcRootDN: cn=Manager,dc=rmohan,dc=com<br \/>\nolcRootPW: {SSHA}XXXXXXXXXXXXXXXXXXXXX<\/p>\n<p>(olcRootPW please copy from password.txt just)<\/p>\n<p>Start converting configuration files<br \/>\n# rm -rvf \/var\/lib\/ldap\/*<br \/>\n# \/usr\/libexec\/openldap\/convert-config.sh<br \/>\n# head -20 \/etc\/openldap\/slapd.d\/cn\\=config\/olcDatabase\\=\\{[12]}*<\/p>\n<p>Test if the LDAP configuration file is normal<br \/>\n# slaptest -u<br \/>\nConfig file testing succeeded<\/p>\n<p>Clear the database sample file and copy the database default profile<br \/>\nCopy database preset profile #<br \/>\nCp \/usr\/share\/openldap-servers\/DB_CONFIG.example \/var\/lib\/ldap\/DB_CONFIG<\/p>\n<p># rm -rvf \/etc\/openldap\/certs<br \/>\n# mkdir \/etc\/openldap\/ certs<\/p>\n<p>Create a certs DB profile<br \/>\n# \/usr\/libexec\/openldap\/create-certdb.sh<br \/>\nCreating certificate database in &#8216;\/etc\/openldap\/certs&#8217;.<br \/>\n# \/usr\/libexec\/openldap\/generate-server-cert.sh<br \/>\nCreating new server certificate in &#8216;\/etc\/openldap\/certs&#8217;.<br \/>\n# chown ldap:ldap -R \/var\/lib\/ldap\/<br \/>\n# systemctl start slapd<br \/>\n# slaptest<br \/>\nConfig file testing succeeded<br \/>\n# systemctl enable slapd<br \/>\n# firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-port=389\/tcp<br \/>\n# firewall-cmd &#8211;reload<br \/>\n# ldapwhoami -WD cn=Manager,dc=rmohan,dc=com<br \/>\nEnter LDAP Password:<br \/>\nDn :cn=Mana g er,dc=rmohan,dc=com<\/p>\n<p>Import schema<br \/>\n# ldapadd -Y EXTERNAL -H ldapi:\/\/\/ -f \/etc\/openldap\/schema\/cosine.ldif<br \/>\n# ldapadd -Y EXTERNAL -H ldapi:\/\/\/ -f \/etc\/openldap\/schema\/nis.ldif<br \/>\n# ldapadd -Y EXTERNAL -H ldapi:\/\/\/ -f \/etc\/openldap\/schema\/inetorgperson.ldif<\/p>\n<p>Edit root node<\/p>\n<p># vim base.ldif<br \/>\nDn: dc=rmohan,dc=com<br \/>\nobjectClass: top<br \/>\nobjectClass: dcObject<br \/>\nObjectclass: organization<br \/>\no: rmohan<br \/>\nDc: rmohan<\/p>\n<p>Dn: cn=Manager,dc=rmohan,dc=com<br \/>\nobjectClass: organizationalRole<br \/>\nCn: Manager<br \/>\nDescription: Directory Manager<\/p>\n<p>Dn: ou=STU, dc=rmohan,dc=com<br \/>\nobjectClass: organizationalUnit<br \/>\nOu: STU<br \/>\nDescription:student<\/p>\n<p>Dn: ou=TEA,dc=rmohan,dc=com<br \/>\nobjectClass: organizationalUnit<br \/>\nOu: TEA<br \/>\nDescription:teacher<\/p>\n<p># \/bin\/ldapadd -x -D &#8220;cn=Manager,dc=rmohan,dc=com&#8221; -W -f base.ldif<br \/>\nEnter LDAP Password:<br \/>\nAdding new entry &#8220;dc=rmohan,dc=com&#8221;<br \/>\nAdding new entry &#8220;cn=Manager,dc=rmohan,dc=com&#8221;<br \/>\nAdding new entry &#8220;ou=People,dc=rmohan,dc=com&#8221;<br \/>\nAdding new entry &#8220;ou=Group,dc=rmohan,dc=com&#8221;<\/p>\n<p>Firewall settings<\/p>\n<p># \/bin\/firewall-cmd &#8211;permanent &#8211;add-service=ldap<br \/>\n# \/bin\/firewall-cmd &#8211;reload<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install LDAP-slapd.conf mode &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;start installation&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; Query whether to install<\/p>\n<p># rpm -qa openldap-servers<\/p>\n<p>Remove ldap # yum remove openldap<\/p>\n<p># yum remove openldap-servers<\/p>\n<p>Installation Environment Centos7 Apache\/2.4.6 (CentOS) PHP 7.1.11<\/p>\n<p>Install LDAP Server<\/p>\n<p>Openldap-servers-2.4.44-5.el7.x86_64<\/p>\n<p># yum install openldap-servers openldap-clients migrationtools<\/p>\n<p># rpm -qa | grep openldap<\/p>\n<p>Delete all files in the slapd.d folder and copy [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7659"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7659"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7659\/revisions"}],"predecessor-version":[{"id":7660,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7659\/revisions\/7660"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}