cancel
Showing results for 
Search instead for 
Did you mean: 

Inconsistency with LDAP Query

jdel23
Champ in-the-making
Champ in-the-making
I am having a load of issues with integrating Alfresco 4.2.c with Active Directory. Please allow me to detail my first issue and hopefully some of you will point out my mistake. All/any help will be greatly appreciated…

If I clean the DB and start Alfresco with my configuration - listed below, everything is fine. If I then simply stop and restart Alfresco I get this exception:

12:51:51,022 INFO  [org.alfresco.repo.management.subsystems.ChildApplicationContextFactory] Starting 'Synchronization' subsystem, ID: [Synchronization, default]
12:51:51,069 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Synchronizing users and groups with user registry 'ldap1'
12:51:51,116 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Retrieving groups changed since 12-Nov-2013 16:16:33 from user registry 'ldap1'
12:51:51,755 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] ldap1 Group Analysis: Commencing batch of 0 entries
12:51:51,755 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] ldap1 Group Analysis: Completed batch of 0 entries
12:51:51,771 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Retrieving users changed since 03-Feb-2014 17:28:21 from user registry 'ldap1'
12:51:51,771 ERROR [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Synchronization aborted due to error
org.alfresco.error.AlfrescoRuntimeException: 01040001 User and group import failed
   at org.alfresco.repo.security.sync.ldap.LDAPUserRegistry.processQuery(LDAPUserRegistry.java:1188)
   at org.alfresco.repo.security.sync.ldap.LDAPUserRegistry.access$2500(LDAPUserRegistry.java:77)
   at org.alfresco.repo.security.sync.ldap.LDAPUserRegistry$PersonCollection.<init>(LDAPUserRegistry.java:1349)
   at org.alfresco.repo.security.sync.ldap.LDAPUserRegistry.getPersons(LDAPUserRegistry.java:544)
   at org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer.syncWithPlugin(ChainingUserRegistrySynchronizer.java:1599)
   at org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer.synchronize(ChainingUserRegistrySynchronizer.java:587)
   at org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer$7.doWork(ChainingUserRegistrySynchronizer.java:1919)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:529)
   at org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer.onBootstrap(ChainingUserRegistrySynchronizer.java:1913)
   at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecyc

Caused by: javax.naming.directory.InvalidSearchFilterException: invalid attribute description; remaining name 'ou=Workers,dc=vvv,dc=xxx,dc=yyy,dc=zzz'
   at com.sun.jndi.ldap.Filter.encodeSimpleFilter(Filter.java:446)

The funny thing is that any subsequent CRON synch jobs run without any errors:

12:55:00,078 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Synchronizing users and groups with user registry 'ldap1'
12:55:00,078 WARN  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Full synchronization with user registry 'ldap1'
12:55:00,078 WARN  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Some users and groups previously created by synchronization with this user registry may be removed.
12:55:00,094 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Retrieving all groups from user registry 'ldap1'
12:55:01,092 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] ldap1 Group Analysis: Commencing batch of 1 entries
12:55:01,124 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] ldap1 Group Analysis: Processed 1 entries out of 1. 100% complete. Rate: 31 per second. 0 failures detected.
12:55:01,124 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] ldap1 Group Analysis: Completed batch of 1 entries
12:55:01,358 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Retrieving all users from user registry 'ldap1'
12:55:01,451 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] ldap1 User Creation and Association: Commencing batch of 11 entries
12:55:01,607 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] ldap1 User Creation and Association: Processed 11 entries out of 11. 100% complete. Rate: 70 per second. 0 failures detected.
12:55:01,607 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] ldap1 User Creation and Association: Completed batch of 11 entries
12:55:02,138 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] Finished synchronizing users and groups with user registry 'ldap1'
12:55:02,138 INFO  [org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer] 11 user(s) and 1 group(s) processed


Here is my configuration:

# 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=false

# How to map the user id entered by the user to taht passed through to LDAP
# In Active Directory, this can either be the user principal name (UPN) or DN.
# UPNs are in the form <sAMAccountName>@domain and are held in the userPrincipalName attribute of a user
ldap.authentication.userNameFormat=ger\\%s
# 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://….

# 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=Administrator,alfresco,admin

# 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 bind with (only used for LDAP sync). This should be a UPN or DN
ldap.synchronization.java.naming.security.principal=….

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

# 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=1000

# 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=1000



#*********************************************************************************************
#
#   LDAP Query Properties
#
#*********************************************************************************************

# The query to select all objects that represent the groups to import.
ldap.synchronization.groupQuery=(&(objectclass\=group) (CN=IR Manu))

# The query to select objects that represent the groups to import that have changed since a certain time.
ldap.synchronization.groupDifferentialQuery=(&(objectclass\=group) (CN=IR Manu, ou\=Delegated,ou\=Groups,DC=vvv,DC=xxx,DC=yyy,DC=zzz)(!(whenChanged<\={0})))

# The query to select all objects that represent the users to import.
ldap.synchronization.personQuery=(&(objectclass\=user)(memberOf=CN=IR Manu,ou\=Delegated,ou\=Groups,DC=vvv,DC=xxx,DC=yyy,DC=zzz))

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

# The group search base restricts the LDAP group query to a sub section of tree on the LDAP server.
ldap.synchronization.groupSearchBase=ou\=Groups,dc=vvv,dc=xxx,dc=yyy,dc=zzz

# The user search base restricts the LDAP user query to a sub section of tree on the LDAP server.
ldap.synchronization.userSearchBase=ou\=Workers,dc=vvv,dc=xxx,dc=yyy,dc=zzz

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

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

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

# 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=intelOrgUnitDesc

# 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=displayName

# The group type in LDAP
ldap.synchronization.groupType=group

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

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

# 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=60000

4 REPLIES 4

mrogers
Star Contributor
Star Contributor
It doesn't like your user search base.   Double check that query.  Do you have an ldap browser you can try it on.

  Also you may have a spurious backslash character.

jdel23
Champ in-the-making
Champ in-the-making
Hi M, thanks for the quick response. I removed the backslash in the user and group search base and I get the same response. I also verified with LDAPAdmin that the user path and filter syntax is correct.

What I do not understand is why the same config works when starting a clean system, then fails on a restart but works again on subsequent sync tasks?

Is the usrSearchBase used in sync and not on startup? Is there any documentation that describes the usage and syntax of the configuration elements?

Again thanks for your help   

mrogers
Star Contributor
Star Contributor
There's a full sync and an incremental sync.    I suspect one of them is not working, from what you are saying Full sync is O.K.    But that does not square with the error message which was to do with userSearchBase  'ou=Workers,dc=vvv,dc=xxx,dc=yyy,dc=zzz'

jdel23
Champ in-the-making
Champ in-the-making
Hi M, yes you are right - my stupid mistake. I had a syntax error AND I had inadvertently set synchronizeChangesOnly=false.

This issue is now closed.

Thanks again for your help.