Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-3696

Full LDAP does not respect "User Membership Attribute" during login

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 2.7.1
    • None
    • None

      Setting User Membership Attribute allows to gather membership and is respected during full sync.
      Unfortunately when user is logged in, his groups are cleared.
      Before login (after full sync):

      After login:

      My local ldap config (I've usted postalCode from my LDAP as a group marker):

        1. afterlogin.png
          afterlogin.png
          13 kB
        2. beforelogin.png
          beforelogin.png
          14 kB
        3. Cached-before-login groups-of-user.png
          Cached-before-login groups-of-user.png
          25 kB
        4. Cached-before-login users-of-group.png
          Cached-before-login users-of-group.png
          24 kB
        5. Directory config1.png
          Directory config1.png
          77 kB
        6. Directory config2.png
          Directory config2.png
          85 kB
        7. ldapconf.png
          ldapconf.png
          330 kB
        8. LDAP group.png
          LDAP group.png
          22 kB
        9. LDAP user.png
          LDAP user.png
          40 kB
        10. Uncached groups-of-user.png
          Uncached groups-of-user.png
          15 kB
        11. Uncached users-of-group.png
          Uncached users-of-group.png
          24 kB

            [CWD-3696] Full LDAP does not respect "User Membership Attribute" during login

            it.nat I suspect you are talking about in JIRA not in Crowd?

            This particular bug report pertains to the problem in Crowd ... the same bug is also reported against JIRA at JRA-36555
            JRA-36555 states that this bug is fixed in JIRA 6.2 ... if you are still seeing problems I suggest you raise a support request.

            Mark Lassau (Inactive) added a comment - it.nat I suspect you are talking about in JIRA not in Crowd? This particular bug report pertains to the problem in Crowd ... the same bug is also reported against JIRA at JRA-36555 JRA-36555 states that this bug is fixed in JIRA 6.2 ... if you are still seeing problems I suggest you raise a support request.

            AVCGA IT added a comment -

            Has this fix be lost again 6.2 ?

            AVCGA IT added a comment - Has this fix be lost again 6.2 ?

            I have updated Crowd in JIRA so this fix should be part of JIRA 6.1.6 release.

            Michal Orzechowski (Inactive) added a comment - I have updated Crowd in JIRA so this fix should be part of JIRA 6.1.6 release.

            AVCGA IT added a comment -

            awesome, thanks.

            AVCGA IT added a comment - awesome, thanks.

            Diego Berrueta added a comment - - edited

            it.nat,

            Apologies if I wasn't clear enough. By "the behaviour described in the previous comment is not a bug. It's the intended behaviour" I meant that Crowd is not trying to be smarter than the LDAP server, and it is not re-creating the bi-directional links if the LDAP server does not produce them. As far as I can tell, this has always been the behaviour of Crowd, and it hasn't changed recently.

            As onevalainen points out, in Crowd 2.7 we introduced an improvement to the authentication process (CWD-3429) which, when combined with the mentioned behaviour, creates a regression for some customers. We're currently working to fix this regression.

            I'll edit my previous comment to clarify this point.

            Diego Berrueta added a comment - - edited it.nat , Apologies if I wasn't clear enough. By "the behaviour described in the previous comment is not a bug. It's the intended behaviour" I meant that Crowd is not trying to be smarter than the LDAP server, and it is not re-creating the bi-directional links if the LDAP server does not produce them. As far as I can tell, this has always been the behaviour of Crowd, and it hasn't changed recently. As onevalainen points out, in Crowd 2.7 we introduced an improvement to the authentication process ( CWD-3429 ) which, when combined with the mentioned behaviour, creates a regression for some customers. We're currently working to fix this regression. I'll edit my previous comment to clarify this point.

            Hi it.nat

            Unfortunately Confluence is already affected (see CONF-31338). We do consider this a bug as it is a regression and will strive to fix it so that changes are not required in LDAP.

            Olli Nevalainen added a comment - Hi it.nat Unfortunately Confluence is already affected (see CONF-31338 ). We do consider this a bug as it is a regression and will strive to fix it so that changes are not required in LDAP.

            AVCGA IT added a comment -

            And does this also mean confluence will adopt this behaviour at some future release? We have 3000 users of confluence that use the same LDAP server for authentication and group based ACLs and its worked this way for several years, if confluence changes to use this latest version of CROWD then that will break confluence as well.

            AVCGA IT added a comment - And does this also mean confluence will adopt this behaviour at some future release? We have 3000 users of confluence that use the same LDAP server for authentication and group based ACLs and its worked this way for several years, if confluence changes to use this latest version of CROWD then that will break confluence as well.

            AVCGA IT added a comment -

            not all LDAP servers maintain those bi-directional links, if you are saying this is not a bug and to live with it then thats going to break an awful lot of stuff.

            AVCGA IT added a comment - not all LDAP servers maintain those bi-directional links, if you are saying this is not a bug and to live with it then thats going to break an awful lot of stuff.

            Diego Berrueta added a comment - - edited

            The behaviour described in the previous comment (namely, that Crowd does not re-create the bi-directional link if the LDAP server does not produce it) is not new. It has been the behaviour for years when these two conditions are met:

            • You're using a LDAP connector (other than AD) with the Use the user membership attribute option checked, and
            • Your LDAP server does publish the 'memberOf' attribute from the user side, but does not publish a symmetrical 'member' attribute from the group side.

            The Use the user membership attribute means: use the 'memberOf' attribute to list the users-of-a-group, but use the usual query (that is, the 'member' attribute of the group) when querying the list of groups-of-user. It's an optimisation for the case in which we know that both attributes are available in the LDAP server.

            LDAP servers can maintain these bi-directional links automatically if configured to. For instance, in OpenLDAP you can use overrides.

            If the LDAP server does not publish the bi-directional links (let's say it only publishes the 'memberOf' attribute from the user to the group, but not the 'member' from the group to the user), then enabling Use the user membership attribute will produce divergent results when querying groups-of-user and users-of-group, as the relationship will be only visible from one side.

            This was not affecting products other than Crowd (until they upgraded to Crowd 2.7), because products were using cached directories. Cached directories are not affected because:

            • When the cache is synchronised, the membership information is always retrieved in only one direction (using findDirectMembersOfGroup()). Therefore, there was no divergence.
            • Once cached, the membership information is symmetrical in the database, therefore all queries share the same view of the information.

            After upgrading to Crowd 2.7 and picking CWD-3429, all products suffer a regression because when the user authenticates, the products make a query to findGroupMembershipNames which (except for AD), delegates to findGroupMembershipNamesOfUserViaMemberDN. This method always uses the 'member'/'uniqueMember' attribute, never the 'memberOf' attribute (regardless of the Use the user membership attribute setting). Therefore, if the LDAP server is not publishing the 'member' attribute of the group (only the 'memberOf' attribute of the user), then the query will not retrieve the groups, causing them to be removed from the user in the cache and potentially preventing the user from logging in.

            Diego Berrueta added a comment - - edited The behaviour described in the previous comment (namely, that Crowd does not re-create the bi-directional link if the LDAP server does not produce it) is not new. It has been the behaviour for years when these two conditions are met: You're using a LDAP connector (other than AD) with the Use the user membership attribute option checked, and Your LDAP server does publish the 'memberOf' attribute from the user side, but does not publish a symmetrical 'member' attribute from the group side. The Use the user membership attribute means: use the 'memberOf' attribute to list the users-of-a-group, but use the usual query (that is, the 'member' attribute of the group) when querying the list of groups-of-user. It's an optimisation for the case in which we know that both attributes are available in the LDAP server. LDAP servers can maintain these bi-directional links automatically if configured to. For instance, in OpenLDAP you can use overrides . If the LDAP server does not publish the bi-directional links (let's say it only publishes the 'memberOf' attribute from the user to the group, but not the 'member' from the group to the user), then enabling Use the user membership attribute will produce divergent results when querying groups-of-user and users-of-group, as the relationship will be only visible from one side. This was not affecting products other than Crowd (until they upgraded to Crowd 2.7), because products were using cached directories. Cached directories are not affected because: When the cache is synchronised, the membership information is always retrieved in only one direction (using findDirectMembersOfGroup() ). Therefore, there was no divergence. Once cached, the membership information is symmetrical in the database, therefore all queries share the same view of the information. After upgrading to Crowd 2.7 and picking CWD-3429 , all products suffer a regression because when the user authenticates, the products make a query to findGroupMembershipNames which (except for AD), delegates to findGroupMembershipNamesOfUserViaMemberDN . This method always uses the 'member'/'uniqueMember' attribute, never the 'memberOf' attribute (regardless of the Use the user membership attribute setting). Therefore, if the LDAP server is not publishing the 'member' attribute of the group (only the 'memberOf' attribute of the user), then the query will not retrieve the groups, causing them to be removed from the user in the cache and potentially preventing the user from logging in.

            Investigation continues. If you set up an uncached directory with exactly the same configuration, then the relationship between the user and the group is visible when listing the users of the group, but not when listing the groups of the user. See attached screenshots.

            Note that listing the groups of the user is exactly the query that happens when the memberships are updated on authentication, so this is consistent with the observed effect.

            Tracing the execution shows that Crowd is using the following LDAP filter to retrieve the list of groups of the user: (&(objectclass=groupOfUniqueNames)(uniqueMember=cn=user,dc=example,dc=com)), which returns no results given the LDAP data described above (see screenshots). Compare that to the LDAP filter used when retrieving the list of users of a group: (&(objectclass=inetorgperson)(postalCode=cn=mygroup,dc=example,dc=com)) (which is correct).

            Diego Berrueta added a comment - Investigation continues. If you set up an uncached directory with exactly the same configuration, then the relationship between the user and the group is visible when listing the users of the group, but not when listing the groups of the user. See attached screenshots. Note that listing the groups of the user is exactly the query that happens when the memberships are updated on authentication, so this is consistent with the observed effect. Tracing the execution shows that Crowd is using the following LDAP filter to retrieve the list of groups of the user: (&(objectclass=groupOfUniqueNames)(uniqueMember=cn=user,dc=example,dc=com)) , which returns no results given the LDAP data described above (see screenshots). Compare that to the LDAP filter used when retrieving the list of users of a group: (&(objectclass=inetorgperson)(postalCode=cn=mygroup,dc=example,dc=com)) (which is correct).

              dberrueta Diego Berrueta
              mnowakowski Maciej Nowakowski (Inactive)
              Affected customers:
              1 This affects my team
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: