Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: v28 - Receiving erroneous emails about removal from LDAP groups #42195

Open
5 of 8 tasks
Caligatio opened this issue Dec 13, 2023 · 35 comments · May be fixed by #47513
Open
5 of 8 tasks

[Bug]: v28 - Receiving erroneous emails about removal from LDAP groups #42195

Caligatio opened this issue Dec 13, 2023 · 35 comments · May be fixed by #47513
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 28-feedback bug feature: emails feature: ldap needs review Needs review to determine if still applicable

Comments

@Caligatio
Copy link

⚠️ This issue respects the following points: ⚠️

Bug description

Since upgrading to v28 yesterday, my users have been receiving emails at seemingly random intervals saying that "An administrator removed you from group ". The groups in question are LDAP based groups, absolutely no edits have been performed, and the users are actually still members of the group when viewed in the Nextcloud interface. This setup has been stable for months and I haven't received these sorts of messages previously.

Steps to reproduce

Unknown at this time other than to be using LDAP and upgrading to v28.

Expected behavior

Not to receive emails about being removed from a group.

Installation method

Community Manual installation with Archive

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "nextcloud.REDACTED_INTERNAL_DOMAIN",
            "nextcloud.REDACTED_EXTERNAL_DOMAIN"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "28.0.0.11",
        "overwrite.cli.url": "https:\/\/nextcloud.REDACTED_EXTERNAL_DOMAIN",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "mail_smtpmode": "smtp",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "mail_smtpport": "465",
        "mail_sendmailmode": "smtp",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 3,
        "defaultapp": "files",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0
        },
        "default_phone_region": "US",
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "account_manager.default_property_scope": {
            "displayname": "v2-local",
            "email": "v2-local",
            "avatar": "v2-local",
            "address": "v2-private",
            "website": "v2-private",
            "phone": "v2-private",
            "twitter": "v2-private",
            "fediverse": "v2-private",
            "organisation": "v2-private",
            "role": "v2-private",
            "headline": "v2-private",
            "biography": "v2-private",
            "profile_enabled": "v2-private"
        },
        "maintenance": false,
        "theme": "",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Enabled:
  - activity: 2.20.0
  - bruteforcesettings: 2.8.0
  - circles: 28.0.0-dev
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contactsinteraction: 1.9.0
  - dav: 1.29.1
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_external: 1.20.0
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - firstrunwizard: 2.17.0
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - nextcloud_announcements: 1.17.0
  - notifications: 2.16.0
  - oauth2: 1.16.3
  - password_policy: 1.18.0
  - photos: 2.4.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.0
  - sharebymail: 1.18.0
  - support: 1.11.0
  - survey_client: 1.16.0
  - systemtags: 1.18.0
  - text: 3.9.1
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - twofactor_totp: 10.0.0-beta.2
  - twofactor_webauthn: 1.3.2
  - updatenotification: 1.18.0
  - user_ldap: 1.19.0
  - viewer: 2.2.0
  - workflowengine: 2.10.0
Disabled:
  - admin_audit: 1.18.0
  - dashboard: 7.8.0 (installed 7.6.0)
  - encryption: 2.16.0
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - files_versions: 1.21.0 (installed 1.19.1)
  - suspicious_login: 6.0.0
  - user_status: 1.8.1 (installed 1.4.0)
  - weather_status: 1.8.0 (installed 1.7.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

Note that I've remove the all the cron-related entries:

{"reqId":"Uo5k3mnjCCWK63cZzfKi","level":3,"time":"2023-12-12T14:21:54+00:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Error while running background job (class: OC\\Core\\BackgroundJobs\\GenerateMetadataJob, arguments: )","userAgent":"--","version":"28.0.0.11","exception":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\PDOException","Message":"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away","Code":"HY000","Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":128,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\PDOException","type":"::"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1464,"function":"commit","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1422,"function":"doCommit","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php","line":154,"function":"commit","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/FilesMetadata/Service/IndexRequestService.php","line":87,"function":"commit","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php","line":199,"function":"updateIndex","class":"OC\\FilesMetadata\\Service\\IndexRequestService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php","line":116,"function":"saveMetadata","class":"OC\\FilesMetadata\\FilesMetadataManager","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":107,"function":"refreshMetadata","class":"OC\\FilesMetadata\\FilesMetadataManager","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":101,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":101,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":101,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":90,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":81,"function":"scanFilesForUser","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/PDOException.php","Line":20,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away","Code":"HY000","Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":126,"function":"commit","class":"PDO","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1464,"function":"commit","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1422,"function":"doCommit","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php","line":154,"function":"commit","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/FilesMetadata/Service/IndexRequestService.php","line":87,"function":"commit","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php","line":199,"function":"updateIndex","class":"OC\\FilesMetadata\\Service\\IndexRequestService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php","line":116,"function":"saveMetadata","class":"OC\\FilesMetadata\\FilesMetadataManager","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":107,"function":"refreshMetadata","class":"OC\\FilesMetadata\\FilesMetadataManager","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":101,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":101,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":101,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":90,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":81,"function":"scanFilesForUser","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","Line":126},"message":"Error while running background job (class: OC\\Core\\BackgroundJobs\\GenerateMetadataJob, arguments: )","exception":{"errorInfo":["HY000",2006,"MySQL server has gone away"]},"CustomMessage":"Error while running background job (class: OC\\Core\\BackgroundJobs\\GenerateMetadataJob, arguments: )"}}
{}"reqId":"Uo5k3mnjCCWK63cZzfKi","level":3,"time":"2023-12-12T14:21:54+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Exception thrown: OC\\DB\\Exceptions\\DbalException","userAgent":"--","version":"28.0.0.11","exception":{"Exception":"OC\\DB\\Exceptions\\DbalException","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away","Code":2006,"Trace":[{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":328,"function":"wrap","class":"OC\\DB\\Exceptions\\DbalException","type":"::"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":367,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":355,"function":"unlockJob","class":"OC\\BackgroundJob\\JobList","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":158,"function":"setLastJob","class":"OC\\BackgroundJob\\JobList","type":"->"}],"File":"/var/www/nextcloud/lib/private/DB/Exceptions/DbalException.php","Line":71,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\ConnectionLost","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away","Code":2006,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1938,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1880,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1208,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":294,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":386,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":326,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":367,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":355,"function":"unlockJob","class":"OC\\BackgroundJob\\JobList","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":158,"function":"setLastJob","class":"OC\\BackgroundJob\\JobList","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":104,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away","Code":2006,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":132,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1202,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":294,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":386,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":326,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":367,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":355,"function":"unlockJob","class":"OC\\BackgroundJob\\JobList","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":158,"function":"setLastJob","class":"OC\\BackgroundJob\\JobList","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":28,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away","Code":"HY000","Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":130,"function":"execute","class":"PDOStatement","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1202,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":294,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":386,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":326,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":367,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":355,"function":"unlockJob","class":"OC\\BackgroundJob\\JobList","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":158,"function":"setLastJob","class":"OC\\BackgroundJob\\JobList","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":130}}},"CustomMessage":"Exception thrown: OC\\DB\\Exceptions\\DbalException"}}

Additional info

The frequency of the activity emails is every 65 minutes or not at all. For instance, I got them at 2000, 2105, 2210, and 2315 but then nothing for the next ~9 hours until now.

@Caligatio Caligatio added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Dec 13, 2023
@joshtrichards
Copy link
Member

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Have you looked into why your database server is going offline?

@Caligatio
Copy link
Author

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Have you looked into why your database server is going offline?

This also super confuses me as it's a service running on the same VM. Much like the LDAP issue, this is a first time problem since upgrading to v28.

@joshtrichards
Copy link
Member

For the group/ldap matter specifically:

  • there may be some additional log entries that start with service upgradeGroups" [...]
  • you probably won't see many log entries though since your loglevel is set to 3; most of the ldap updateGroups messages are logged at debug or info level. Try temporarily running at loglevel 1 and carefully monitoring for group related log entries. Those may provide some clues.

This also super confuses me as it's a service running on the same VM. Much like the LDAP issue, this is a first time problem since upgrading to v28.

Hmm. Those db connection errors are generated by the db stack - we don't even directly generate them. Anything interesting in your db server logs or server journalctl logs?

I understand the timing; that's weird. But generally that sort of thing is a local environment issue. 🤔

@Caligatio
Copy link
Author

OK, on the DB front: I rebooted the machine within +/- 1 minute of that log so that almost definitively answers that one.

I cranked up the logging for the LDAP issue... now I just need to wait <= 65 minutes.

@Caligatio
Copy link
Author

I've disabled my email as it was spamming affected users but there's now this:

{"reqId":"gPPNS8KsyGEG5Qx8txSN","level":3,"time":"2023-12-13T05:39:21+00:00","remoteAddr":"LOCAL_IPV6","user":"brian","app":"jsresourceloader","method":"GET","url":"/settings/user/externalstorages","message":"Could not find resource files_external/js/oauth1.js to load","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0","version":"28.0.0.11","data":{"app":"jsresourceloader"}}
{"reqId":"gPPNS8KsyGEG5Qx8txSN","level":3,"time":"2023-12-13T05:39:21+00:00","remoteAddr":"LOCAL_IPV6","user":"brian","app":"jsresourceloader","method":"GET","url":"/settings/user/externalstorages","message":"Could not find resource files_external/js/oauth2.js to load","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0","version":"28.0.0.11","data":{"app":"jsresourceloader"}}
{"reqId":"gPPNS8KsyGEG5Qx8txSN","level":3,"time":"2023-12-13T05:39:21+00:00","remoteAddr":"LOCAL_IPV6","user":"brian","app":"jsresourceloader","method":"GET","url":"/settings/user/externalstorages","message":"Could not find resource files_external/js/public_key.js to load","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0","version":"28.0.0.11","data":{"app":"jsresourceloader"}}
{"reqId":"XXctal5EXT13jTV5MDEb","level":1,"time":"2023-12-13T17:25:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"REDACTED_GROUP1\" found.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"XXctal5EXT13jTV5MDEb","level":1,"time":"2023-12-13T17:25:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"REDACTED_GROUP2\" found.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"XXctal5EXT13jTV5MDEb","level":1,"time":"2023-12-13T17:25:06+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 groups [] were removed.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}

I only have two groups so this is the whole list. It looks like I'm also suffering from #42158

@Caligatio
Copy link
Author

Caligatio commented Dec 14, 2023

More logs but still nothing clear why this is happening:

{"reqId":"0X70kdbe8W9R5u3WmT5t","level":1,"time":"2023-12-13T22:07:28+00:00","remoteAddr":"REDACTED_IPV6","user":"REDACTED_USERNAME","app":"user_ldap","method":"PROPFIND","url":"/remote.php/dav/files/REDACTED_USERNAME/","message":"OCA\\User_LDAP\\LoginListener \u2013 REDACTED_USERNAME postLogin","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.26.0","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"0X70kdbe8W9R5u3WmT5t","level":1,"time":"2023-12-13T22:07:29+00:00","remoteAddr":"REDACTED_IPV6","user":"REDACTED_USERNAME","app":"user_ldap","method":"PROPFIND","url":"/remote.php/dav/files/REDACTED_USERNAME/","message":"OCA\\User_LDAP\\LoginListener \u2013 REDACTED_USERNAME added to REDACTED_LDAP_GROUP2","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.26.0","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"XWcIPktbaUICJ1uo6UOi","level":1,"time":"2023-12-13T22:50:03+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 REDACTED_USERNAME removed from REDACTED_LDAP_GROUP2","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"XWcIPktbaUICJ1uo6UOi","level":1,"time":"2023-12-13T22:50:03+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"REDACTED_LDAP_GROUP1\" found.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"XWcIPktbaUICJ1uo6UOi","level":1,"time":"2023-12-13T22:50:03+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 groups [] were removed.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"sQAWVvmPOYyDw627uXpR","level":1,"time":"2023-12-13T23:26:12+00:00","remoteAddr":"REDACTED_IPV6","user":"REDACTED_USERNAME","app":"user_ldap","method":"HEAD","url":"/remote.php/dav/files/REDACTED_USERNAME/Upload/Jillian/2023/07/PXL_20230720_162454657.jpg","message":"OCA\\User_LDAP\\LoginListener \u2013 REDACTED_USERNAME postLogin","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.26.0","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"sQAWVvmPOYyDw627uXpR","level":1,"time":"2023-12-13T23:26:12+00:00","remoteAddr":"REDACTED_IPV6","user":"REDACTED_USERNAME","app":"user_ldap","method":"HEAD","url":"/remote.php/dav/files/REDACTED_USERNAME/Upload/Jillian/2023/07/PXL_20230720_162454657.jpg","message":"OCA\\User_LDAP\\LoginListener \u2013 REDACTED_USERNAME added to REDACTED_LDAP_GROUP2","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.26.0","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"rAzh78MsN7wpO8fYB1Un","level":1,"time":"2023-12-13T23:55:03+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 REDACTED_USERNAME removed from REDACTED_LDAP_GROUP2","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"rAzh78MsN7wpO8fYB1Un","level":1,"time":"2023-12-13T23:55:03+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"REDACTED_LDAP_GROUP1\" found.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"rAzh78MsN7wpO8fYB1Un","level":1,"time":"2023-12-13T23:55:03+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 groups [] were removed.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"28H4IisiOn2S28mzcYxC","level":1,"time":"2023-12-14T01:00:03+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"REDACTED_LDAP_GROUP2\" found.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"28H4IisiOn2S28mzcYxC","level":1,"time":"2023-12-14T01:00:03+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"REDACTED_LDAP_GROUP1\" found.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}
{"reqId":"28H4IisiOn2S28mzcYxC","level":1,"time":"2023-12-14T01:00:03+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 groups [] were removed.","userAgent":"--","version":"28.0.0.11","data":{"app":"user_ldap"}}

@systemofapwne
Copy link

I have exactly the same problem.
Updated my NC instance on Wednesday. Since then, I get these messages. I first suspected an intrusion, which I could exclude by removing remote access to NC. Yet, I got the mails.
Right now, I disabled email notification for group changes to mitigate mail spam.

@Caligatio
Copy link
Author

Caligatio commented Dec 15, 2023

@systemofapwne Where did you find that notification setting? I ended up just invalidating my SMTP config

EDIT: Turns out I'm also bit by nextcloud/logreader/issues/1073, found the setting!

@systemofapwne
Copy link

@systemofapwne Where did you find that notification setting? I ended up just invalidating my SMTP config

EDIT: Turns out I'm also bit by nextcloud/logreader/issues/1073, found the setting!

Here you go:

image

@systemofapwne
Copy link

systemofapwne commented Dec 15, 2023

Yet, I emphasize, this is just a workaround for the bug (that has no other impact but the email spam). It might be related to the LDAP plugin, but I'm not 100% sure, since it just happened after the recent NC update.

@Caligatio
Copy link
Author

@joshtrichards Anything else I can do to help troubleshoot this? I happen to check the activity feed in my Nextcloud Windows client and I'm getting dozens of these events each day.

@Lukas-dev-threads
Copy link

Lukas-dev-threads commented Jan 8, 2024

The same thing is happening to me since I upgraded from 27 to 28 this morning !

I am using LDAP, MariaDB and encryption.

@fiftyheight
Copy link

Same here, my users are spammed by multiple emails about their removal from a ldap group, immediatly after updating my nextcloud instance from 27 to 28.
If I check users, the raw list show users in right groups. If I check ldap groups, they appears almost empty.

Openldap as users/groups backend.

@loxK
Copy link

loxK commented Jan 15, 2024

Same issue upgrading to 28.0.1. I have errors like these in logs that may be related :

Duplicate entry '[redacted group]-[redaxcted username' for key 'user_ldap_membership_unique'

Error   no app in context   OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[23000]: Integrity                       2024-01-15T18:26:47+11:00  
                              constraint violation: 1062 Duplicate entry '[redacted group]-[redacted username]' for key 'user_ldap_membership_unique' at                                             
                              lib/private/DB/Exceptions/DbalException.php line 71                                                                                                        
                                                                                                                                                                                         
                               0. lib/private/DB/QueryBuilder/QueryBuilder.php line 328                                                                                                  
                                  OC\DB\Exceptions\DbalException::wrap(                                                                                                                  
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               1. lib/public/AppFramework/Db/QBMapper.php line 137                                                                                                       
                                  OC\DB\QueryBuilder\QueryBuilder->executeStatement(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               2. apps/user_ldap/lib/LoginListener.php line 95                                                                                                           
                                  OCP\AppFramework\Db\QBMapper->insert(                                                                                                                  
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               3. apps/user_ldap/lib/LoginListener.php line 67                                                                                                           
                                  OCA\User_LDAP\LoginListener->updateGroups("*** sensitive parameters replaced ***")                                                                     
                               4. apps/user_ldap/lib/LoginListener.php line 55                                                                                                           
                                  OCA\User_LDAP\LoginListener->onPostLogin(                                                                                                              
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               5. lib/private/EventDispatcher/ServiceEventListener.php line 86                                                                                           
                                  OCA\User_LDAP\LoginListener->handle(                                                                                                                   
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               6. .../symfony/event-dispatcher/EventDispatcher.php line 230                                                                                              
                                  OC\EventDispatcher\ServiceEventListener->__invoke(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               7. .../EventDispatcher.php line 59                                                                                                                        
                                  Symfony\Component\EventDispatcher\EventDispatcher->callListeners(                                                                                      
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               8. .../EventDispatcher/EventDispatcher.php line 94                                                                                                        
                                  Symfony\Component\EventDispatcher\EventDispatcher->dispatch(                                                                                           
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               9. lib/private/EventDispatcher/EventDispatcher.php line 106                                                                                               
                                  OC\EventDispatcher\EventDispatcher->dispatch(                                                                                                          
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              10. lib/private/User/Session.php line 392                                                                                                                  
                                  OC\EventDispatcher\EventDispatcher->dispatchTyped(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              11. lib/private/User/Session.php line 657                                                                                                                  
                                  OC\User\Session->completeLogin("*** sensitive parameters replaced ***")                                                                                
                              12. lib/private/User/Session.php line 354                                                                                                                  
                                  OC\User\Session->loginWithToken("*** sensitive parameters replaced ***")                                                                               
                              13. lib/private/User/Session.php line 453                                                                                                                  
                                  OC\User\Session->login("*** sensitive parameters replaced ***")                                                                                        
                              14. lib/private/User/Session.php line 582                                                                                                                  
                                  OC\User\Session->logClientIn("*** sensitive parameters replaced ***")                                                                                  
                              15. lib/base.php line 1154                                                                                                                                 
                                  OC\User\Session->tryBasicAuthLogin(                                                                                                                    
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              16. ocs/v1.php line 62                                                                                                                                     
                                  OC::handleLogin(                                                                                                                                       
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              17. ocs/v2.php line 23                                                                                                                                     
                                  require_once("\/var\/www\/nextcloud\/ocs\/v1.php")                                                                                                     
                                                                                                                                                                                         
                              Caused by Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing a query:                                       
                              SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '[redacted group]-[redacted username]' for key                                                   
                              'user_ldap_membership_unique' at .../dbal/src/Driver/API/MySQL/ExceptionConverter.php line 62                                                              
                                                                                                                                                                                         
                               0. .../doctrine/dbal/src/Connection.php line 1938                                                                                                         
                                  Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert(                                                                                            
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               1. 3rdparty/doctrine/dbal/src/Connection.php line 1880                                                                                                    
                                  Doctrine\DBAL\Connection->handleDriverException(                                                                                                       
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               2. 3rdparty/doctrine/dbal/src/Connection.php line 1208                                                                                                    
                                  Doctrine\DBAL\Connection->convertExceptionDuringQuery(                                                                                                 
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               3. lib/private/DB/Connection.php line 294                                                                                                                 
                                  Doctrine\DBAL\Connection->executeStatement(                                                                                                            
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               4. 3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 386                                                                                             
                                  OC\DB\Connection->executeStatement(                                                                                                                    
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               5. lib/private/DB/QueryBuilder/QueryBuilder.php line 280                                                                                                  
                                  Doctrine\DBAL\Query\QueryBuilder->execute(                                                                                                             
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               6. lib/private/DB/QueryBuilder/QueryBuilder.php line 326                                                                                                  
                                  OC\DB\QueryBuilder\QueryBuilder->execute(                                                                                                              
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               7. lib/public/AppFramework/Db/QBMapper.php line 137                                                                                                       
                                  OC\DB\QueryBuilder\QueryBuilder->executeStatement(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               8. apps/user_ldap/lib/LoginListener.php line 95                                                                                                           
                                  OCP\AppFramework\Db\QBMapper->insert(                                                                                                                  
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               9. apps/user_ldap/lib/LoginListener.php line 67                                                                                                           
                                  OCA\User_LDAP\LoginListener->updateGroups("*** sensitive parameters replaced ***")                                                                     
                              10. apps/user_ldap/lib/LoginListener.php line 55                                                                                                           
                                  OCA\User_LDAP\LoginListener->onPostLogin(                                                                                                              
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              11. lib/private/EventDispatcher/ServiceEventListener.php line 86                                                                                           
                                  OCA\User_LDAP\LoginListener->handle(                                                                                                                   
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              12. .../symfony/event-dispatcher/EventDispatcher.php line 230                                                                                              
                                  OC\EventDispatcher\ServiceEventListener->__invoke(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              13. .../EventDispatcher.php line 59                                                                                                                        
                                  Symfony\Component\EventDispatcher\EventDispatcher->callListeners(                                                                                      
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              14. .../EventDispatcher/EventDispatcher.php line 94                                                                                                        
                                  Symfony\Component\EventDispatcher\EventDispatcher->dispatch(                                                                                           
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              15. lib/private/EventDispatcher/EventDispatcher.php line 106                                                                                               
                                  OC\EventDispatcher\EventDispatcher->dispatch(                                                                                                          
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              16. lib/private/User/Session.php line 392                                                                                                                  
                                  OC\EventDispatcher\EventDispatcher->dispatchTyped(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              17. lib/private/User/Session.php line 657                                                                                                                  
                                  OC\User\Session->completeLogin("*** sensitive parameters replaced ***")                                                                                
                              18. lib/private/User/Session.php line 354                                                                                                                  
                                  OC\User\Session->loginWithToken("*** sensitive parameters replaced ***")                                                                               
                              19. lib/private/User/Session.php line 453                                                                                                                  
                                  OC\User\Session->login("*** sensitive parameters replaced ***")                                                                                        
                              20. lib/private/User/Session.php line 582                                                                                                                  
                                  OC\User\Session->logClientIn("*** sensitive parameters replaced ***")                                                                                  
                              21. lib/base.php line 1154                                                                                                                                 
                                  OC\User\Session->tryBasicAuthLogin(                                                                                                                    
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              22. ocs/v1.php line 62                                                                                                                                     
                                  OC::handleLogin(                                                                                                                                       
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              23. ocs/v2.php line 23                                                                                                                                     
                                  require_once("\/var\/www\/nextcloud\/ocs\/v1.php")                                                                                                     
                                                                                                                                                                                         
                              Caused by Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry                                        
                              '[redacted group]-[redacted username]' for key 'user_ldap_membership_unique' at                                                                                        
                              3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php line 28                                                                                                
                                                                                                                                                                                         
                               0. 3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php line 132                                                                                           
                                  Doctrine\DBAL\Driver\PDO\Exception::new(                                                                                                               
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               1. 3rdparty/doctrine/dbal/src/Connection.php line 1202                                                                                                    
                                  Doctrine\DBAL\Driver\PDO\Statement->execute(                                                                                                           
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               2. lib/private/DB/Connection.php line 294                                                                                                                 
                                  Doctrine\DBAL\Connection->executeStatement(                                                                                                            
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               3. 3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 386                                                                                             
                                  OC\DB\Connection->executeStatement(                                                                                                                    
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               4. lib/private/DB/QueryBuilder/QueryBuilder.php line 280                                                                                                  
                                  Doctrine\DBAL\Query\QueryBuilder->execute(                                                                                                             
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               5. lib/private/DB/QueryBuilder/QueryBuilder.php line 326                                                                                                  
                                  OC\DB\QueryBuilder\QueryBuilder->execute(                                                                                                              
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               6. lib/public/AppFramework/Db/QBMapper.php line 137                                                                                                       
                                  OC\DB\QueryBuilder\QueryBuilder->executeStatement(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               7. apps/user_ldap/lib/LoginListener.php line 95                                                                                                           
                                  OCP\AppFramework\Db\QBMapper->insert(                                                                                                                  
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               8. apps/user_ldap/lib/LoginListener.php line 67                                                                                                           
                                  OCA\User_LDAP\LoginListener->updateGroups("*** sensitive parameters replaced ***")                                                                     
                               9. apps/user_ldap/lib/LoginListener.php line 55                                                                                                           
                                  OCA\User_LDAP\LoginListener->onPostLogin(                                                                                                              
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              10. lib/private/EventDispatcher/ServiceEventListener.php line 86                                                                                           
                                  OCA\User_LDAP\LoginListener->handle(                                                                                                                   
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              11. .../symfony/event-dispatcher/EventDispatcher.php line 230                                                                                              
                                  OC\EventDispatcher\ServiceEventListener->__invoke(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              12. .../EventDispatcher.php line 59                                                                                                                        
                                  Symfony\Component\EventDispatcher\EventDispatcher->callListeners(                                                                                      
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              13. .../EventDispatcher/EventDispatcher.php line 94                                                                                                        
                                  Symfony\Component\EventDispatcher\EventDispatcher->dispatch(                                                                                           
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              14. lib/private/EventDispatcher/EventDispatcher.php line 106                                                                                               
                                  OC\EventDispatcher\EventDispatcher->dispatch(                                                                                                          
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              15. lib/private/User/Session.php line 392                                                                                                                  
                                  OC\EventDispatcher\EventDispatcher->dispatchTyped(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              16. lib/private/User/Session.php line 657                                                                                                                  
                                  OC\User\Session->completeLogin("*** sensitive parameters replaced ***")                                                                                
                              17. lib/private/User/Session.php line 354                                                                                                                  
                                  OC\User\Session->loginWithToken("*** sensitive parameters replaced ***")                                                                               
                              18. lib/private/User/Session.php line 453                                                                                                                  
                                  OC\User\Session->login("*** sensitive parameters replaced ***")                                                                                        
                              19. lib/private/User/Session.php line 582                                                                                                                  
                                  OC\User\Session->logClientIn("*** sensitive parameters replaced ***")                                                                                  
                              20. lib/base.php line 1154                                                                                                                                 
                                  OC\User\Session->tryBasicAuthLogin(                                                                                                                    
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              21. ocs/v1.php line 62                                                                                                                                     
                                  OC::handleLogin(                                                                                                                                       
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              22. ocs/v2.php line 23                                                                                                                                     
                                  require_once("\/var\/www\/nextcloud\/ocs\/v1.php")                                                                                                     
                                                                                                                                                                                         
                              Caused by PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '[redacted group]-[redacted username]' for                               
                              key 'user_ldap_membership_unique' at 3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php line 130                                                          
                                                                                                                                                                                         
                               0. 3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php line 130                                                                                           
                                  PDOStatement->execute(                                                                                                                                 
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               1. 3rdparty/doctrine/dbal/src/Connection.php line 1202                                                                                                    
                                  Doctrine\DBAL\Driver\PDO\Statement->execute(                                                                                                           
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               2. lib/private/DB/Connection.php line 294                                                                                                                 
                                  Doctrine\DBAL\Connection->executeStatement(                                                                                                            
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               3. 3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 386                                                                                             
                                  OC\DB\Connection->executeStatement(                                                                                                                    
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               4. lib/private/DB/QueryBuilder/QueryBuilder.php line 280                                                                                                  
                                  Doctrine\DBAL\Query\QueryBuilder->execute(                                                                                                             
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               5. lib/private/DB/QueryBuilder/QueryBuilder.php line 326                                                                                                  
                                  OC\DB\QueryBuilder\QueryBuilder->execute(                                                                                                              
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               6. lib/public/AppFramework/Db/QBMapper.php line 137                                                                                                       
                                  OC\DB\QueryBuilder\QueryBuilder->executeStatement(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               7. apps/user_ldap/lib/LoginListener.php line 95                                                                                                           
                                  OCP\AppFramework\Db\QBMapper->insert(                                                                                                                  
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                               8. apps/user_ldap/lib/LoginListener.php line 67                                                                                                           
                                  OCA\User_LDAP\LoginListener->updateGroups("*** sensitive parameters replaced ***")                                                                     
                               9. apps/user_ldap/lib/LoginListener.php line 55                                                                                                           
                                  OCA\User_LDAP\LoginListener->onPostLogin(                                                                                                              
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              10. lib/private/EventDispatcher/ServiceEventListener.php line 86                                                                                           
                                  OCA\User_LDAP\LoginListener->handle(                                                                                                                   
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              11. .../symfony/event-dispatcher/EventDispatcher.php line 230                                                                                              
                                  OC\EventDispatcher\ServiceEventListener->__invoke(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              12. .../EventDispatcher.php line 59                                                                                                                        
                                  Symfony\Component\EventDispatcher\EventDispatcher->callListeners(                                                                                      
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              13. .../EventDispatcher/EventDispatcher.php line 94                                                                                                        
                                  Symfony\Component\EventDispatcher\EventDispatcher->dispatch(                                                                                           
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              14. lib/private/EventDispatcher/EventDispatcher.php line 106                                                                                               
                                  OC\EventDispatcher\EventDispatcher->dispatch(                                                                                                          
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              15. lib/private/User/Session.php line 392                                                                                                                  
                                  OC\EventDispatcher\EventDispatcher->dispatchTyped(                                                                                                     
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              16. lib/private/User/Session.php line 657                                                                                                                  
                                  OC\User\Session->completeLogin("*** sensitive parameters replaced ***")                                                                                
                              17. lib/private/User/Session.php line 354                                                                                                                  
                                  OC\User\Session->loginWithToken("*** sensitive parameters replaced ***")                                                                               
                              18. lib/private/User/Session.php line 453                                                                                                                  
                                  OC\User\Session->login("*** sensitive parameters replaced ***")                                                                                        
                              19. lib/private/User/Session.php line 582                                                                                                                  
                                  OC\User\Session->logClientIn("*** sensitive parameters replaced ***")                                                                                  
                              20. lib/base.php line 1154                                                                                                                                 
                                  OC\User\Session->tryBasicAuthLogin(                                                                                                                    
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              21. ocs/v1.php line 62                                                                                                                                     
                                  OC::handleLogin(                                                                                                                                       
                                                                                                                                                                                         
                                  )                                                                                                                                                      
                              22. ocs/v2.php line 23                                                                                                                                     
                                  require_once("\/var\/www\/nextcloud\/ocs\/v1.php")

@fiftyheight
Copy link

In my case, updating to nc 28 seems to have alterate the user to group ldap mapping. See this post which solved my problem:
https://help.nextcloud.com/t/solved-ldap-groups-are-empty-but-users-are-set-up-correctly/45907

@systemofapwne
Copy link

In my case, updating to nc 28 seems to have alterate the user to group ldap mapping. See this post which solved my problem: https://help.nextcloud.com/t/solved-ldap-groups-are-empty-but-users-are-set-up-correctly/45907

I just noticedm that my groups also were all empty. Switching that setting to "memberUid" populated my groups.
I have temporarily re-enabled the mail-notification to confirm, that this issue is now gone.

@croniserb

This comment was marked as off-topic.

@come-nc
Copy link
Contributor

come-nc commented Mar 5, 2024

For people having this issue, I think the problem is indeed a misconfigured group association attribute.
What happens is that you have memberof working, so when going from user to group it works, but when going the other way it fails because the attribute is not the right one, and because of that the user is in the group and not in the group at the same time.
The constraint violation is another problem that I’m fixing.

For the misconfigured group membership, I’m sure what could be done to help people testing and configuring that.

@loxK
Copy link

loxK commented Mar 9, 2024

For the misconfigured group membership, I’m sure what could be done to help people testing and configuring that.

Any example of such a misconfiguration ? I how no idea on how to fix it. The configuration is rather simple and done with the UI

@come-nc
Copy link
Contributor

come-nc commented Mar 11, 2024

For the misconfigured group membership, I’m sure what could be done to help people testing and configuring that.

Any example of such a misconfiguration ? I how no idea on how to fix it. The configuration is rather simple and done with the UI

The Group-Member association attribute has to be set to what is actually used for members of groups in your LDAP directory. Usually memberUid for posixGroup or member for groupOfNames.

@loxK
Copy link

loxK commented Mar 18, 2024

@come-nc Thanks !

I went in LDAP advanced settings and changed the Group-Member association to member (AD). I do not have the notification issue anymore, and now I can see people in their groups in the Users management UI

@xundeenergie
Copy link

I have the same problem, but the other way round.
I get annoying amount of emails, that my user is added from an admin to a group since upgrade to 28 and it persists in 29.

The Group-Member asociation is working correctly, the group is filled with the right users...

@come-nc
Copy link
Contributor

come-nc commented May 30, 2024

@xundeenergie Maybe member-of is present but badly configured on your LDAP server?

@xundeenergie
Copy link

It's a dynamic group in ldap.
Same configuration as another dynamic group,which doesn't show this issue.

@come-nc
Copy link
Contributor

come-nc commented Jun 3, 2024

Check if this dynamic group membership appears in the memberOf attribute.

@xundeenergie
Copy link

hmm... you are right. memberOf is not shown for this group.

@come-nc
Copy link
Contributor

come-nc commented Jun 4, 2024

Then this is the root of the problem. You can try to disable using member-of for this LDAP configuration, by setting useMemberOfToDetectMembership to 0 for your LDAP configuration, but this option is not in the UI you can only set it with occ ldap:set-config I think. Otherwise disable your memberof overlay or make sure it lists all group memberships.

@tgebler
Copy link

tgebler commented Jun 10, 2024

Hello, we are experiencing the same problem. Lates NC version, Debian Stable, LDAP Users to MS AD. Users are recieving every couple minutes mails with changes groups.
In my opinion disabling the member-of attrib is not a sollutuion, if so, nested groups will not work anymore. Please correct me if I am wrong.

@tromlet
Copy link

tromlet commented Jun 28, 2024

In my case, updating to nc 28 seems to have alterate the user to group ldap mapping. See this post which solved my problem: https://help.nextcloud.com/t/solved-ldap-groups-are-empty-but-users-are-set-up-correctly/45907

I just noticedm that my groups also were all empty. Switching that setting to "memberUid" populated my groups. I have temporarily re-enabled the mail-notification to confirm, that this issue is now gone.

I'm using FreeIPA as an LDAP backend, and we just started having this issue as I updated to 28. This, more or less, was the fix for me, as well.

Specifically:

  1. Left-click your user icon in the top right corner.
  2. Left-click the "Administration settings" menu item from the drop-down.
  3. Left-click the "LDAP/AD integration" item from the left-hand vertical nav bar, under the "Administration" heading.
  4. Left-click the "Advanced" link in the top right corner of the "LDAP/AD integration" configuration interface.
  5. Left-click to expand the "Directory Settings" form interface, beneath the basic "Connection Settings" form interface.
  6. Left-click the drop-down menu labelled "Group-Member association", and select the appropriate value. For FreeIPA (which attempts to emulate Active Directory, more or less), selecting "member" will work - I have verified this.

That said, I highly recommend getting Apache Directory Studio and connecting to your LDAP provider to directly, visually inspect it. It WILL help a great deal, it did for me.

@NerdyGriffin
Copy link

Hello, we are experiencing the same problem. Lates NC version, Debian Stable, LDAP Users to MS AD. Users are recieving every couple minutes mails with changes groups. In my opinion disabling the member-of attrib is not a sollutuion, if so, nested groups will not work anymore. Please correct me if I am wrong.

@tgebler I am also using MS AD, and for me the instructions from @tromlet worked. The only difference was the option says "member (AD)" in my case (possibly a difference between nextcloud 28 and 29)
You can also set the same thing using something like occ ldap:set-config s01 ldapGroupMemberAssocAttr member

@kesselb
Copy link
Contributor

kesselb commented Aug 8, 2024

Hi,

Côme and I were unable to reproduce it locally. We suspect an issue with not using memberof, nested groups and the caching. The patch below will disable a part of the group caching. If you one of you still have the issue, could you please give it a test run?

Index: apps/user_ldap/lib/Access.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
--- a/apps/user_ldap/lib/Access.php	(revision 8511b89579b761798ea4f6ecf9257cad8d0bc462)
+++ b/apps/user_ldap/lib/Access.php	(date 1723121159133)
@@ -873,22 +873,6 @@
 		}
 		$groupRecords = $this->searchGroups($filter, $attr, $limit, $offset);
 
-		$listOfDNs = array_reduce($groupRecords, function ($listOfDNs, $entry) {
-			$listOfDNs[] = $entry['dn'][0];
-			return $listOfDNs;
-		}, []);
-		$idsByDn = $this->getGroupMapper()->getListOfIdsByDn($listOfDNs);
-
-		array_walk($groupRecords, function (array $record) use ($idsByDn) {
-			$newlyMapped = false;
-			$gid = $idsByDn[$record['dn'][0]] ?? null;
-			if ($gid === null) {
-				$gid = $this->dn2ocname($record['dn'][0], null, false, $newlyMapped, $record);
-			}
-			if (!$newlyMapped && is_string($gid)) {
-				$this->cacheGroupExists($gid);
-			}
-		});
 		$listOfGroups = $this->fetchList($groupRecords, $this->manyAttributes($attr));
 		$this->connection->writeToCache($cacheKey, $listOfGroups);
 		return $listOfGroups;

@small1
Copy link

small1 commented Aug 22, 2024

I have an ldap server that does not support memberof and we use dynamic groups. When i run check-group --update it does state that it does remove the users from the group. But as soon as they access again they are in the actual group. This system is not on the latest nc 29 yet (Will be this evening) but it has been a problem for a while.

@small1
Copy link

small1 commented Aug 22, 2024

I updated my settings to member (AD) that solved my issue. But the uniquemember worked before for almost 2 years. ....

kesselb added a commit that referenced this issue Aug 27, 2024
When using nested groups without a memberof overlay, then fetchListOfGroups is called from getGroupsByMember without applying the group filter.

In some setups, the "unfiltered" result is then written back to the group mapping table. That might cause random "An administrator removed you from group" activities.

I was unable to replicate it locally, but we got the feedback that the random activities stopped with the patch applied.

Ref: #42195

Signed-off-by: Daniel Kesselberg <[email protected]>
@kesselb kesselb linked a pull request Aug 27, 2024 that will close this issue
6 tasks
@joshtrichards joshtrichards added the needs review Needs review to determine if still applicable label Sep 6, 2024
kesselb added a commit that referenced this issue Sep 10, 2024
When using nested groups without a memberof overlay, then fetchListOfGroups is called from getGroupsByMember without applying the group filter.

In some setups, the "unfiltered" result is then written back to the group mapping table. That might cause random "An administrator removed you from group" activities.

I was unable to replicate it locally, but we got the feedback that the random activities stopped with the patch applied.

Ref: #42195

Signed-off-by: Daniel Kesselberg <[email protected]>
kesselb added a commit that referenced this issue Sep 20, 2024
When using nested groups without a memberof overlay, then fetchListOfGroups is called from getGroupsByMember without applying the group filter.

In some setups, the "unfiltered" result is then written back to the group mapping table. That might cause random "An administrator removed you from group" activities.

I was unable to replicate it locally, but we got the feedback that the random activities stopped with the patch applied.

Ref: #42195

Signed-off-by: Daniel Kesselberg <[email protected]>
kesselb added a commit that referenced this issue Sep 23, 2024
When using nested groups without a memberof overlay, then fetchListOfGroups is called from getGroupsByMember without applying the group filter.

In some setups, the "unfiltered" result is then written back to the group mapping table. That might cause random "An administrator removed you from group" activities.

I was unable to replicate it locally, but we got the feedback that the random activities stopped with the patch applied.

Ref: #42195

Signed-off-by: Daniel Kesselberg <[email protected]>
@jgrocha
Copy link

jgrocha commented Oct 25, 2024

It was not present in 29.0.8, but as soon as I upgraded to 30.0.1, I got these emails again.

The current solution is to block such messages on the mail server (postfix, in my case):

/^Subject: Atividade em Geocloud/ REJECT
/^Subject: Activity at Geocloud/ REJECT

@brianjmurrell
Copy link

brianjmurrell commented Nov 10, 2024

I'm using FreeIPA as an LDAP backend, and we just started having this issue as I updated to 28. This, more or less, was the fix for me, as well.

I am also using FreeIPA and am seeing this issue on 29.0.x.

  1. Left-click the drop-down menu labelled "Group-Member association", and select the appropriate value. For FreeIPA (which attempts to emulate Active Directory, more or less), selecting "member" will work - I have verified this.

I already have Group-Member association set to member (AD) but I am still getting hit by these emails every 60-65 minutes, corresponding with the periodic NextCloud CRON job.

What is noteworthy I think is that every user is only getting notified about their own group (with FreeIPA every user has their own "user private group" created for them) even though they are members of a number of other groups. For example, for this user:

dn: uid=jane,cn=users,cn=accounts,dc=example,dc=com
krbLastSuccessfulAuth: 20241110140632Z
krbLoginFailedCount: 0
krbLastFailedAuth: 20241110140459Z
memberOf: cn=ipausers,cn=groups,cn=accounts,dc=example,dc=com
memberOf: cn=parents,cn=groups,cn=accounts,dc=example,dc=com
memberOf: ipaUniqueID=b6a619e4-0e85-11e7-ac04-001fc6c4926a,cn=hbac,dc=example,dc=com
mobile: [redacted]
displayName: Jane Smith
cn: Jane Smith
objectClass: ipaobject
objectClass: person
objectClass: top
objectClass: ipasshuser
objectClass: inetorgperson
objectClass: organizationalperson
objectClass: krbticketpolicyaux
objectClass: krbprincipalaux
objectClass: inetuser
objectClass: posixaccount
objectClass: ipaSshGroupOfPubKeys
objectClass: mepOriginEntry
loginShell: /bin/bash
initials: JS
gecos: Jane Smith
homeDirectory: /home/jane
uid: jane
mail: [email protected]
krbPrincipalName: [email protected]
givenName: Jane
sn: Smith
ipaUniqueID: 85b650de-3e01-11e5-9255-0014d11345ac
uidNumber: 1007
gidNumber: 1007
krbPasswordExpiration: 20700512183838Z
krbLastPwdChange: 20150809183838Z
krbExtraData:: [redacted]
mepManagedEntry: cn=jane,cn=groups,cn=accounts,dc=example,dc=com
telephoneNumber: [redacted]
l: [redacted]
st: [redacted]
street: [redacted]
postalCode: [redacted]
krbLastAdminUnlock: 20171111123544Z

Notice she has a gid of 1007 and the group in ldap with gidNumber: 1007 is as follows:

dn: cn=jane,cn=groups,cn=accounts,dc=example,dc=com
objectClass: posixgroup
objectClass: ipaobject
objectClass: mepManagedEntry
objectClass: top
cn: jane
gidNumber: 1007
description: User private group for jane
mepManagedBy: uid=jane,cn=users,cn=accounts,dc=example,dc=com
ipaUniqueID: 85e34fda-3e01-11e5-9255-0014d11345ac

But notice that the user entry above for this user does not list cn=jane,cn=groups,cn=accounts,dc=example,dc=com as a memberOf: attribute.

In Nextcloud's Users UI this is exhibited as:

Image

where you can see her "user private group jane" is not listed in her groups. Yet if we go look at the group itself

Image

she is listed as a user of it.

Here's an example of the messages I get with every ~hourly CRON run:

Nov 10 09:45:18 server Nextcloud[706890]: {"reqId":"2pLsWORxPKZf0497GvWI","level":1,"time":"2024-11-10T14:45:18+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"editors\" found.","userAgent":"--","version":"29.0.9.2","data":{"app":"user_ldap"}}
Nov 10 09:45:18 server Nextcloud[706890]: {"reqId":"2pLsWORxPKZf0497GvWI","level":1,"time":"2024-11-10T14:45:18+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"brian\" found.","userAgent":"--","version":"29.0.9.2","data":{"app":"user_ldap"}}
Nov 10 09:45:19 server Nextcloud[706890]: {"reqId":"2pLsWORxPKZf0497GvWI","level":1,"time":"2024-11-10T14:45:19+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"jane\" found.","userAgent":"--","version":"29.0.9.2","data":{"app":"user_ldap"}}
Nov 10 09:45:19 server Nextcloud[706890]: {"reqId":"2pLsWORxPKZf0497GvWI","level":1,"time":"2024-11-10T14:45:19+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"asterisk\" found.","userAgent":"--","version":"29.0.9.2","data":{"app":"user_ldap"}}
Nov 10 09:45:19 server Nextcloud[706890]: {"reqId":"2pLsWORxPKZf0497GvWI","level":1,"time":"2024-11-10T14:45:19+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"spamd\" found.","userAgent":"--","version":"29.0.9.2","data":{"app":"user_ldap"}}
Nov 10 09:45:19 server Nextcloud[706890]: {"reqId":"2pLsWORxPKZf0497GvWI","level":1,"time":"2024-11-10T14:45:19+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 new group \"Default SMB Group\" found.","userAgent":"--","version":"29.0.9.2","data":{"app":"user_ldap"}}
Nov 10 09:45:19 server Nextcloud[706890]: {"reqId":"2pLsWORxPKZf0497GvWI","level":1,"time":"2024-11-10T14:45:19+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"","url":"--","message":"service \"updateGroups\" \u2013 groups [] were removed.","userAgent":"--","version":"29.0.9.2","data":{"app":"user_ldap"}}
Nov 10 09:46:12 server Nextcloud[3933223]: {"reqId":"ZzDHNHygMkP4sMLNPjhURgAAANU","level":1,"time":"2024-11-10T14:46:12+00:00","remoteAddr":"10.75.22.128","user":"jane","app":"user_ldap","method":"OPTIONS","url":"/remote.php/webdav","message":"service \"updateGroups\" \u2013 jane removed from jane","userAgent":"gnome-online-accounts/3.50.2 libsoup/3.4.4","version":"29.0.9.2","data":{"app":"user_ldap"}}

So clearly that last message is a problem where NC is reporting jane was removed from her "user private" group jane but also, why is it that every run done at ~hourly is logging "new group found" messages? These are not new groups every hour. They have existed for a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 28-feedback bug feature: emails feature: ldap needs review Needs review to determine if still applicable
Projects
None yet
Development

Successfully merging a pull request may close this issue.