Diferencia entre revisiones de «Instalación y configuración OpenLDAP»

De CURE - Informática
Saltar a: navegación, buscar
(phpldapadmin)
(OpenLDAP)
Línea 123: Línea 123:
 
  $ ldapadd -x -D cn=admin,dc=curerocha,dc=edu,dc=uy -W -f datos_frontend_slapd.ldif
 
  $ ldapadd -x -D cn=admin,dc=curerocha,dc=edu,dc=uy -W -f datos_frontend_slapd.ldif
  
 +
 +
Si no da errores es que todo ha ido bien!
  
 
----
 
----
 
  
 
== phpldapadmin ==
 
== phpldapadmin ==

Revisión del 15:28 16 jun 2011

OpenLDAP

Para instalar OpenLDAP serán necesarios los paquetes slapd y ldap-utils, para instalar:

  $ aptitude install slapd ldap-utils

Luego lanzamos los siguientes comandos

  $ ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif
  $ ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif
  $ ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif

creamos el archivo con la configuración para luego acceder a ldap

  $ mkdir ldapLaburo
  $ cd ldapLaburo
  $ vi datos_base_slapd

Editamos el archivo datos_base_slapd, un ejemplo es el siguiente:

root@paloma:~/ldapLaburo# cat datos_base_slapd.ldif 
# Load dynamic backend modules
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/lib/ldap
olcModuleload: back_hdb

# Database settings
dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcSuffix: dc=ldap,dc=curerocha,dc=edu,dc=uy
olcDbDirectory: /var/lib/ldap
olcRootDN: cn=admin,dc=ldap,dc=curerocha,dc=edu,dc=uy
olcRootPW: secreto
olcDbConfig: set_cachesize 0 2097152 0
olcDbConfig: set_lk_max_objects 1500
olcDbConfig: set_lk_max_locks 1500
olcDbConfig: set_lk_max_lockers 1500
olcDbIndex: objectClass eq
olcLastMod: TRUE
olcDbCheckpoint: 512 30
olcAccess: to attrs=userPassword by dn="cn=admin,dc=ldap,dc=curerocha,dc=edu,dc=uy" write by anonymous auth by self write by * none
olcAccess: to attrs=shadowLastChange by self write by * read
olcAccess: to dn.base="" by * read
olcAccess: to * by dn="cn=admin,dc=ldap,dc=curerocha,dc=edu,dc=uy" write by * read

Le cambiamos el nombre:

$ mv datos_base_slapd datos_base_slapd.ldif

Y ejecutamos el siguiente comando:

$ ldapadd -Y EXTERNAL -H ldapi:/// -f datos_base_slapd.ldif

Creamos datos_frontend_slapd.ldif

$ vi datos_frontend_slapd.ldif

y le agregamos la siguiente información:

root@paloma:~/ldapLaburo# cat datos_frontend_slapd.ldif 
# Create top-level object in domain
dn: dc=ldap,dc=curerocha,dc=edu,dc=uy
objectClass: top
objectClass: dcObject
objectclass: organization
o: CURE Rocha
dc: ldap
description: Directorio LDAP del CURE 

# Admin user.
dn: cn=admin,dc=ldap,dc=curerocha,dc=edu,dc=uy
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword: secreto 

dn: ou=gente,dc=ldap,dc=curerocha,dc=edu,dc=uy
objectClass: organizationalUnit
ou: gente 

dn: ou=groupos,dc=ldap,dc=curerocha,dc=edu,dc=uy
objectClass: organizationalUnit
ou: groupos

dn: uid=victor,ou=gente,dc=ldap,dc=curerocha,dc=edu,dc=uy
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: victor
sn: Alem
givenName: Víctor
cn: Víctor Alem
displayName: Víctor Alem
uidNumber: 1000
gidNumber: 10000
userPassword: secreto1
gecos: Víctor Alem
loginShell: /bin/bash
homeDirectory: /home/john
shadowExpire: -1
shadowFlag: 0
shadowWarning: 7
shadowMin: 8
shadowMax: 999999
shadowLastChange: 10877
postalCode: 31000
l: Toulouse
o: Example
mobile: +33 (0)6 xx xx xx xx
homePhone: +33 (0)5 xx xx xx xx
title: System Administrator
postalAddress: 
initials: VA

confirmamos que todo este correcto con:

$ ldapadd -x -D cn=admin,dc=curerocha,dc=edu,dc=uy -W -f datos_frontend_slapd.ldif


Si no da errores es que todo ha ido bien!


phpldapadmin

instalar:

$ apt-get install phpldapadmin

Hacemos un respaldo de la configuración por defecto y editamos el archivo config.php

$ cp /etc/phpldapadmin/config.php /etc/phpldapadmin/config.php.orig
$ vi /etc/phpldapadmin/config.php

En este archivo editar las siguientes lineas:

$ldapservers->SetValue($i,'server','name','My LDAP Server');  // The name to display
$ldapservers->SetValue($i,'server','host','127.0.0.1');  // Address of the LDAP server
$ldapservers->SetValue($i,'server','base',array('dc=ldap,dc=curerocha,dc=edu,dc=uy'));  // Base dn
$servers->setValue('login','bind_id','cn=admin,dc=ldap,dc=curerocha,dc=edu,dc=uy');


Entramos por web https://ip_servidor/phpldapadmin e ingresamos el password configurado en el ldap.

Fuente:

OpenLDAP Server