sexta-feira, 30 de setembro de 2011

Installing Open LDAP and PhpLDAPAdmin on CentOS 5x


1. Install required Packages

# yum install openldap openldap-servers openldap-devel compat-openldap
# yum install php-ldap openldap-clients


2. Generating Hash password

# slappasswd -s josemarsilva
# {SSHA}Qb8a4HFCjVJ4kMu27OKASUE13AWu7eJr


3. Configure OpenLDAP 

# vim /etc/openldap/slapd.conf
       :
  include /etc/openldap/schema/core.schema
  include /etc/openldap/schema/cosine.schema
  include /etc/openldap/schema/inetorgperson.schema
  include /etc/openldap/schema/nis.schema
       :
  allow bind_v2
       :
  pidfile /var/run/openldap/slapd.pid
  argsfile /var/run/openldap/slapd.args
       :
  database bdb
       :
  suffix         "dc=josemarsilva,dc=com"             # Directory Structure ...
  rootdn         "cn=Manager,dc=josemarsilva,dc=com"  # ... and administrador ...
  rootpw {SSHA}Qb8a4HFCjVJ4kMu27OKASUE13AWu7eJr       # ... password hashed (previous step)
       :
  directory /var/lib/ldap
       :
  index objectClass eq,pres
  index ou,cn,mail,surname,givenname eq,pres,sub
  index uidNumber,gidNumber,loginShell eq,pres
  index uid,memberUid eq,pres,sub
  index nisMapName,nisMapEntry eq,
       :
#


4. Start OpenLDAP server and configure automatic startup with system

# service ldap start
# netstat -lnt | grep ":389"  # verifique servico ativo na porta 389
# chkconfig ldap on
#


5. Querying something from OpenLDAP databases

     5.a) Consider that everything was installed successfully, you should get this result

# ldapsearch -x -LLL -b '' -s base '(objectclass=*)' namingContexts
  +---------------------------------------+
  |dn:                                    |
  |namingContexts: dc=josemarsilva,dc=com |
  +---------------------------------------+
#


6. Installing PhpLDAPAdmin



    6.1. Installing


# yum install phpldapadmin 

#
# service httpd start  # iniciado o servico http do Apache
#

    6.2. Checking your browser and access following url


# http://localhost/phpldapadmin - login anonymous
#


7. References

  • http://blog.lcmm.info/?p=105
  • http://www.howtoforge.com/install-and-configure-openldap-on-centos-5
  • http://en.wikipedia.org/wiki/Plain_text



2 comentários: