{"id":1313,"date":"2013-10-20T03:30:37","date_gmt":"2013-10-20T06:30:37","guid":{"rendered":"http:\/\/www.jgarces.info\/?p=1313"},"modified":"2013-11-09T03:32:35","modified_gmt":"2013-11-09T06:32:35","slug":"instalation-of-openldap","status":"publish","type":"post","link":"https:\/\/www.jgarces.info\/en\/instalation-of-openldap\/","title":{"rendered":"Instalation of OpenLdap"},"content":{"rendered":"<p>This tutorial was created for the instalation of <strong>OpenLdap<\/strong> in Linux RedHat.<\/p>\n<p>For make the instalation of the server we execute:<\/p>\n<pre lang=\"sh\">\r\n\r\nyum install openldap-servers.i386\r\n\r\n<\/pre>\n<p><!--more--><br \/>\nFinished the instalation, we need to configure the file <strong>\/etc\/openldap\/slapd.conf<\/strong> (we can use VIM or the editor that you like)<\/p>\n<p>The first is identify the structure of our tree. In the case of we need load a new schema, we will copy the corresponding file to the directory <strong>\/etc\/openldap\/schema\/<\/strong> and after, we will include this in the first lines of the file <strong>slapd.conf<\/strong>:<\/p>\n<pre lang=\"sh\">\r\n\r\n#\r\n# See slapd.conf(5) for details on configuration options.\r\n# This file should NOT be world readable.\r\n#\r\ninclude \/etc\/openldap\/schema\/core.schema\r\ninclude \/etc\/openldap\/schema\/cosine.schema\r\ninclude \/etc\/openldap\/schema\/inetorgperson.schema\r\ninclude \/etc\/openldap\/schema\/nis.schema\r\ninclude \/etc\/openldap\/schema\/NUESTRO_ESQUEMA <-------- Include hire\r\n\r\n<\/pre>\n<p>After, we will configure the trunk of our tree, defining the root and the password. You can defining the password in plain text or encripted way. If you need the encripted way, you can execute the command <strong>slappasswd<\/strong>, and after insert the password twice, this displays the encoded string.<\/p>\n<pre lang=\"sh\">\r\n\r\ndatabase        bdb\r\nsuffix          \"dc=domain,dc=com\"   <---- Define hire your domain\r\nrootdn          \"cn=Manager,dc=domain,dc=com\"     <---- Define hire your root\r\n\r\n# Cleartext passwords, especially for the rootdn, should\r\n# be avoided.  See slappasswd(8) and slapd.conf(5) for details.\r\n# Use of strong authentication encouraged.\r\n\r\n# rootpw         secret\r\n\r\nrootpw       {SSHA}a2tWJtNi4MbnzS5pW5CHnDstZkKG1DjG    <---- Encripted password\r\n\r\n# rootpw       {crypt}ijFYNcSNctBYg\r\n\r\n<\/pre>\n<p>Now, we will see the directory in that our ldap database is saving.<\/p>\n<pre lang=\"sh\">\r\n\r\n# The database directory MUST exist prior to running slapd AND\r\n# should only be accessible by the slapd and slap tools.\r\n# Mode 700 recommended.\r\ndirectory       \/var\/lib\/ldap         <---- In this directory we have our database\r\n\r\n<\/pre>\n<p>To prevent errors with the default data, verify that the directory is empty, don't worry, on server starts, these files are generated again.<\/p>\n<pre lang=\"sh\">\r\n\r\ncd \/var\/lib\/ldap\r\nrm -rf *\r\n\r\n<\/pre>\n<p>Now, we can start our server, executing: <strong>service ldap start<\/strong><\/p>\n<p>If you like that the OpenLdap server starts automaticaly in the server reboot, execute this: <strong>chkconfig ldap on<\/strong>, with this OpenLdap starts automaticaly in the server reboot.<\/p>\n<p>To the end, we need initializing the tree, adding the keys (<strong>suffix<\/strong> and <strong>rootdn<\/strong>) that we defined in our configuration file. For this, we generate a new file containing the below (for example, inicia.ldif):<\/p>\n<pre lang=\"text\">\r\n\r\ndn: dc=domain,dc=com\r\nobjectclass: dcObject\r\nobjectclass: organization\r\no: what_you_want_for_name\r\ndc: domain\r\n\r\ndn: cn=Manager,dc=domain,dc=com\r\nobjectclass: organizationalRole\r\ncn: Manager\r\n\r\n<\/pre>\n<p>We add the keys above executing the below (replace localhost and parameters for yours):<\/p>\n<pre lang=\"sh\">\r\n\r\nldapadd -x -W -D \"cn=Manager,dc=domain,dc=com\" -h localhost -f \/root\/inicia.ldif\r\n\r\n<\/pre>\n<p>With this we finished the instalation of our OpenLdap server. You can begin to use with any tool of administration to load and manage your tree.<\/p>\n<p>Another commands:<\/p>\n<pre lang=\"sh\">\r\n\r\nservice ldap restart\r\nservice ldap start\r\nservice ldap stop\r\nldapsearch -x -b '' -s base '(objectclass=*)' namingContexts\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial was created for the instalation of OpenLdap in Linux RedHat. For make the instalation of the server we execute: yum install openldap-servers.i386<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[48,47],"class_list":["post-1313","post","type-post","status-publish","format-standard","hentry","category-tutorials-manuals","tag-linux-en","tag-sh-en"],"_links":{"self":[{"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/posts\/1313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/comments?post=1313"}],"version-history":[{"count":1,"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/posts\/1313\/revisions"}],"predecessor-version":[{"id":1314,"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/posts\/1313\/revisions\/1314"}],"wp:attachment":[{"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/media?parent=1313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/categories?post=1313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jgarces.info\/en\/wp-json\/wp\/v2\/tags?post=1313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}