Poblème connexion utilisateur avec Active Directory

cancel
Showing results for 
Search instead for 
Did you mean: 
lekekoo
Member II

Poblème connexion utilisateur avec Active Directory

Bonjour à tous,

Je viens vers vous car j'ai deux problèmes avec L'AD d'un client. En effet, grâce aux tutos et aux différentes explications trouvées sur ce forum, je n'ai eu aucun mal à mettre en place l'authentification NTLM et la synchro avec l'AD. Les problèmes sont les suivants (sachant que ma marge de manœuvre sur l'AD est plus que réduite…) :
- J'ai mis en place une authentification sur le même principe avec un portail "Liferay". Je publie des contenus dans des portlets spécialisés. Cependant, j'ai des utilisateurs qui arrivent à se connecter au portail mais pas à Alfresco. Du coup, ils ne peuvent pas récupérer les contenus Alfresco et les pages restent blanches. Pourtant, le système d'authentification repose sur le même AD. Dans le logs Alfresco, j'ai juste des "Logon failure". Cela peux-t-il venir d'un problème de droit au niveau de l'AD ou cela est-il lié uniquement à Alfresco ? Je tiens à dire que cela ne concerne qu'un petit nombre d'utilisateurs et que cela marche pour la grande majorité des autres….  :cry:

- Je me suis aperçu, après de nombreuses relances du client, qu'un des utilisateurs se retrouve avec le rôle : "Guest" (Granted Authorities: Guest, ROLE_AUTHENTICATED au niveau des logs) . Il ne pouvait donc pas se connecter à Alfresco car par défaut le "guestAccess" est à "false" dans le ntlm-authentication-context.xml. J'ai donc dû le mettre à "true" pour qu'il puisse utiliser son compte. Est-ce que quelqu'un a une idée de pourquoi il récupère ce rôle ? Est-ce que cela vient de l'AD ?

Je suis dans l'impasse avec mes utilisateurs qui ne peuvent pas se connecter, donc je suis preneur de la moindre idée…   Smiley Very Happy

En vous remerciant d'avance …..
4 Replies
michaelh
Active Member

Re: Poblème connexion utilisateur avec Active Directory

Bonjour,

A première vue, comme ça, à froid, je n'ai aucune idée du pourquoi du comment.
Je penche très fortement pour un problème de configuration, avec tant qu'à faire des erreurs multiples (et pas une cause unique).

Vérifiez l'import des utilisateurs, si le fameux utilisateurs "reconnu comme guest" est bien importé, si oui dans quel groupe, sinon pourquoi, etc.
Après sans rien connaître de la version d'alfresco, des fichiers de conf, etc … difficile (comprendre : totalement impossible) de dire quoique ce soit de plus.

(Note pour plus tard, créer un BBCode pour insérer cette phrase automatiquement)
lekekoo
Member II

Re: Poblème connexion utilisateur avec Active Directory

Désolé pour les fichiers de conf… Je dois travailler trop tard.

Les voila :

ntlm-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>

    <bean id="authenticationDao" class="org.alfresco.repo.security.authentication.ntlm.NullMutableAuthenticationDao" >
    <property name="nodeService">
           <ref bean="nodeService" />
    </property>
  </bean>


    <!– The authentication component.                                      –>

    <!– Use the passthru authentication component to authenticate using    –>
    <!– user accounts on one or more Windows servers.                      –>
   
    <!– Properties that specify the server(s) to use for passthru          –>
    <!– authentication :-                                                  –>
    <!–   useLocalServer   use the local server for authentication         –>
    <!–   domain           use domain controllers from the specified domain–>
    <!–   servers          comma delimted list of server addresses or      –>
    <!–                    names                                           –>
      
    <bean id="authenticationComponent" class="org.alfresco.repo.security.authentication.ntlm.NTLMAuthenticationComponentImpl">
        <property name="useLocalServer">
            <value>false</value>
        </property>
        <property name="personService">
            <ref bean="personService" />
        </property>
        <property name="nodeService">
            <ref bean="nodeService" />
        </property>
        <property name="transactionService">
            <ref bean="transactionComponent" />
        </property>
        <property name="guestAccess">
            <value>true</value>
        </property>
        <property name="servers">
          <value>DOMAINE\SERVEUR_IP</value>
        </property>
    </bean>
   
</beans>

ldap-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>
  <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>com.sun.jndi.ldap.LdapCtxFactory</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://ip_serveur:389</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>simple</value>
        </entry>
        <!– The id of a user who can read group and user information –>
        <entry key="java.naming.security.principal">
          <value>cn=xxx,ou=Administrateurs,dc=xxx,dc=xxx</value>
        </entry>
        <!– The password for the user defined above –>
        <entry key="java.naming.security.credentials">
          <value>xxxxx</value>
        </entry>
      </map>
    </property>
  </bean>
  <!– Ldap Syncronisation support –>

  <!–     There can be more than one stack of beans that import users or groups. For example, it may be easier to have a version of ldapPeopleExportSource, and associated beans, for each sub-tree of your ldap directory from which you want to        import users. You could then limit users to be imported from two or more sub tress and ignore users found else where. The same applies to the import of groups.        
  –>
  <!– Extract user information from LDAP and transform this to XML –>
  <bean id="ldapPeopleExportSource" class="org.alfresco.repo.security.authentication.ldap.LDAPPersonExportSource">
    <!–
      The query to select objects that represent the users to import. For Active Directory: (objectclass=user)
    –>
    <property name="personQuery">
      <value>(objectclass=user)</value>
    </property>
    <!–
      The search base restricts the LDAP query to a sub section of tree on the LDAP server.
      In this particular example we imported only the IT Department users.
    –>
    <property name="searchBase">
      <value>dc=xxx,dc=xxx</value>
    </property>
    <!–
      The unique identifier for the user.THIS MUST MATCH WHAT THE USER TYPES IN AT THE LOGIN PROMPT  
      For simple LDAP authentication this is likely to be "cn" or, less friendly, "distinguishedName"
      In Active Directory this is most likely to be "sAMAccountName". This property is mandatory and must appear on all users found by the query defined above.
    –>
    <property name="userIdAttributeName">
      <value>sAMAccountName</value>
    </property>
    <!– Services –>
    <property name="LDAPInitialDirContextFactory">
      <ref bean="ldapInitialDirContextFactory" />
    </property>
    <property name="personService">
      <ref bean="personService"></ref>
    </property>
    <property name="namespaceService">
      <ref bean="namespaceService" />
    </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>sAMAccountName</value>
        </entry>
        <entry key="cm:firstName">
          <!– Active Directory: "givenName" –>
          <value>givenName</value>
        </entry>
        <entry key="cm:lastName">
          <!– Active Directory: "sn" –>
          <value>sn</value>
        </entry>
        <entry key="cm:email">
          <!– Active Directory: "???" –>
          <value>mail</value>
        </entry>
        <entry key="cm:organizationId">
          <!– Active Directory: "???" –>
          <value>o</value>
        </entry>
        <!– Always use the default –>
        <entry key="cm:homeFolderProvider">
          <null />
        </entry>
      </map>
    </property>
    <!– Set a default home folder provider. We configured it to create user home folder under  "User Homes" space–>
    <property name="attributeDefaults">
      <map>
        <entry key="cm:homeFolderProvider">
          <value>persoHomeFolderProvider</value>
        </entry>
      </map>
    </property>
  </bean>
  <!– Extract group information from LDAP and transform this to XML –>
  <bean id="ldapGroupExportSource" class="org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource">
    <!–
      The query to select objects that represent the groups to import.
      For Active Directory: (objectclass=group)
    –>
    <property name="groupQuery">
      <value>(objectclass=group)</value>
    </property>
    <!– The seach base restricts the LDAP query to a sub section of tree on the LDAP server. We reduced it to IT departments internal groups  –>
    <property name="searchBase">
      <value>dc=xxx,dc=xxx</value>
    </property>
    <!–        The unique identifier for the user. This must match the userIdAttributeName on the ldapPeopleExportSource bean above.        –>
    <property name="userIdAttributeName">
      <value>sAMAccountName</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.      
      Active Directory: "cn"  –>
    <property name="groupIdAttributeName">
      <value>cn</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>group</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>user</value>
    </property>
    <property name="LDAPInitialDirContextFactory">
      <ref bean="ldapInitialDirContextFactory" />
    </property>
    <property name="namespaceService">
      <ref bean="namespaceService" />
    </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.      
      Active Directory: "member"   –>
    <property name="memberAttribute">
      <value>member</value>
    </property>
    <property name="authorityDAO">
      <ref bean="authorityDAO" />
    </property>
  </bean>
  <!– Job definitions to import LDAP people and groups –>
  <!– The triggers register themselves with the scheduler –>
  <!– You may comment in the default scheduler to enable these triggers –>
  <!– If a cron base trigger is what you want seee scheduled-jobs-context.xml for examples. –>
  <!– Trigger to load poeple Note you can have more than one initial (context, trigger, import job and export source) seT. This would allow you to load people from more than one ldap store –>
  <bean id="ldapPeopleCronTrigger" class="org.alfresco.util.CronTriggerBean">
    <property name="jobDetail">
      <bean id="ldapCronPeopleJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
        <property name="jobClass">
          <value>org.alfresco.repo.importer.ImporterJob</value>
        </property>
        <property name="jobDataAsMap">
          <map>
            <entry key="bean">
              <ref bean="ldapPeopleImport" />
            </entry>
          </map>
        </property>
      </bean>
    </property>
    <property name="cronExpression">
       <value>0 0 13 ? * 2-6</value>
    </property>
    <property name="scheduler">
      <ref bean="schedulerFactory" />
    </property>
  </bean>
<!– <bean id="ldapGroupTrigger" class="org.alfresco.util.TriggerBean">
    <property name="jobDetail">
      <bean id="ldapGroupJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
        <property name="jobClass">
          <value>org.alfresco.repo.importer.ImporterJob</value>
        </property>
        <property name="jobDataAsMap">
          <map>
            <entry key="bean">
              <ref bean="ldapGroupImport" />
            </entry>
          </map>
        </property>
      </bean>
    </property>
    Start after 5 minutes of starting the repository
    <property name="startDelay">
      <value>180000</value>
    </property>
    Repeat every hour
    <property name="repeatInterval">
      <value>3600000</value>
    </property>
    <property name="scheduler">
      <ref bean="schedulerFactory" />
    </property>
  </bean>–>

  <!– The bean that imports xml describing people –>

  <bean id="ldapPeopleImport" class="org.alfresco.repo.importer.ExportSourceImporter">
    <property name="importerService">
      <ref bean="importerComponentWithBehaviour" />
    </property>
    <property name="transactionService">
      <ref bean="transactionComponent" />
    </property>
    <property name="authenticationComponent">
      <ref bean="authenticationComponent" />
    </property>
    <property name="exportSource">
      <ref bean="ldapPeopleExportSource" />
    </property>

    <!– The store that contains people - this should not be changed –>
    <property name="storeRef">
      <value>${spaces.store}</value>
    </property>

    <!– The location of people nodes within the store defined above - this should not be changed –>
    <property name="path">
      <value>/${system.system_container.childname}/${system.people_container.childname}</value>
    </property>

    <!– If true, clear all existing people before import, if false update/add people from the xml –>
    <property name="clearAllChildren">
      <value>false</value>
    </property>
    <property name="nodeService">
      <ref bean="nodeService" />
    </property>
    <property name="searchService">
      <ref bean="searchService" />
    </property>
    <property name="namespacePrefixResolver">
      <ref bean="namespaceService" />
    </property>


    <property name="caches">
      <set>
        <ref bean="permissionsAccessCache" />
      </set>
    </property>
  </bean>

  <!– The bean that imports xml descibing groups –>

  <bean id="ldapGroupImport" class="org.alfresco.repo.importer.ExportSourceImporter">
    <property name="importerService">
      <ref bean="importerComponentWithBehaviour" />
    </property>
    <property name="transactionService">
      <ref bean="transactionComponent" />
    </property>
    <property name="authenticationComponent">
      <ref bean="authenticationComponent" />
    </property>
    <property name="exportSource">
      <ref bean="ldapGroupExportSource" />
    </property>
    <!– The store that contains group information - this should not be changed –>
    <property name="storeRef">
      <value>${alfresco_user_store.store}</value>
    </property>

    <!– The location of group information in the store above - this should not be changed –>
    <property name="path">
      <value>/${alfresco_user_store.system_container.childname}/${alfresco_user_store.authorities_container.childname}</value>
    </property>

    <!– If true, clear all existing groups before import, if false update/add groups from the xml –>
    <property name="clearAllChildren">
      <value>true</value>
    </property>
    <property name="nodeService">
      <ref bean="nodeService" />
    </property>
    <property name="searchService">
      <ref bean="searchService" />
    </property>
    <property name="namespacePrefixResolver">
      <ref bean="namespaceService" />
    </property>

    <!– caches to clear on import of groups –>
    <property name="caches">
      <set>
        <ref bean="userToAuthorityCache" />
        <ref bean="permissionsAccessCache" />
      </set>
    </property>

    <!– userToAuthorityCache –>
  </bean>

</beans>

custom-authority-services-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>
    <bean id="authorityService" class="org.alfresco.repo.security.authority.AuthorityServiceImpl">
        <property name="authenticationComponent">
            <ref bean="authenticationComponent" />
        </property>
        <property name="personService">
            <ref bean="personService" />
        </property>
        <property name="nodeService">
            <ref bean="nodeService" />
        </property>
        <property name="authorityDAO">
            <ref bean="authorityDAO" />
        </property>
        <property name="permissionServiceSPI">
            <ref bean="permissionServiceImpl" />
        </property>
        <property name="adminUsers">
            <set>
             <value>XXXXX</value> <!– add an NTLM user as an Administrator –>
             <value>admin</value>
             <value>administrator</value>
          </set>
        </property>
    </bean>
</beans>

file-servers.xml :
<alfresco-config area="file-servers">

   <config evaluator="string-compare" condition="CIFS Server">
     <serverEnable enabled="true"/>
      <host name="${localname}_A"/>
      <comment>Alfresco CIFS Server</comment>

      <!– Set to the broadcast mask for the subnet –>
      <broadcast>255.255.255.255</broadcast>

      <!– Use Java socket based NetBIOS over TCP/IP and native SMB on linux –>
      <tcpipSMB platforms="linux,solaris,macosx"/>
      <netBIOSSMB platforms="linux,solaris,macosx"/>

      <!– Can be mapped to non-privileged ports, then use firewall rules to forward
          requests from the standard ports –>
     <!–      
      <tcpipSMB port="1445" platforms="linux,solaris,macosx"/>
      <netBIOSSMB sessionPort="1139" namePort="1137" datagramPort="1138" platforms="linux,solaris,macosx"/>
     –>
      
      <hostAnnounce interval="5"/>

      <!– Use Win32 NetBIOS interface on Windows –>
      <Win32NetBIOS/>
      <Win32Announce interval="5"/>

<!–
      <WINS>
         <primary>1.2.3.4</primary>
         <secondary>5.6.7.8</secondary>
      </WINS>
–>
      <sessionDebug flags="Negotiate,Socket"/>
   </config>

   <config evaluator="string-compare" condition="FTP Server">
     <serverEnable enabled="true"/>
<!–      <debug flags="File,Search,Error,Directory,Info,DataPort"/> –>
   </config>
  
   <config evaluator="string-compare" condition="NFS Server">
     <serverEnable enabled="false"/>
   </config>
   
   <config evaluator="string-compare" condition="Filesystems">
     <filesystems>
       
       <!– Alfresco repository access shared filesystem –>
         <filesystem name="Alfresco">
            <store>workspace://SpacesStore</store>
            <rootPath>/app:company_home</rootPath>

         <!– Add a URL file to each folder that links back to the web client –>
         <urlFile>
               <filename>__AlfrescoClient.url</filename>
               <webpath>http://${localname}:8080/alfresco/</webpath>
            </urlFile>

         <!– Mark locked files as offline –>
          <offlineFiles/>

         <!– Desktop actions –>
         <!– Uses a client-side application to trigger a server-side action                         –>
         <!–   Echo - displays a message echoed from the server                                     –>
         <!–   URL  - launches a URL via the Windows shell                                          –>
         <!–   CmdLine - launches the Notepad application                                           –>
         <!–   CheckInOut - checks files in/out, drag and drop files onto the application           –>
         <!–   JavaScript - run a server-side script                                                –>
         <!–   JavaScriptURL - server-side script that generates a URL to the folder using a ticket –>
         <!–                   to avoid having to logon                                             –>

<!–
         <desktopActions>
            <global>
                    <path>alfresco/desktop/Alfresco.exe</path>
               <webpath>http://${localname}:8080/alfresco/</webpath>
            </global>
            <action>
               <class>org.alfresco.filesys.smb.server.repo.desk.EchoDesktopAction</class>
               <name>Echo</name>
                 <filename>__AlfrescoEcho.exe</filename>
            </action>
            <action>
               <class>org.alfresco.filesys.smb.server.repo.desk.URLDesktopAction</class>
               <name>URL</name>
                 <filename>__AlfrescoURL.exe</filename>
            </action>
            <action>
               <class>org.alfresco.filesys.smb.server.repo.desk.CmdLineDesktopAction</class>
               <name>CmdLine</name>
                 <filename>__AlfrescoCmd.exe</filename>
            </action>
            <action>
               <class>org.alfresco.filesys.smb.server.repo.desk.CheckInOutDesktopAction</class>
               <name>CheckInOut</name>
                 <filename>__AlfrescoCheckInOut.exe</filename>
            </action>
            <action>
               <class>org.alfresco.filesys.smb.server.repo.desk.JavaScriptDesktopAction</class>
               <name>JavaScript</name>
               <filename>__AlfrescoScript.exe</filename>
               <script>alfresco/desktop/dumpRequest.js</script>
               <attributes>anyFiles, multiplePaths , allowNoParams</attributes>
               <preprocess>confirm, copyToTarget</preprocess>
            </action>
            <action>
               <class>org.alfresco.filesys.smb.server.repo.desk.JavaScriptDesktopAction</class>
               <name>JavaScriptURL</name>
               <filename>__AlfrescoDetails.exe</filename>
               <script>alfresco/desktop/showDetails.js</script>
               <attributes>anyFiles</attributes>
               <preprocess>copyToTarget</preprocess>
            </action>

         </desktopActions>
–>         
                   
<!–
            <accessControl default="Write">
               <user name="admin" access="Write"/>
               <address subnet="90.1.0.0" mask="255.255.0.0" access="Write"/>
            </accessControl>
–>
         </filesystem>
       
       <!– AVM virtualization view of all stores/versions for WCM –>
         <avmfilesystem name="AVM">
            <virtualView/>
         </avmfilesystem>
       
      </filesystems>
   </config>

   <config evaluator="string-compare" condition="Filesystem Security">
      <authenticator type="enterprise">
      </authenticator>

<!–
      <globalAccessControl default="None">
         <user name="admin" access="Write"/>
         <address ip="90.1.0.90" access="Write"/>
      </globalAccessControl>

      <users>
         <localuser name="user">
            <password>user</password>
            <comment>Normal user account</comment>
         </localuser>
   
         <localuser name="administrator">
            <password>admin</password>
            <administrator/>
            <comment>Administrator account</comment>
         </localuser>
      </users>
–>
   <DomainMappings>
        <Domain name="XXXX" subnet="192.168.0.0" mask="192.168.0.255"/>
   </DomainMappings>
   </config>


</alfresco-config>

Voili voilou….
lme
Partner

Re: Poblème connexion utilisateur avec Active Directory

On va commencer par quelques questions Smiley Happy
Le problème n'intervient que dans le client web ? Jamais de problème en cifs ?
On pourrait avoir les lignes de logs avec les erreurs ?
Est-ce que les postes des personnes qui sont vues comme guest sont sur le domaine ?
Quelle version d'Alfresco ? Ça tourne sous windows, linux ?

Peux-tu essayer ceci :
- remettre guestAccess à false dans ntml-authentication-context.xml
- la propriété servers du ntlm-authentication-context.xml me semble incorrecte, il ne faut pas mettre qqch du genre DOMAINE\192.x.y.z, mais uniquement le nom du serveur AD (ex : ad1.chezmoi.com)
- définir allowGuestLogin à false dans le bean authenticationComponent du fichier authentication-services-context.xml
lekekoo
Member II

Re: Poblème connexion utilisateur avec Active Directory

Bon, j'ai corrigé une partie du problème. Cela vient du fait que les utilisateurs ont des mot de passe qui expirent… De part le principe même de NTLM, ce genre de problème est inévitable. Donc, j'ai refais une classe d'authentification LDAP qui connecte l'utilisateur à l'AD. Si il peut le faire, alors son compte existe et il est connecté à Alfresco. J'ai repris le bout de code pour le mapping entre les personnes importées et les compte AD qui se trouve dans la classe d'authenfication NTLM. Cela marche très bien. Je me suis du coup aussi aperçu que mon utilisateur "Guest" n'est pas membre du domaine. En effet, il ne peut pas s'authentifier dans l'AD directement. Je ne sais pas exactement pourquoi, mais cela doit être géré par les admins de l'AD. Donc, je crois avoir fais le tour du problème. Merci pour vos conseil, ils m'ont aidés à y voir plus clair.  Smiley Very Happy