cancel
Showing results for 
Search instead for 
Did you mean: 

Integración con OpenLDAP

javi
Champ in-the-making
Champ in-the-making
Buenas a todos, antes de nada gracias por adelantado, he estado buscando solución y la verdad es que tengo varias dudas que no puedo solventar. Estoy haciendo un proyecto para implantar lo siguiente:
INTRANET con un dominio .local PARA UNA EMPRESA TIPO CONSULTORÍA TÉCNICA con:
- Servidor DNS en Debian 7 con bind9.
- Servidor LDAP+SAMBA montado sobre Debian 7.
- Servidor Alfresco, con alfresco 4.2 con MySQL.
- Hay algún servidor más para copias de seguridad, digitalización y varias tareas.
- Los clientes son Windows 7.

Bien el dominio funciona perfectamente y la máquinas se integran sin ningún problema. He decidido autenticar en alfresco mediante el LDAP sin perder la autenticación nativa de alfresco por si necesito algun usuario externo a la empresa, por tanto modifico alfresco-global-properties:
——————————————————————————-
### AUTENTICACION ###
authentication.chain=alfrescoNtlm1:alfrescoNtlm,passthru1Smiley Tongueassthru,ldap1:ldap

###Sincronizacion
synchronization.allowDeletions=true
synchronization.synchronizeChangesOnly=true
synchronization.import.cron=0 0/5 * * * ?
synchronization.syncOnStartup=true
synchronization.syncWhenMissingPeopleLogIn=true
synchronization.autoCreatePeopleOnLogin=false
——————————————————————————-

Y ldap-authentication.properties:
——————————————————————————–
# This flag enables use of this LDAP subsystem for authentication. It may be
# that this subsytem should only be used for synchronization, in which case
# this flag should be set to false.
ldap.authentication.active=true

#
# This properties file brings together the common options for LDAP authentication rather than editing the bean definitions
#
ldap.authentication.allowGuestLogin=true
# How to map the user id entered by the user to that passed through to LDAP
# - simple
#    - this must be a DN and would be something like
#      uid=%s,ou=People,dc=company,dc=com
# - digest
#    - usually pass through what is entered
#      %s
# If not set, an LDAP query involving ldap.synchronization.personQuery and ldap.synchronization.userIdAttributeName will
# be performed to resolve the DN dynamically. This allows directories to be structured and doesn't require the user ID to
# appear in the DN.
ldap.authentication.userNameFormat=uid=%s,ou=Usuarios,dc=agorac,dc=local

# The LDAP context factory to use
ldap.authentication.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory

# The URL to connect to the LDAP server
ldap.authentication.java.naming.provider.url=ldap://ldap.agorac.local:389

# The authentication mechanism to use for password validation
ldap.authentication.java.naming.security.authentication=simple

# Escape commas entered by the user at bind time
# Useful when using simple authentication and the CN is part of the DN and contains commas
ldap.authentication.escapeCommasInBind=false

# Escape commas entered by the user when setting the authenticated user
# Useful when using simple authentication and the CN is part of the DN and contains commas, and the escaped \, is
# pulled in as part of an LDAP sync
# If this option is set to true it will break the default home folder provider as space names can not contain \
ldap.authentication.escapeCommasInUid=false

# Comma separated list of user names who should be considered administrators by default
ldap.authentication.defaultAdministratorUserNames=root,administrador,admin,javier

# This flag enables use of this LDAP subsystem for user and group
# synchronization. It may be that this subsytem should only be used for
# authentication, in which case this flag should be set to false.
ldap.synchronization.active=true

# The authentication mechanism to use for synchronization
ldap.synchronization.java.naming.security.authentication=simple

# The default principal to use (only used for LDAP sync)
ldap.synchronization.java.naming.security.principal=cn\=admin,dc\=agorac,dc\=local

# The password for the default principal (only used for LDAP sync)
ldap.synchronization.java.naming.security.credentials=supra

# If positive, this property indicates that RFC 2696 paged results should be
# used to split query results into batches of the specified size. This
# overcomes any size limits imposed by the LDAP server.
ldap.synchronization.queryBatchSize=0

# If positive, this property indicates that range retrieval should be used to fetch
# multi-valued attributes (such as member) in batches of the specified size.
# Overcomes any size limits imposed by Active Directory.       
ldap.synchronization.attributeBatchSize=0

# The query to select all objects that represent the groups to import.
ldap.synchronization.groupQuery=(objectclass\=posixGroup)
# groupOfNames (Esto va en lugar de posixGroup en la siguiente directiva tambien.)

# The query to select objects that represent the groups to import that have changed since a certain time.
ldap.synchronization.groupDifferentialQuery=(&(objectclass\=posixGroup)(!(modifyTimestamp<\={0})))

# The query to select all objects that represent the users to import.
ldap.synchronization.personQuery=(objectclass\=inetOrgPerson)

# The query to select objects that represent the users to import that have changed since a certain time.
ldap.synchronization.personDifferentialQuery=(&(objectclass\=inetOrgPerson)(!(modifyTimestamp<\={0})))

# The group search base restricts the LDAP group query to a sub section of tree on the LDAP server.
ldap.synchronization.groupSearchBase=ou\=Grupos,dc\=agorac,dc\=local

# The user search base restricts the LDAP user query to a sub section of tree on the LDAP server.
ldap.synchronization.userSearchBase=ou\=Usuarios,dc\=agorac,dc\=local

# The name of the operational attribute recording the last update time for a group or user.
ldap.synchronization.modifyTimestampAttributeName=modifyTimestamp

# The timestamp format. Unfortunately, this varies between directory servers.
ldap.synchronization.timestampFormat=yyyyMMddHHmmss'Z'

# The attribute name on people objects found in LDAP to use as the uid in Alfresco
ldap.synchronization.userIdAttributeName=uid

# The attribute on person objects in LDAP to map to the first name property in Alfresco
ldap.synchronization.userFirstNameAttributeName=givenName

# The attribute on person objects in LDAP to map to the last name property in Alfresco
ldap.synchronization.userLastNameAttributeName=sn

# The attribute on person objects in LDAP to map to the email property in Alfresco
ldap.synchronization.userEmailAttributeName=mail

# The attribute on person objects in LDAP to map to the organizational id  property in Alfresco
ldap.synchronization.userOrganizationalIdAttributeName=ou

# The default home folder provider to use for people created via LDAP import
ldap.synchronization.defaultHomeFolderProvider=largeHomeFolderProvider

# The attribute on LDAP group objects to map to the authority name property in Alfresco
ldap.synchronization.groupIdAttributeName=cn

# The attribute on LDAP group objects to map to the authority display name property in Alfresco
ldap.synchronization.groupDisplayNameAttributeName=description

# The group type in LDAP
ldap.synchronization.groupType=posixGroup
# Aqui también cambié groupOfNames por posixGroup

# The person type in LDAP
ldap.synchronization.personType=inetOrgPerson

# The attribute in LDAP on group objects that defines the DN for its members
ldap.synchronization.groupMemberAttributeName=gidNumber

# If true progress estimation is enabled. When enabled, the user query has to be run twice in order to count entries.
ldap.synchronization.enableProgressEstimation=true

# Requests timeout, in miliseconds, use 0 for none (default)
ldap.authentication.java.naming.read.timeout=0
——————————————————————————————
El caso es que todo funciona ok, me crea los usuarios, me crea los grupos…. pero no me asocia los usuarios a los grupos que pertenece, es decir, tengo creado en el ldap el usuario javier y lo tengo como miembro del grupo Administradores del Dominio, sin embargo en alfresco todos los grupos están vacíos y no sé por qué. Si me alguien tiene alguna sugerencia….

Un saludo.
4 REPLIES 4

javi
Champ in-the-making
Champ in-the-making
Otra cosa, tengo habilitado SSO con la autenticación para poder autenticarse automaticamente con el navegador (no sé si eso tendrá algo que ver), la cuestión es que cuando intento acceder desde fuera del dominio me pide el usuario y contraseña, le pongo dominio\usuario y la contraseña y no accede, en la salida de catalina me dice: 
2015-05-10 19:17:21,665  ERROR [app.servlet.NTLMAuthenticationFilter] [http-apr-8080-exec-3] Client JAVI-PC using NTLMv2 logon, not valid with passthru authentication

Si le doy a cancelar me muestra la pantalla de login de alfresco, pongo el usuario y contraseña y accedo, no hay problema.

javi
Champ in-the-making
Champ in-the-making
A esto me respondo yo mismo, es por el NTLMv2, cuando se cambia en las opciones de seguridad de windows 7 para utilizar NTLM funciona sin problemas.

angelborroy
Community Manager Community Manager
Community Manager
Tuve el mismo problema en una ocasión. Lo solucioné examinando el código fuente de Alfresco y llegué a la conclusión de que debía poner la siguiente línea en el ldap-authentication.properties

<javascript>
ldap.synchronization.attributeBatchSize=0
</javascript>

Aunque no recuerdo por qué llegué a esta conclusión. El caso es que con esta propiedad a ese valor, la sincronización de grupos funcionó.

Quizá podrías habilitar las trazas de depuración del subsistema de autenticación y echarle un vistazo para ver por qué no está sincronizando.

Suerte
Hyland Developer Evangelist

javi
Champ in-the-making
Champ in-the-making
No he conseguido que funcione, seguiré investigando, ya os contaré como me ha ido. Muchas gracias Angel.