Autenticación contra LDAP desde Drupal 7
Drupal es un sistema de gestión de contenidos. Es posible realizar la autenticación de los usuarios contra LDAP. Con este método se generará un usuario local que puede ser gestionado como cualquier otro.
Existen varias formas para la autenticación contra el LDAP institucional.
Contenido
Instalación del módulo
Para añadir la funcionalidad, es necesario instalar el módulo ldap[1].
Puede utilizar la herramienta drush[2] o bien instalar de manera manual:
- Descargue el módulo desde: https://www.drupal.org/project/ldap
- Descomprima en el directorio sites/all/modules/
- En la interfaz administrativa de Drupal habilite los módulos:
- ldap_authentication
- ldap_servers
- ldap_user
Configuración del módulo
Nótese que puede modificar varios de los puntos, de acuerdo a la necesidad de su sitio web.
Método 1: Utilizando las credenciales del usuario que se está autenticando
Por hacer
Método 2: Utilizando un usuario de consultas previamente generado
Para autenticar usuarios por medio de una cuenta de consultas, realice los siguientes pasos:
- Vaya a Configuración > People > LDAP Configuration
- En la pestaña "2. Servers" presione "Add LDAP Server Configuration". Configure de la siguiente manera:
- Connections settings
- Machine name for this server configuration: ldap2-ucr
- Name: LDAP2-UCR
- Enabled: marcado
- LDAP Server Type: Open LDAP
- LDAP server: ldaps://ldap2.ucr.ac.cr
- LDAP Port: 636
- Use Start-TLS: desmarcado
- Follow LDAP Referrals: desmarcado
- Binding method
- Binding Method for Searches: Service Account Bind
- DN for non-anonymous search: uid=usuario,ou=Special Users,dc=ucr,dc=ac,dc=cr (Sustituya usuario por el de la cuenta de consulta)
- Password for non-anonymous search: contraseña de la cuenta de consulta
- LDAP User to Drupal User Relationship
- Base DNs for LDAP users, groups, and other entries: cn=users,cn=accounts,dc=ucr,dc=ac,dc=cr
- AuthName attribute: uid
- Email attribute: mail
- Presione el botón "Add"
- La nueva configuración se mostrará en la respectiva lista, en "Operations" presione "enable" y confirme la operación
- Connections settings
Configuración general
Esta configuración aplica para cualquiera de los métodos seleccionados.
- En la pestaña "3. User" configure de la siguiente manera:
- Manual Drupal Account Creation and Updates
- How to resolve LDAP conflicts with manually created Drupal accounts: Associate manually created Drupal accounts with related LDAP Account if one exists.
- Basic Provisioning to Drupal Account Settings
- LDAP Servers Providing Provisioning Data: LDAP2-UCR
- Drupal Account Provisioning Events
- Create or Synch to Drupal user on successful authentication with LDAP credentials: marcado
- Create or Synch to Drupal user anytime a Drupal user account is created or updated: marcado solo si se usa el metodo 2
- Existing Drupal User Account Conflict: Associate Drupal account with the LDAP entry
- Application of Drupal Account settings to LDAP Authenticated Users: Account creation settings at /admin/config/people/accounts/settings do not affect "LDAP Associated" Drupal accounts
- Action to perform on Drupal account that no longer have a corresponding LDAP entry: Do not check for orphaned Drupal accounts
- Basic Provisioning to LDAP Settings
- LDAP Servers to Provision LDAP Entries on: None
- Presione el botón "Save"
- Manual Drupal Account Creation and Updates
- En la pestaña "Authentication" configure así:
- Logon options
- Allowable Authentications: Mixed mode
- Authentication LDAP Server Configurations: marcado "LDAP2-UCR"
- User login interface
- Username Description Text: Cuenta institucional UCR
- LDAP Account User Help URL: https://correo.ucr.ac.cr/?_task=settings&_action=plugin.password
- LDAP Account User Help Link Text : Cambiar contraseña
- Email
- Email Behavior: Show disabled email field on user forms with LDAP derived email
- Email Update: Update stored email if LDAP email differs at login and notify user
- Password
- Password Behavior: Display password field disabled
- Presione el botón "Save"
- Logon options
Bitácoras para debugging
Para monitorear las operaciones, y sobre todo los posibles errores, puede consultar la bitácora de Drupal.
En la interfaz administrativa diríjase a:
Reports > Recent log messages
O bien, si tiene instalada la herramienta drush puede ver los mensajes en tiempo real:
cd /directorio/a/drupal drush ws --tail