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

De CURE - Informática
Ir a la navegación Ir a la búsqueda
(Página creada con 'instalar: slapd y ldap-utils en aptitude para configurar: https://help.ubuntu.com/10.04/serverguide/C/openldap-server.html $ ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/sc...')
 
Línea 1: Línea 1:
−
instalar: slapd y ldap-utils en aptitude
 
  
 +
== OpenLDAP ==
  
  
−
para configurar:
+
Para instalar OpenLDAP serán necesarios los paquetes slapd y ldap-utils, para instalar:
−
https://help.ubuntu.com/10.04/serverguide/C/openldap-server.html
 
  
−
$ ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif
+
  $ aptitude install slapd ldap-utils
−
$ ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif
+
 
−
$ ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif
+
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
 
creamos el archivo con la configuración para luego acceder a ldap
  
−
$ mkdir ldapLaburo
+
  $ mkdir ldapLaburo
−
$ cd ldapLaburo
+
  $ cd ldapLaburo
−
$ vi datos_base_slapd
+
  $ 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:
  
−
root@paloma:~/ldapLaburo# cat datos_base_slapd.ldif  
+
$ mv datos_base_slapd 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
+
Y ejecutamos el siguiente comando:
−
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
 
  
 +
$ ldapadd -Y EXTERNAL -H ldapi:/// -f datos_base_slapd.dif
  
 +
Creamos datos_frontend_slapd.ldif
  
−
$ mv datos_base_slapd datos_base_slapd.ldif
+
$ vi datos_frontend_slapd.ldif
−
$ ldapadd -Y EXTERNAL -H ldapi:/// -f datos_base_slapd.dif
 
−
$ vi datos_frontend_slapd.ldif
 
  
−
root@paloma:~/ldapLaburo# cat datos_frontend_slapd.ldif
+
y le agregamos la siguiente información:
−
# 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.
+
root@paloma:~/ldapLaburo# cat datos_frontend_slapd.ldif
−
dn: cn=admin,dc=ldap,dc=curerocha,dc=edu,dc=uy
+
# Create top-level object in domain
−
objectClass: simpleSecurityObject
+
dn: dc=ldap,dc=curerocha,dc=edu,dc=uy
−
objectClass: organizationalRole
+
objectClass: top
−
cn: admin
+
objectClass: dcObject
−
description: LDAP administrator
+
objectclass: organization
−
userPassword: secreto
+
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
  
−
dn: ou=gente,dc=ldap,dc=curerocha,dc=edu,dc=uy
+
confirmamos que todo este correcto con:
−
objectClass: organizationalUnit
 
−
ou: gente
 
  
−
dn: ou=groupos,dc=ldap,dc=curerocha,dc=edu,dc=uy
+
$ ldapadd -x -D cn=admin,dc=curerocha,dc=edu,dc=uy -W -f datos_frontend_slapd.ldif
−
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
 
  
 +
----
  
  
−
$ ldapadd -x -D cn=admin,dc=curerocha,dc=edu,dc=uy -W -f datos_frontend_slapd.ldif
+
== phpldapadmin ==
  
−
---------------------------------------------------------------------------------
 
  
−
phpldapadmin
 
  
 +
instalar:
  
−
instalar: apt-get install phpldapadmin
+
$ apt-get install phpldapadmin
  
 +
Hacemos un respaldo de la configuración por defecto y editamos el archivo congig.php
  
−
$ cp /etc/phpldapadmin/config.php /etc/phpldapadmin/config.php.orig
+
$ cp /etc/phpldapadmin/config.php /etc/phpldapadmin/config.php.orig
−
$ vi /etc/phpldapadmin/config.php
+
$ vi /etc/phpldapadmin/config.php
  
−
editar:
+
En este archivo editar las siguientes lineas:
  
−
$ldapservers->SetValue($i,'server','name','My LDAP Server');  // The name to display
+
$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','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
+
$ldapservers->SetValue($i,'server','base',array('dc=ldap,dc=curerocha,dc=edu,dc=uy'));  // Base dn

Revisión del 14:36 7 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.dif

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




phpldapadmin

instalar:

$ apt-get install phpldapadmin

Hacemos un respaldo de la configuración por defecto y editamos el archivo congig.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