Cluster LDAP
Descripción
Configuracion de OpenLDAP Maestro-Esclavo
Prerequistos
- Servidores LDAP configurados
Procedimiento
1.0 OpenLDAP 2.2 (Slurp)
Para montar un servidor de replicas, la idea es que se tienen dos servidores con LDAP corriendo y sus bases de datos son identicas. Entonces hay un maestro que envia los cambios a un esclavo. Para esto necesita en el esclavo un usuario que puede hacer literalemente todo.
A. Cree en el maestro el usuario que va a hacer todo y asignele contraseña ejemplo
uid=replicator,ou=Hosts,dc=skina,dc=com,dc=co
B. Copie los datos del Maestro al esclavo
- Baje el ldap en el esclavo
- Borre los datos en el esclavo (rm -f /var/lib/ldap/*
- Saque el ldif completo del maestro. Yo lo hago desde phpldapadmin porque slapcat no me funciono.
- Prenda de nuevo el ldap en el esclavo
- Con ldapadd suba el backup.
C. Configure LDAP en el maestro
Se agrega la linea de cada maquina replicador con la direccion, el usuario al otro lado con permisos y su contraseña.
replogfile /var/log/ldap/openldap-master-replog
replica uri=ldaps://esclavo.skina.com.co:636
binddn=“uid=replicator,dc=skina,dc=com,dc=co”
bindmethod=simple credentials=passwd
Si tiene el TLS habilitado agregue
tls=yes
D. Configure LDAP en el esclavo
Permita que el replicador escriba en todo … ejemplo (centos)
access to dn.base=“” by 10_consejos_para_la_resolucion_de_problemas.html acta_de_constitucion_interna_del_proyecto.html active_directory.html administrar_servidores_con_ipmi.html admin_rpms_con_yum.html albasoftware_libre_de_gestion_educativa.html alta_disponibilidad_de_conexion_a_internet.html ansible_administracion_centralizada_de_servidores.html anti_virusanti_spam_y_hardening_de_correo2024.html anti_virusanti_spam_y_hardening_de_correo.html apache2_mod_security.html apacheservidor_de_www.html aplicativos_usando_ldap.html autoconf.html aws_amazon_ec2.html aws_amazon_lambda.html bacula_backup2024.html bacula_backup.html bandwidthd.html bind_dns.html bonding.html cacti.html cambio_contrasena_ldap_ad_por_web.html cambios_recientes.html caracteres_octal_hexa_unicode_html.html centos_sobre_hyperv.html cfengine.html chumne_administrador_de_licencias.html ciclo_de_pruebas_orfeo.html cluster_con_haproxy.html cluster_ldap.html read
access to dn.base=“cn=Subschema” by 10_consejos_para_la_resolucion_de_problemas.html acta_de_constitucion_interna_del_proyecto.html active_directory.html administrar_servidores_con_ipmi.html admin_rpms_con_yum.html albasoftware_libre_de_gestion_educativa.html alta_disponibilidad_de_conexion_a_internet.html ansible_administracion_centralizada_de_servidores.html anti_virusanti_spam_y_hardening_de_correo2024.html anti_virusanti_spam_y_hardening_de_correo.html apache2_mod_security.html apacheservidor_de_www.html aplicativos_usando_ldap.html autoconf.html aws_amazon_ec2.html aws_amazon_lambda.html bacula_backup2024.html bacula_backup.html bandwidthd.html bind_dns.html bonding.html cacti.html cambio_contrasena_ldap_ad_por_web.html cambios_recientes.html caracteres_octal_hexa_unicode_html.html centos_sobre_hyperv.html cfengine.html chumne_administrador_de_licencias.html ciclo_de_pruebas_orfeo.html cluster_con_haproxy.html cluster_ldap.html read
access to 10_consejos_para_la_resolucion_de_problemas.html acta_de_constitucion_interna_del_proyecto.html active_directory.html administrar_servidores_con_ipmi.html admin_rpms_con_yum.html albasoftware_libre_de_gestion_educativa.html alta_disponibilidad_de_conexion_a_internet.html ansible_administracion_centralizada_de_servidores.html anti_virusanti_spam_y_hardening_de_correo2024.html anti_virusanti_spam_y_hardening_de_correo.html apache2_mod_security.html apacheservidor_de_www.html aplicativos_usando_ldap.html autoconf.html aws_amazon_ec2.html aws_amazon_lambda.html bacula_backup2024.html bacula_backup.html bandwidthd.html bind_dns.html bonding.html cacti.html cambio_contrasena_ldap_ad_por_web.html cambios_recientes.html caracteres_octal_hexa_unicode_html.html centos_sobre_hyperv.html cfengine.html chumne_administrador_de_licencias.html ciclo_de_pruebas_orfeo.html cluster_con_haproxy.html cluster_ldap.html
by 10_consejos_para_la_resolucion_de_problemas.html acta_de_constitucion_interna_del_proyecto.html active_directory.html administrar_servidores_con_ipmi.html admin_rpms_con_yum.html albasoftware_libre_de_gestion_educativa.html alta_disponibilidad_de_conexion_a_internet.html ansible_administracion_centralizada_de_servidores.html anti_virusanti_spam_y_hardening_de_correo2024.html anti_virusanti_spam_y_hardening_de_correo.html apache2_mod_security.html apacheservidor_de_www.html aplicativos_usando_ldap.html autoconf.html aws_amazon_ec2.html aws_amazon_lambda.html bacula_backup2024.html bacula_backup.html bandwidthd.html bind_dns.html bonding.html cacti.html cambio_contrasena_ldap_ad_por_web.html cambios_recientes.html caracteres_octal_hexa_unicode_html.html centos_sobre_hyperv.html cfengine.html chumne_administrador_de_licencias.html ciclo_de_pruebas_orfeo.html cluster_con_haproxy.html cluster_ldap.html read
by self write
by anonymous auth
by dn=“uid=replicator,dc=skina,dc=com,dc=co” write
Y configure el actualizador
# Replica configuration (if this server is a slave)
updatedn “uid=replicator,dc=skina,dc=com,dc=co”
updateref “ldaps://maestro.skina.com.co”
E. Pruebas
Reinicie servidores y pruebe cambiando algo en el maestro para ver como va en el esclavo.
2. OpenLDAP 2.3 (Synrepl)
http://www.openldap.org/doc/admin23/syncrepl.html –
Maestro
# define as provider using the syncprov overlay
# (last directives in database section)
overlay syncprov
# contextCSN saved to database every 100 updates or ten minutes
syncprov-checkpoint 100 10
Esclavo
# provider is ldap://master-ldap.example.com:389,
# whole DIT (searchbase), all user attributes synchronized
# simple security with a cleartext password
# NOTE: comments inside the syncrepl directive are rejected by OpenLDAP
# and are included only to carry further explanation. They MUST NOT
# appear in an operational file
syncrepl rid=000
provider=ldap://192.168.8.47
type=refreshAndPersist
retry=“5 5 300 +“
searchbase=“dc=skina,dc=com,dc=co”
attrs=”*,+“
bindmethod=simple
binddn=“cn=Manager,dc=skina,dc=com,dc=co”
credentials=passwdroot
Hasta aqui no funciona el updateref .. o sea el esclavo no acepta actualizaciones ni las redirecciona.
3. OpenLDAP 2.4
Es bien interesante porque a partir de esta version el esquema puede ser diverso, puede tener multi-master .. y demas.
El documento papa para aprender http://www.openldap.org/doc/admin24/replication.html#MirrorMode –
Multimaster .. por aqui http://itsecureadmin.com/wiki/index.php/OpenLDAP_Multi-Master_Replication –
OJO .. el toca ponerle el: overlay syncprov
- https://bidhankhatri.com.np/system/openldap-mirrormode-replication-&-mdb-backend-in-centos-7/
- https://ubuntu.com/server/docs/service-ldap-replication … super .. PERO solo agrega .. no replica borrados
——————-
$ vim mod_syncprov.ldif
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulePath: /usr/lib/ldap
olcModuleLoad: syncprov.la
$ ldapadd -Y EXTERNAL -H ldapi:/// -f mod_syncprov.ldif
$ slapcat -n 0 | grep olcModuleLoad
$ vim syncprov_overlay.ldif
dn: olcOverlay=syncprov,olcDatabase={1}mdb,cn=config
objectClass: olcOverlayConfig
objectClass: olcSyncProvConfig
olcOverlay: syncprov
olcSpSessionLog: 100
$ ldapadd -Y EXTERNAL -H ldapi:/// -f syncprov_overlay.ldif
$ vim oclserverid.ldif
# create new
dn: cn=config
changetype: modify
replace: olcServerID
# specify uniq ID number on each server
olcServerID: 1
$ ldapadd -Y EXTERNAL -H ldapi:/// -f oclserverid.ldif
$ vim replication_config.ldif
dn: olcDatabase={1}mdb,cn=config
changetype: modify
add: olcSyncRepl
olcSyncRepl: rid=002
provider=ldap://atento-dir1.teleatento.com/
bindmethod=simple
binddn=“cn=admin,dc=teleatento,dc=com”
credentials=“gahnaer8Iv3h”
searchbase=“dc=teleatento,dc=com”
scope=sub
schemachecking=on
type=refreshAndPersist
retry=“30 5 300 3”
interval=00:00:05:00
starttls=critical
tls_reqcert=never
-
add: olcMirrorMode
olcMirrorMode: TRUE
$ ldapadd -Y EXTERNAL -H ldapi:/// -f replication_config.ldif
$ ldapsearch -Y EXTERNAL -H ldapi:/// -b “olcDatabase={1}mdb,cn=config” '(objectClass=*)' -LL
——————
Problemas y Trucos
1. NO usa TLS
Me toco agregar la ultima linea para que No joda por los certificados
olcSyncRepl: rid=002
provider=ldap://192.168.8.68/
bindmethod=simple
binddn=“cn=admin,dc=teleatento,dc=com”
credentials=“gahnaer8Iv3h”
searchbase=“dc=teleatento,dc=com”
scope=sub
schemachecking=on
type=refreshAndPersist
retry=“30 5 300 3”
interval=00:00:05:00
starttls=critical
tls_reqcert=never
Referencias
- OpenLDAP 2.2: http://www.openldap.org/doc/admin22/replication.html –
- OpenLDAP 2.4: http://blog.suretecsystems.com/archives/129-Replacing-Slurpd-using-OpenLDAP-2.4.html –
- Una excelente evaluacion de que hacer para Alta disponibildad en LDAP … http://www.openldap.org/lists/openldap-technical/200905/msg00041.html –
- http://www.zytrax.com/books/ldap/ch7/ –
- A la antigua pero ilustrativo http://www.linuxjournal.com/article/5505 –
FIN
==============================================================
ANEXO 1 Switch de maestro a esclavo
=============================================================
Advertencia
Este documento es privado y es de uso exclusivo de sus autores y de SKINA TECH. Cualquier uso sin una autorización escrita es contra la ley de derechos de autor y de propiedad intelectual, y será motivo de una acción legal.