Skip to content

LDAP Mapping Collision of 1 user prevents all new LDAP users from being synced into ownCloud #751

@s3lph

Description

@s3lph

ownCloud appears to handle users that are renamed and/or moved to a different position in the LDAP tree quite well.

However, when a user (bob.example in the example below) is deleted and then re-created at a different position in the LDAP tree (leading to a "mapping collision" due to having a different LDAP entryUUID in addition to the changed DN), the LDAP sync starts showing some issues:

  • Already existing users (alice.example in the example below) are synced without any issues.
  • The sync fails for all new users (charlie.example in the example below) once even a single recreated user exists, and the new users do not show up in occ user:list.
  • Nevertheless, occ user:sync finishes without reporting any of these errors:
If unknown users are found, what do you want to do with their accounts? (removing the account will also remove its data)
  [0] disable
  [1] remove
  [2] ask later
 > 0
Analysing known accounts ...
 27340 [============================]

Disabling accounts:
[...]

Inserting new and updating all known users from OCA\User_LDAP\User_Proxy ...
 25660 [============================]
 
Sync of users finished, encountered 0 errors.
  • However, an error is reported in owncloud.log (see at the bottom)

Steps to reproduce

  1. Create 3 users in LDAP, in this example we're using
  • uid=alice.example,cn=users,ou=deptA,dc=example,dc=org
  • uid=bob.example,cn=users,ou=deptA,dc=example,dc=org
  • uid=charlie.example,cn=users,ou=deptA,dc=example,dc=org
  1. occ user:sync "OCA\User_LDAP\User_Proxy" -u alice.example
  2. occ user:sync "OCA\User_LDAP\User_Proxy" -u bob.example
  3. occ user:list .example
  1. Change Alice's displayName (to test wheter syncing of existing users still works)
  2. Delete the LDAP user uid=bob.example,cn=users,ou=deptA,dc=example,dc=org
  3. Create the LDAP user uid=bob.example,cn=users,ou=deptB,dc=example,dc=org (same name, different OU)
  4. occ user:sync "OCA\User_LDAP\User_Proxy"
  5. occ user:list .example

Expected behaviour

  - alice.example: Alice Changed (alice.example@example.org)
  - bob.example: Bob Example (bob.example@example.org)
  - charlie.example: Charlie Example (charlie.example@example.org)
  • The sync updates existing users (alice.example)
  • The sync adds new users (charlie.example)

Actual behaviour

  - alice.example: Alice Changed (alice.example@example.org)
  - bob.example: Bob Example (bob.example@example.org)
  • The sync updates existing users (alice.example)
  • The sync does not add new users (charlie.example)

Server configuration

Operating system: Debian 10

Web server: Apache2 2.4.38-3+deb10u7

Database: MariaDB (Galera cluster)

PHP version: 7.3.31-1~deb10u1

ownCloud version: ownCloud Enterprise 10.10.0.3 (clustered)

Updated from an older ownCloud or fresh install: first_install_version: 10.4.1.3

Signing status (ownCloud 9.0 and above):

Failed integrity check due to changes files provided by ownCloud, (see ownCloud Support Case #00018427). However, the same issue appears on our PROD environment (10.7.0.4, integrity check passes)

- core
	- INVALID_HASH
		- lib/private/Group/MetaData.php
		- settings/Controller/UsersController.php
		- settings/Panels/Personal/Profile.php
		- settings/js/users/users.js
		- settings/templates/panels/personal/profile.php
		- settings/templates/users/part.grouplist.php
- user_ldap
	- INVALID_HASH
		- appinfo/info.xml
		- js/wizard/wizardTabExpert.js
		- lib/Access.php
		- lib/Configuration.php
		- lib/Group_LDAP.php
		- lib/Group_Proxy.php
		- lib/User/IUserTools.php
		- templates/settings.php
	- EXTRA_FILE
		- appinfo/Migrations/Version20220725070804.php

The content of config/config.php:

{
    "system": {
        "instanceid": "ocdgh07npzvq",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "owncloud.example.org",
        ],
        "datadirectory": "\/mnt\/owncloud_filestore",
        "crashdirectory": "\/var\/log\/owncloud\/",
        "overwrite.cli.url": "https:\/\/owncloud.example.org",
        "htaccess.RewriteBase": "\/",
        "dbtype": "mysql",
        "version": "10.10.0.3",
        "dbname": "owncloud",
        "dbhost": "galera.example.org",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "apps_paths": [
            {
                "path": "\/var\/www\/owncloud\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/owncloud\/apps-external\/",
                "url": "\/apps-external",
                "writable": true
            }
        ],
        "installed": true,
        "maintenance": false,
        "ldapIgnoreNamingRules": false,
        "accounts.enable_medial_search": false,
        "user.search_min_length": 3,
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "mail_smtpsecure": "tls",
        "log_type": "owncloud",
        "logfile": "\/var\/log\/owncloud\/owncloud.log",
        "loglevel": 2,
        "cron_log": true,
        "operation.mode": "clustered-instance",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "redis": {
            "host": "redis.example.org",
            "port": 6379,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "http.cookie.samesite": "None",
        "openid-connect": {
            "provider-url": "https:\/\/keycloak.example.org\/auth\/realms\/example\/",
            "client-id": "owncloud.example.org",
            "client-secret": "***REMOVED SENSITIVE VALUE***",
            "mode": "userid",
            "search-attribute": "preferred_username",
            "loginButtonName": "OIDC",
            "autoRedirectOnLoginPage": true,
            "redirect-url": "https:\/\/owncloud.example.org\/index.php\/apps\/openidconnect\/redirect",
            "post_logout_redirect_uri": "https:\/\/owncloud.example.org\/",
            "scopes": [
                "openid",
                "profile"
            ]
        },
        "firewall.debug": 2,
        "firewall.rules": "[]"
    }
}

List of activated apps:

  - activity:
    - Version: 2.7.0
    - Path: /var/www/owncloud/apps/activity
  - admin_audit:
    - Version: 2.1.3
    - Path: /var/www/owncloud/apps/admin_audit
  - comments:
    - Version: 0.3.0
    - Path: /var/www/owncloud/apps/comments
  - configreport:
    - Version: 0.2.1
    - Path: /var/www/owncloud/apps/configreport
  - customgroups:
    - Version: 0.6.2
    - Path: /var/www/owncloud/apps/customgroups
  - dav:
    - Version: 0.7.0
    - Path: /var/www/owncloud/apps/dav
  - federatedfilesharing:
    - Version: 0.5.0
    - Path: /var/www/owncloud/apps/federatedfilesharing
  - federation:
    - Version: 0.1.0
    - Path: /var/www/owncloud/apps/federation
  - files:
    - Version: 1.5.2
    - Path: /var/www/owncloud/apps/files
  - files_external:
    - Version: 0.9.0
    - Path: /var/www/owncloud/apps/files_external
  - files_lifecycle:
    - Version: 1.3.2
    - Path: /var/www/owncloud/apps/files_lifecycle
  - files_mediaviewer:
    - Version: 1.0.5
    - Path: /var/www/owncloud/apps/files_mediaviewer
  - files_sharing:
    - Version: 0.14.0
    - Path: /var/www/owncloud/apps/files_sharing
  - files_trashbin:
    - Version: 0.9.1
    - Path: /var/www/owncloud/apps/files_trashbin
  - files_versions:
    - Version: 1.3.0
    - Path: /var/www/owncloud/apps/files_versions
  - firewall:
    - Version: 2.10.3
    - Path: /var/www/owncloud/apps/firewall
  - firstrunwizard:
    - Version: 1.2.0
    - Path: /var/www/owncloud/apps/firstrunwizard
  - impersonate:
    - Version: 0.5.0
    - Path: /var/www/owncloud/apps-external/impersonate
  - market:
    - Version: 0.6.3
    - Path: /var/www/owncloud/apps/market
  - msteamsbridge:
    - Version: 1.0.0
    - Path: /var/www/owncloud/apps-external/msteamsbridge
  - notifications:
    - Version: 0.5.4
    - Path: /var/www/owncloud/apps/notifications
  - openidconnect:
    - Version: 2.1.1
    - Path: /var/www/owncloud/apps/openidconnect
  - provisioning_api:
    - Version: 0.5.0
    - Path: /var/www/owncloud/apps/provisioning_api
  - ransomware_protection:
    - Version: 1.4.0
    - Path: /var/www/owncloud/apps/ransomware_protection
  - richdocuments:
    - Version: 2.5.0
    - Path: /var/www/owncloud/apps-external/richdocuments
  - systemtags:
    - Version: 0.3.0
    - Path: /var/www/owncloud/apps/systemtags
  - user_ldap:
    - Version: 0.17.0
    - Path: /var/www/owncloud/apps/user_ldap

LDAP configuration (delete this part if not used)

+-------------------------------+----------------------------------------------------------------------+
| Configuration                 | s01                                                                  |
+-------------------------------+----------------------------------------------------------------------+
| hasMemberOfFilterSupport      | 1                                                                    |
| hasPagedResultSupport         |                                                                      |
| homeFolderNamingRule          | attr:uid                                                             |
| lastJpegPhotoLookup           | 0                                                                    |
| ldapAgentName                 | uid=owncloud.ldap,cn=users,dc=example,dc=ch                          |
| ldapAgentPassword             | ***                                                                  |
| ldapAttributesForGroupSearch  |                                                                      |
| ldapAttributesForUserSearch   | uid                                                                  |
| ldapBackupHost                |                                                                      |
| ldapBackupPort                |                                                                      |
| ldapBase                      | dc=example,dc=org                                                    |
| ldapBaseGroups                | dc=example,dc=org                                                    |
| ldapBaseUsers                 | dc=example,dc=org                                                    |
| ldapCacheTTL                  | 6000                                                                 |
| ldapConfigurationActive       | 1                                                                    |
| ldapDynamicGroupMemberURL     |                                                                      |
| ldapEmailAttribute            | mailPrimaryAddress                                                   |
| ldapExperiencedAdmin          | 1                                                                    |
| ldapExpertGroupnameAttr       | cn                                                                   |
| ldapExpertUUIDGroupAttr       | redacted                                                             |
| ldapExpertUUIDUserAttr        | entryuuid                                                            |
| ldapExpertUsernameAttr        | uid                                                                  |
| ldapGroupDisplayName          | cn                                                                   |
| ldapGroupFilter               | (& (univentionRedactedOwnCloudGroup=1)(objectClass=univentionGroup)) |
| ldapGroupFilterGroups         |                                                                      |
| ldapGroupFilterMode           | 0                                                                    |
| ldapGroupFilterObjectclass    |                                                                      |
| ldapGroupMemberAlgo           | groupScan                                                            |
| ldapGroupMemberAssocAttr      | uniqueMember                                                         |
| ldapHost                      | ldaps://ucs.example.org                                              |
| ldapIgnoreNamingRules         |                                                                      |
| ldapLoginFilter               | (& (!(shadowExpire=1)) (univentionRedactededactedOwnCloud=1) (uid=%uid) )   |
| ldapLoginFilterAttributes     |                                                                      |
| ldapLoginFilterEmail          | 0                                                                    |
| ldapLoginFilterMode           | 1                                                                    |
| ldapLoginFilterUsername       | 1                                                                    |
| ldapNestedGroups              | 1                                                                    |
| ldapNetworkTimeout            | 60                                                                   |
| ldapOverrideMainServer        |                                                                      |
| ldapPagingSize                | 500                                                                  |
| ldapPort                      | 636                                                                  |
| ldapQuotaAttribute            | univentionRedactedOwnCloudQuota                                      |
| ldapQuotaDefault              |                                                                      |
| ldapTLS                       |                                                                      |
| ldapUserDisplayName           | displayname                                                          |
| ldapUserDisplayName2          | mailprimaryaddress                                                   |
| ldapUserFilter                | (& (!(shadowExpire=1)) (univentionRedactedOwnCloud=1))               |
| ldapUserFilterGroups          |                                                                      |
| ldapUserFilterMode            | 1                                                                    |
| ldapUserFilterObjectclass     |                                                                      |
| ldapUserName                  | uid                                                                  |
| ldapUuidGroupAttribute        | auto                                                                 |
| ldapUuidUserAttribute         | auto                                                                 |
| turnOffCertCheck              | 0                                                                    |
| useMemberOfToDetectMembership | 1                                                                    |
+-------------------------------+----------------------------------------------------------------------+

Logs

ownCloud log (data/owncloud.log)

{"reqId":"Aa9WhhKKCClU1JuosRBg","level":3,"time":"2022-08-16T14:38:17+00:00","remoteAddr":"","user":"--","app":"OCA\\User_LDAP\\User\\Manager","method":"--","url":"--","message":"Exception: {\"Exception\":\"OutOfBoundsException\",\"Message\":\"Mapping collision for DN uid=bob.example,cn=users,ou=deptB,dc=example,dc=org and UUID b59b74e4-b1bc-103c-91c2-5bdeec75c58c. Couldnt map to: bob.example\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/user_ldap\\\/lib\\\/User\\\/Manager.php(238): OCA\\\\User_LDAP\\\\User\\\\Manager->resolveUID(Object(OCA\\\\User_LDAP\\\\User\\\\UserEntry))\\n#1 \\\/var\\\/www\\\/owncloud\\\/apps\\\/user_ldap\\\/lib\\\/User\\\/Manager.php(525): OCA\\\\User_LDAP\\\\User\\\\Manager->getFromEntry(Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/apps\\\/user_ldap\\\/lib\\\/User_LDAP.php(178): OCA\\\\User_LDAP\\\\User\\\\Manager->getUsers('bob.example', 500, 0)\\n#3 \\\/var\\\/www\\\/owncloud\\\/apps\\\/user_ldap\\\/lib\\\/User_Proxy.php(170): OCA\\\\User_LDAP\\\\User_LDAP->getUsers('bob.example2', 500, 0)\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/User\\\/Sync\\\/BackendUsersIterator.php(54): OCA\\\\User_LDAP\\\\User_Proxy->getUsers('bob.example', 500, 0)\\n#5 \\\/var\\\/www\\\/owncloud\\\/core\\\/Command\\\/User\\\/SyncBackend.php(285): OC\\\\User\\\\Sync\\\\BackendUsersIterator->rewind()\\n#6 \\\/var\\\/www\\\/owncloud\\\/core\\\/Command\\\/User\\\/SyncBackend.php(174): OC\\\\Core\\\\Command\\\\User\\\\SyncBackend->syncSingleUser(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput), Object(OC\\\\User\\\\SyncService), Object(OCA\\\\User_LDAP\\\\User_Proxy), 'bob.example', 'disable')\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Command\\\/Command.php(255): OC\\\\Core\\\\Command\\\\User\\\\SyncBackend->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(1009): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(273): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OC\\\\Core\\\\Command\\\\User\\\\SyncBackend), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(149): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Console\\\/Application.php(165): Symfony\\\\Component\\\\Console\\\\Application->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#12 \\\/var\\\/www\\\/owncloud\\\/console.php(116): OC\\\\Console\\\\Application->run()\\n#13 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#14 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/user_ldap\\\/lib\\\/User\\\/Manager.php\",\"Line\":373}"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions