-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Sharing still broken with ldap groups #25062
Comments
We can see the same bug on our nextcloud instance for our university (Php 7.4, Nextcloud 20.0.5) The solution provided above is working, thanks ! To quickly fix this issue on all group shared folders, we (with @jdorel) used the following SQL code :
|
Should it be? set to 1 when created? While it has been suggested ( #19520 (comment) ) that NextCloud cron should take care of these, I've been digging and could only find a job that removes shares to users that no longer belong to a group ( https://github.com/nextcloud/server/blob/master/lib/private/Repair/OldGroupMembershipShares.php#L69 ) . The event listener above seems to be the one accepting on behalf of users joining a group. Then again, looking at the If this is the case, we may then fix this in https://github.com/nextcloud/server/blob/master/lib/private/Share20/DefaultShareProvider.php#L149 , adding some @christianvw could you confirm that |
I think there have been some without LDAP, e.g.
|
This issue seems to be pretty widespread. I have the same issue with the "Everyone" group, but just ran some tests and realized that it happens with all groups and users (all LDAPs in my case). Here a similar issue reported for the "Everyone" group: icewind1991/group_everyone#19 (comment) |
+1 |
Group memberships are checked in an hourly background job which sends the corresponding events. |
is there another workaround than the one described above (manual adjustment of the database)? |
nope |
Would it be problematic to change all entries for groups to accepted? And should not this be the default case for groups? Is this the actual bug as @christianvw mentioned? Older group-shares have accepted set to 1. It might be a regression? |
It depends on the configuration, but by default the shares are accepted. Still, sharing need to be made aware of group membership changes. I cannot reproduce any misbehaviour. |
Interestinly I see in my Nextcloud (21.0.2.1) installation the same isse. In the oc_share table there is a row for every user who was in the LDAP group when sharing. Maybe it is intended to keep the accept=0 for the group and just a syncer is missing, who checks for new users and adds a line per new LDAP user and share? |
For me this trigger is the workaround:
but its better when we solve that in code. There are two things, the shares for a group must have accepted = 1 and new users in the group must inherit the group sharing like in my trigger above. I've tested it with the SQL backends app and it works with new users, i think it works also with LDAP. |
Small recap of the problemLDAP users created (and added to the ldap group) after the share creation in nextcloud are not getting the share (because it does not get accepted by nextcloud). Problem still there, reproducibilityI still see exactly the same behavior in Nextcloud 21.0.2 (Docker), even in a fresh installation. For me, this misbehavior is 100% reproducible with the process described in the initial post. Mind you with Nextcloud as well as openLDAP in a docker container. And considering the many competitors in these and other issues, it is also a problem for at least some others. Even new issues popped up in the last months, regarding the exact same problem. I wonder how this problem doesn't seem to occur in large organizations that use Nextcloud in combination with LDAP, this issue should stand out. Fixes in the database
However, like @leuedaniel said, the true solution must be a fix in the Nextcloud application (a fix of the background job / syncer / group share creation / ...). Is there maybe even a fix coming? @blizzz Possible (real) fixes in the application@faust64 did a pull request (one liner, #26428) with the idea from my initial post in mind: Setting the His change (in
However @blizzz has been looking more at a background job. This would also be an alternative solution. Nevertheless something does not work here as intended. |
Any updates? Issue also present in Nextcloud 23 |
Here is the behavior I get: When creating a user and adding it to a group in ldap, indeed the share is not accepted automatically. It appears in pending shares, and I can accept it (no errors, accepting works). But, if I wait until the background job runs, the share is correctly accepted. So, this is not a big problem as of 23 from what I can see, it’s a matter of waiting a few hours top, or manually accepting the pending share. It is annoying but it is not a major issue. |
You're right manually accepting works for me. Didn't know there is a workflow to accept pending shares. |
It appears we have the very same problem with our Nextcloud 23.0.2 and openldap-2.4.40 Can someone please confirm that this throws log error messages like:
Workaround seems to have worked so far, thanks @christianvw for elaborating! |
This still seems to be a problem. Any progress on fixong this? |
This needs a refactoring of the way the background job is storing which group-member associations were already announced through the event, so that on login we can add a check that all groups the user is a member of has been announced without having a major performance impact. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Just for my understanding: Do we know, why the paradigm has changed from setting |
I don’t know, all I can say it the background job is not especially designed for this usecase, it just fires the event signaling that users have been added to the group, which might trigger other things than accepting shares. |
By the way if you do not want to use mangle with the database, then there is also an other workaround (other then simply using
This seems to work fine on our NC25 server. |
How to use GitHub
Steps to reproduce
LDAP user and group backend
appsharing_group
shared_folder
shared_folder
with the group from ldapsharing_group
sharing_user
in your ldap serversharing_group
sharing_user
Expected behaviour
sharing_user
should be inside the ldap groupsharing_group
(can be seen by the usersharing_user
in http://localhost/settings/user)sharing_user
therefore should see the foldershared_folder
since this is shared with the groupsharing_group
where the user is a memberActual behaviour
sharing_user
IS inside the ldap groupsharing_group
sharing_user
CANNOT see the foldershared_folder
The bug: LDAP users created after the share creation are not able to view the share to their group (which they normally should be able to).
The problem / a workaround
The problem might be located in the sharing or ldap app. It could be that the share is not automatically accepted. Therefore I went into the database using
docker exec -it <<<<containername-of-db>>>> mysql -u<<<<username-of-db>>>> -p <<<<name-of-database>>>>
and displayed the table with all shares:Now we notice that the group we actually shared the folder with, supposedly did not accept this share (see row with
id
=1
, see columnaccepted
). Obviously a group cannot accept a share manually, however I would have assumed that this would happen automatically, with such system-level sharing targets.Now I just tried to set
accepted
to1
in the affected line. And indeed it worked. 🎉 Now all ldap users see the shared foldershared_folder
since they are in the groupsharing_group
. This works especially for ldap users created after the share was created.Therefore I would limit the bug to this area, that shares to ldap groups are not automatically accepted (in the database). Groups obviously cannot accept shares by itself since no one really is the group. Is this maybe the underlying bug?
Not working workarounds
There are many hints and workarounds posted here in many issues but none of them fixed the problem for me. Here is a list of the not working ones:
sharing_user
can accept the share by itself on http://localhost/apps/files/?dir=/&view=pendingshares (the pending share is visible but clicking accept results in a 404 api request)docker exec -it --user www-data -it <<<<container-name>>>> php /var/www/html/cron.php
(doesn't change anything)docker exec -it --user www-data -it <<<<container-name>>>> php occ maintenance:repair
(doesn't change anything)sharing.force_share_accept
totrue
viadocker exec --user www-data -it <<<<container-name>>>> php occ config:app:set sharing force_share_accept --value=true
(doesn't change anything)Possibly related issues
There are quite a few issues regarding this topic but unfortunately the same issue still exists for the current nextcloud version.
Server configuration
Operating system: Docker version 20.10.2, build 2291f61
Web server: Apache
Database: 10.5.8-MariaDB-1:10.5.8+maria~focal
PHP version: 7.4.14
Nextcloud version: 20.0.4
Updated from an older Nextcloud/ownCloud or fresh install: Fresh install, but also happends with updated instances (since Nextcloud 20)
Where did you install Nextcloud from: Docker Hub
Signing status:
Signing status
List of activated apps:
App list
Nextcloud configuration:
Config report
Are you using external storage, if yes which one: None
Are you using encryption: no
Are you using an external user-backend, if yes which one: LDAP
LDAP configuration (delete this part if not used)
LDAP config
Client configuration
Browser: Google Chrome 87.0.4280.141
Operating system: Windows 10 10.0.19042 Build 19042
Logs
Web server error log
Web server error log
Nextcloud log (data/nextcloud.log)
Nextcloud log
Browser log
Browser log
The text was updated successfully, but these errors were encountered: