cancel
Showing results for 
Search instead for 
Did you mean: 

Setup of ldap-ad in alfresco

enr
Champ on-the-rise
Champ on-the-rise
Dear all,

I have many problems on setting up a working ldap-ad configuration in alfresco. I already tried several solutions proposed in other posts but they didn't work at all.
Here my  configuration:

repository.properties

authentication.chain=ldap-ad1:ldap-ad

ldap-ad-authentication.properties

ldap.authentication.active=true
ldap.authentication.allowGuestLogin=false
ldap.authentication.userNameFormat=%s@example.org
ldap.authentication.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
ldap.authentication.java.naming.provider.url=ldap://xxx.xxx.xxx.xxx
ldap.authentication.java.naming.security.authentication=simple
ldap.authentication.escapeCommasInBind=false
ldap.authentication.escapeCommasInUid=false
ldap.synchronization.active=true
ldap.synchronization.java.naming.security.principal=username@example.org
ldap.synchronization.java.naming.security.credentials=mypassword
ldap.synchronization.queryBatchSize=1000
ldap.synchronization.groupQuery=(objectclass\=group)




This is the error tomcat report on catalina.out:


13:58:32,848  INFO  [management.subsystems.ChildApplicationContextFactory] Startup of 'Authentication' subsystem, ID: [Authentication, managed, ldap-ad1] complete
13:58:32,902  INFO  [management.subsystems.ChildApplicationContextFactory] Startup of 'fileServers' subsystem, ID: [fileServers, default] complete
13:58:32,903  INFO  [management.subsystems.ChildApplicationContextFactory] Starting 'imap' subsystem, ID: [imap, default]
13:58:32,908  ERROR [org.alfresco.fileserver] [FTP] FTP Socket error : java.net.BindException: Permission denied
13:58:32,912  ERROR [org.alfresco.fileserver] java.net.BindException: Permission denied
13:58:32,912  ERROR [org.alfresco.fileserver]   at java.net.PlainSocketImpl.socketBind(Native Method)
13:58:32,912  ERROR [org.alfresco.fileserver]   at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
13:58:32,912  ERROR [org.alfresco.fileserver]   at java.net.ServerSocket.bind(ServerSocket.java:319)
13:58:32,912  ERROR [org.alfresco.fileserver]   at java.net.ServerSocket.<init>(ServerSocket.java:185)



Please, could anyone tell me what it's wrong? It seems to be a credential problem but I tried to connect with an LDAP browser with the same credentials and it works.

Thank you very much.
12 REPLIES 12

gyro_gearless
Champ in-the-making
Champ in-the-making
Judging from the logfile LDAP is not (yet) your problem: Alfresco says it cant start its builtin FTP-Server. So you should either disable this feature (i'd do this anyway unless you really have a good use case for FTP); or check why FTP cant start (Running Alfresco as non-root on Unix? Other FTPD running? Possibly Firewall on Windoze?)

HTH
Gyro

enr
Champ on-the-rise
Champ on-the-rise
Thank you for your answer,
I posted the wrong part of the log file, this one is the correct one related to LDAP service.


14:48:33,789  INFO  [management.subsystems.ChildApplicationContextFactory] Starting 'Synchronization' subsystem, ID: [Synchronization, default]
14:48:33,891  INFO  [alfresco.config.JndiPropertyPlaceholderConfigurer] Loading properties file from class path resource [alfresco/alfresco-shared.properties]
14:48:34,004 User:System INFO  [security.sync.ChainingUserRegistrySynchronizer] Synchronizing users and groups with user registry 'ldap-ad1'
14:48:34,007 User:System INFO  [security.sync.ChainingUserRegistrySynchronizer] Retrieving all groups from user registry 'ldap-ad1'
14:48:34,050 User:System ERROR [security.sync.ChainingUserRegistrySynchronizer] Synchronization aborted due to error
org.alfresco.repo.security.authentication.AuthenticationException: 05010001 LDAP authentication failed.
        at org.alfresco.repo.security.authentication.ldap.LDAPInitialDirContextFactoryImpl.buildInitialDirContext(LDAPInitialDirContextFactoryImpl.java:116)
        at org.alfresco.repo.security.authentication.ldap.LDAPInitialDirContextFactoryImpl.getDefaultIntialDirContext(LDAPInitialDirContextFactoryImpl.java:91)
        at org.alfresco.repo.security.authentication.ldap.LDAPInitialDirContextFactoryImpl.getDefaultIntialDirContext(LDAPInitialDirContextFactoryImpl.java:82)
        at org.alfresco.repo.security.sync.ldap.LDAPUserRegistry$3.<init>(LDAPUserRegistry.java:596)
        at org.alfresco.repo.security.sync.ldap.LDAPUserRegistry.getGroups(LDAPUserRegistry.java:593)
        at org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer.syncWithPlugin(ChainingUserRegistrySynchronizer.java:521)
        at org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer.synchronize(ChainingUserRegistrySynchronizer.java:396)
        at org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer$7.doWork(ChainingUserRegistrySynchronizer.java:1217)

I don't think the ftp problem is related to ldap, or I am wrong?
For now I am only interested to setup a working connection between my active directory and alfresco.
I am running alfresco under unix.

Thank you

nvir
Champ in-the-making
Champ in-the-making
Hello,

As the log say "LDAP authentication failed", it seems that Alfresco could not log to the ldap server.
You maybe have to change the following value with a user which could authenticate to the server:


ldap.synchronization.java.naming.security.principal=username@example.org
ldap.synchronization.java.naming.security.credentials=mypassword
Hope this helps.
Alain

enr
Champ on-the-rise
Champ on-the-rise
Thank you Alain,
this was exactly the solution to my problem. Unfortunately I have another problem related to the fact that I am not able to log in Alfresco with user name and password stored in my active directory.
I am trying to setup only the authentication through active directory in alfresco, I tried a lot of different configuration but I always had problems.
This is my ldap-ad-authentication.properties

ldap.authentication.active=true
ldap.authentication.allowGuestLogin=true
ldap.authentication.userNameFormat=%s@domain
ldap.authentication.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
ldap.authentication.java.naming.provider.url=ldap://xxx.xx.x.x:389
ldap.authentication.java.naming.security.authentication=simple
ldap.authentication.escapeCommasInBind=false
ldap.authentication.escapeCommasInUid=false
ldap.authentication.defaultAdministratorUserNames=Administrator
ldap.synchronization.active=false
ldap.synchronization.java.naming.security.principal=user@domain
ldap.synchronization.java.naming.security.credentials=password
ldap.synchronization.queryBatchSize=1000

This is my ldap-ad-authentication-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   <!–
      The bean definitions for this subsystem are shared by the ldap and ldap-ad subsystems with different property
      defaults
   –>
   <import resource="../common-ldap-context.xml" />
</beans>

This is my common-ldap-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<!–
   Bean definitions shared by the ldap and ldap-ad subsystems
–>

<beans>
   <!–
      DAO that rejects changes - LDAP is read only at the moment. It does allow users to be deleted with out warnings
      from the UI.
   –>

   <bean id="authenticationDao" class="org.alfresco.repo.security.authentication.DefaultMutableAuthenticationDao">
      <property name="allowSetEnabled" value="true" />
      <property name="allowGetEnabled" value="true" />
      <property name="allowDeleteUser" value="true" />
      <property name="allowCreateUser" value="true" />
   </bean>

   <!– LDAP authentication configuration –>

   <!–

      You can also use JAAS authentication for Kerberos against Active Directory or NTLM if you also require single sign
      on from the web browser. You do not have to use LDAP authentication to synchronise groups and users from an LDAP
      store if it supports other authentication routes, like Active Directory.
   –>

   <bean id="authenticationComponent" class="org.alfresco.repo.security.authentication.ldap.LDAPAuthenticationComponentImpl"
      parent="authenticationComponentBase">
      <property name="active">
         <value>${ldap.authentication.active}</value>
      </property>
      <property name="LDAPInitialDirContextFactory">
         <ref bean="ldapInitialDirContextFactory" />
      </property>
      <property name="userNameFormat">
         <value>${ldap.authentication.userNameFormat}</value>
      </property>
      <property name="ldapNameResolver">
         <ref bean="userRegistry" />
      </property>
      <property name="nodeService">
         <ref bean="nodeService" />
      </property>
      <property name="personService">
         <ref bean="personService" />
      </property>
      <property name="transactionService">
         <ref bean="transactionService" />
      </property>
      <property name="escapeCommasInBind">
         <value>${ldap.authentication.escapeCommasInBind}</value>
      </property>
      <property name="escapeCommasInUid">
         <value>${ldap.authentication.escapeCommasInUid}</value>
      </property>
      <property name="allowGuestLogin">
         <value>${ldap.authentication.allowGuestLogin}</value>
      </property>
      <property name="defaultAdministratorUserNameList">
         <value>${ldap.authentication.defaultAdministratorUserNames}</value>
      </property>
   </bean>

   <!– Wrapped version to be used within subsystem –>
   <bean id="AuthenticationComponent" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
      <property name="proxyInterfaces">
         <value>org.alfresco.repo.security.authentication.AuthenticationComponent</value>
      </property>
      <property name="transactionManager">
         <ref bean="transactionManager" />
      </property>
      <property name="target">
         <ref bean="authenticationComponent" />
      </property>
      <property name="transactionAttributes">
         <props>
            <prop key="*">${server.transaction.mode.default}</prop>
         </props>
      </property>
   </bean>

   <!– Authenticaton service for chaining –>
   <bean id="localAuthenticationService" class="org.alfresco.repo.security.authentication.AuthenticationServiceImpl">
      <property name="authenticationDao">
         <ref bean="authenticationDao" />
      </property>
      <property name="ticketComponent">
         <ref bean="ticketComponent" />
      </property>
      <property name="authenticationComponent">
         <ref bean="authenticationComponent" />
      </property>
      <property name="sysAdminParams">
         <ref bean="sysAdminParams" />
      </property>
   </bean>

   <!–

      This bean is used to support general LDAP authentication. It is also used to provide read only access to users and
      groups to pull them out of the LDAP reopsitory
   –>

   <bean id="ldapInitialDirContextFactory" class="org.alfresco.repo.security.authentication.ldap.LDAPInitialDirContextFactoryImpl">
      <property name="initialDirContextEnvironment">
         <map>
            <!– The LDAP provider –>
            <entry key="java.naming.factory.initial">
               <value>${ldap.authentication.java.naming.factory.initial}</value>
            </entry>

            <!– The url to the LDAP server –>
            <!– Note you can use space separated urls - they will be tried in turn until one works –>
            <!– This could be used to authenticate against one or more ldap servers (you will not know which one ….) –>
            <entry key="java.naming.provider.url">
               <value>${ldap.authentication.java.naming.provider.url}</value>
            </entry>

            <!– The authentication mechanism to use      –>
            <!– Some sasl authentication mechanisms may require a realm to be set –>
            <!–                java.naming.security.sasl.realm –>
            <!– The available options will depend on your LDAP provider –>
            <entry key="java.naming.security.authentication">
               <value>${ldap.authentication.java.naming.security.authentication}</value>
            </entry>

            <!– The id of a user who can read group and user information –>
            <!– This does not go through the pattern substitution defined above and is used "as is" –>
            <entry key="java.naming.security.principal">
               <value>${ldap.synchronization.java.naming.security.principal}</value>
            </entry>

            <!– The password for the user defined above –>
            <entry key="java.naming.security.credentials">
               <value>${ldap.synchronization.java.naming.security.credentials}</value>
            </entry>
         </map>
      </property>
   </bean>

    <!– Regularly exports user and group information from LDAP –>
   
    <bean id="userRegistry" class="org.alfresco.repo.security.sync.ldap.LDAPUserRegistry">
        <property name="active">
            <value>${ldap.synchronization.active}</value>
        </property>

        <!–
        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.       
        –>
        <property name="queryBatchSize">
            <value>${ldap.synchronization.queryBatchSize}</value>
        </property>

        <!–
        The query to select all objects that represent the groups to import.
       
        For Open LDAP, using a basic schema, the following is probably what you want:
        (objectclass=groupOfNames)
       
        For Active Directory:
        (objectclass=group)
        –>
        <property name="groupQuery">
            <value>${ldap.synchronization.groupQuery}</value>
        </property>
       
        <!–
        The query to select objects that represent the groups to import that have changed since a certain time.
       
        For Open LDAP, using a basic schema, the following is probably what you want:
        (&(objectclass=groupOfNames)(!(modifyTimestamp<={0})))
       
        For Active Directory:
        (&(objectclass=group)(!(modifyTimestamp<={0})))
        –>
        <property name="groupDifferentialQuery">
            <value>${ldap.synchronization.groupDifferentialQuery}</value>
        </property>

        <!–
        The query to select all objects that represent the users to import.
       
        For Open LDAP, using a basic schema, the following is probably what you want:
        (objectclass=inetOrgPerson)
       
        For Active Directory:
        (objectclass=user)
        –>
        <property name="personQuery">
            <value>${ldap.synchronization.personQuery}</value>
        </property>
       
        <!–
        The query to select objects that represent the users to import that have changed since a certain time.
       
        For Open LDAP, using a basic schema, the following is probably what you want:
        (&(objectclass=inetOrgPerson)(!(modifyTimestamp<={0})))
       
        For Active Directory:
        (&(objectclass=user)(!(modifyTimestamp<={0})))
        –>
        <property name="personDifferentialQuery">
            <value>${ldap.synchronization.personDifferentialQuery}</value>
        </property>

        <!–
        The group search base restricts the LDAP group query to a sub section of tree on the LDAP server.
        –>
        <property name="groupSearchBase">
            <value>${ldap.synchronization.groupSearchBase}</value>
        </property>
       
        <!–
        The user search base restricts the LDAP user query to a sub section of tree on the LDAP server.
        –>
        <property name="userSearchBase">
            <value>${ldap.synchronization.userSearchBase}</value>
        </property>

        <!–
        The unique identifier for the user.
        –>
        <property name="userIdAttributeName">
            <value>${ldap.synchronization.userIdAttributeName}</value>
        </property>
       
        <!–
        The name of the operational attribute recording the last update time for a group or user.
        –>
        <property name="modifyTimestampAttributeName">
            <value>${ldap.synchronization.modifyTimestampAttributeName}</value>
        </property>

        <!–
        The timestamp format. Unfortunately, this varies between directory servers.
        –>
        <property name="timestampFormat">
            <value>${ldap.synchronization.timestampFormat}</value>
        </property>

        <!–
        An attribute that is a unique identifier for each group found.
        This is also the name of the group with the current group implementation.
        This is mandatory for any groups found.
       
        OpenLDAP: "cn" as it is mandatory on groupOfNames
        Active Directory: "cn"
       
        –>
        <property name="groupIdAttributeName">
            <value>${ldap.synchronization.groupIdAttributeName}</value>
        </property>
       
        <!–
        The objectClass attribute for group members.
        For each member of a group, the distinguished name is given.
        The object is looked up by its DN. If the object is of this class it is treated as a group.
        –>
        <property name="groupType">
            <value>${ldap.synchronization.groupType}</value>
        </property>
       
        <!–
        The objectClass attribute for person members.
        For each member of a group, the distinguished name is given.
        The object is looked up by its DN. If the object is of this class it is treated as a person.
        –>
        <property name="personType">
            <value>${ldap.synchronization.personType}</value>
        </property>
       
        <!–
        The repeating attribute on group objects (found by query or as sub groups)
        used to define membership of the group. This is assumed to hold distinguished names of
        other groups or users/people; the above types are used to determine this.
       
        OpenLDAP: "member" as it is mandatory on groupOfNames
        Active Directory: "member"
       
        –>
        <property name="memberAttribute">
            <value>${ldap.synchronization.groupMemberAttributeName}</value>
        </property>       

        <!–
        This property defines a mapping between attributes held on LDAP user objects and
        the properties of user objects held in the repository. The key is the QName of an attribute in
        the repository, the value is the attribute name from the user/inetOrgPerson/.. object in the
        LDAP repository.    
        –>
        <property name="attributeMapping">
            <map>
                <entry key="cm:userName">
                    <!– Must match the same attribute as userIdAttributeName –>
                    <value>${ldap.synchronization.userIdAttributeName}</value>
                </entry>
                <entry key="cm:firstName">
                    <!– OpenLDAP: "givenName" –>
                    <!– Active Directory: "givenName" –>
                    <value>${ldap.synchronization.userFirstNameAttributeName}</value>
                </entry>
                <entry key="cm:lastName">
                    <!– OpenLDAP: "sn" –>
                    <!– Active Directory: "sn" –>
                    <value>${ldap.synchronization.userLastNameAttributeName}</value>
                </entry>
                <entry key="cm:email">
                    <!– OpenLDAP: "mail" –>
                    <!– Active Directory: "???" –>
                    <value>${ldap.synchronization.userEmailAttributeName}</value>
                </entry>
                <entry key="cm:organizationId">
                    <!– OpenLDAP: "o" –>
                    <!– Active Directory: "???" –>
                    <value>${ldap.synchronization.userOrganizationalIdAttributeName}</value>
                </entry>
                <!– Always use the default –>
                <entry key="cm:homeFolderProvider">
                    <null/>
                </entry>
            </map>
        </property>
        <!– Set a default home folder provider –>
        <!– Defaults only apply for values above –>
        <property name="attributeDefaults">
            <map>
                <entry key="cm:homeFolderProvider">
                    <value>${ldap.synchronization.defaultHomeFolderProvider}</value>
                </entry>
            </map>
        </property>
   
        <property name="enableProgressEstimation">
            <value>${ldap.synchronization.enableProgressEstimation}</value>
        </property>

        <!– Services –>
        <property name="LDAPInitialDirContextFactory">
            <ref bean="ldapInitialDirContextFactory"/>
        </property>
        <property name="namespaceService">
            <ref bean="namespaceService"/>
        </property>
       
    </bean>

</beans>

nvir
Champ in-the-making
Champ in-the-making
Hello,

… active directory …

As we have no Windows server and no active directory, I cannot help you with authentication through an AD.

But are you sure that you have to modify the xml files ?

I thought that from 3.2, you only have to add a subsystem and then change property files.

Greetings,
Alain

enr
Champ on-the-rise
Champ on-the-rise
Hi,
thank you very much for your replies. I think that the problem resides in the beans defined in the common-ldap-context.xml. I didn't change anything of the xml file, I only set up the minimum configuration on ldap-ad-authentication.properties file (I read in other posts related to this topic how to do it).
I currently installed the alfresco version 3.2r2 but I didn't find any useful help on this topic.
I don't know if it's better to change the common-ldap-context.xml or working on the ldap-ad-authentication.properties
However I am quite sure the problems resides in the beans definition of the common-ldap-contenxt.xml

Greetings,
Enrico

enr
Champ on-the-rise
Champ on-the-rise
Well,
I think to be near to the solution. I find out that xml files are not necessary (as Alain suggested). Now the log file returns the following information:

14:20:13,601  INFO  [management.subsystems.ChildApplicationContextFactory] Startup of 'Authentication' subsystem, ID: [Authentication, managed, ldap-ad1] complete


It seems that my configuration is correct but I am still unable to access with my active directory credentials.
With softerra I used the following information:


base=OU=TEMPORARY,OU=Users,OU=Domain,DC=DOMAIN,DC=DOMAIN2,DC=ORG
URL=ldap://172.19.6.1:389/OU=TEMPORARY,OU=Users,OU=Domain,DC=DOMAIN,DC=DOMAIN2,DC=ORG??base?(objectClass=*)
userPrincipalName = name@xxx.org

I set up my ldap-ad-authentication.properties in the following way:

ldap.authentication.active=true
ldap.authentication.allowGuestLogin=true
ldap.authentication.userNameFormat=%s@xxx.ORG,OU=TEMPORARY,OU=Users,OU=Domain,DC=DOMAIN,DC=DOMAIN2,DC=ORG
ldap.authentication.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
ldap.authentication.java.naming.provider.url=ldap://xxx.xxx.xxx.xxx:389
ldap.authentication.java.naming.security.authentication=simple
ldap.authentication.escapeCommasInBind=false
ldap.authentication.escapeCommasInUid=false
ldap.authentication.defaultAdministratorUserNames=Administrator
ldap.synchronization.active=false
ldap.synchronization.java.naming.security.principal=user@domain
ldap.synchronization.java.naming.security.credentials=mypassword
ldap.synchronization.queryBatchSize=1000

I am sure I am missing something very simple on the configuration, like the base setup or something similar.
Anyone can help please?

Thank you,
Enrico

enr
Champ on-the-rise
Champ on-the-rise
Well, finally I found the correct configuration for ldap-ad authentication.

The problem now reside on the override of the configuration file regarding ldap-ad files. I read in other posts that this problem was a bug which should be solved.
I am using the 3.2r2 version.

I put the alfresco-global.properties file in:
/srv/www/tomcat55/base/shared/classes

The ldap-ad-authentication-context.xml  ldap-ad-authentication.properties in:
/srv/www/tomcat55/base/shared/classes/alfresco/extension/subsystems/Authentication/ldap-ad/ldap-ad1

If I rename the files in /srv/www/tomcat55/base/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/Authentication/ldap-ad all works in the right way, otherwise, if i didn't rename the files, the files in  /srv/www/tomcat55/base/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/Authentication/ldap-ad have priority in the files I created to override the configuration.

Any help please?

Thank you,
Enrico