nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.76k stars 4k forks source link

Shared by link not found randomly in smb external #29804

Open oljask opened 2 years ago

oljask commented 2 years ago

Steps to reproduce

  1. Share file or directory by link
  2. Open link in browser
  3. File not found
  4. Some time after link is working
  5. Give it more time. Not found
  6. Working
  7. Not found
  8. etc

Expected behaviour

working link

Actual behaviour

The document could not be found on the server. Maybe the share was deleted or has expired?

Server configuration

Operating system: FreeBSD 12.3

Web server: Apache24

Database: MariaDB

PHP version: 7.4 mod_php

Nextcloud version: 22.2.3

Updated from an older Nextcloud/ownCloud or fresh install: Update

Where did you install Nextcloud from: FreeBSD ports

Signing status:

Signing status ``` No errors have been found. ```

List of activated apps:

App list ``` Enabled: - bruteforcesettings: 2.2.0 - calendar: 2.3.4 - cloud_federation_api: 1.5.0 - contacts: 4.0.6 - dav: 1.19.0 - external: 3.9.0 - federatedfilesharing: 1.12.0 - files: 1.17.0 - files_external: 1.13.0 - files_rightclick: 1.1.0 - files_sharing: 1.14.0 - files_videoplayer: 1.11.0 - logreader: 2.7.0 - lookup_server_connector: 1.10.0 - mail: 1.10.5 - notes: 4.2.0 - oauth2: 1.10.0 - passwords: 2021.11.20 - photos: 1.4.0 - provisioning_api: 1.12.0 - settings: 1.4.0 - spreed: 12.1.2 - survey_client: 1.10.0 - theming: 1.13.0 - twofactor_backupcodes: 1.11.0 - user_ldap: 1.12.1 - viewer: 1.6.0 - weather_status: 1.2.0 - workflowengine: 2.4.0 Disabled: - accessibility - activity - admin_audit - circles - comments - contactsinteraction - dashboard - encryption - federation - files_pdfviewer - files_trashbin - files_versions - firstrunwizard - nextcloud_announcements - notifications - password_policy - privacy - rainloop - recommendations - serverinfo - sharebymail - support - systemtags - text - updatenotification - user_saml - user_status ```

Nextcloud configuration:

Config report ``` { "system": { "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "example.com", ], "trusted_proxies": "***REMOVED SENSITIVE VALUE***", "datadirectory": "***REMOVED SENSITIVE VALUE***", "version": "22.2.3.0", "dbtype": "mysql", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbname": "***REMOVED SENSITIVE VALUE***", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "installed": true, "default_language": "en", "default_phone_region": "RU", "defaultapp": "files", "knowledgebaseenabled": true, "enable_avatars": true, "allow_user_to_change_display_name": true, "remember_login_cookie_lifetime": 1296000, "session_lifetime": 86400, "session_keepalive": true, "token_auth_enforced": false, "lost_password_link": "https:\/\/example.com\/ssp", "ldapIgnoreNamingRules": false, "maintenance": false, "mail_smtpmode": "smtp", "mail_smtpsecure": "tls", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpauthtype": "PLAIN", "mail_smtpauth": 1, "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "587", "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "htaccess.RewriteBase": "\/", "htaccess.IgnoreFrontController": false, "trashbin_retention_obligation": "auto", "versions_retention_obligation": "auto", "appcodechecker": true, "updatechecker": true, "updater.server.url": "https:\/\/updates.nextcloud.com\/updater_server\/", "updater.release.channel": "stable", "has_internet_connection": true, "config_is_read_only": false, "log_type": "file", "logfile": "\/var\/log\/nextcloud\/nextcloud.log", "loglevel": 2, "logdateformat": "F d, Y H:i:s", "logtimezone": "UTC", "log_query": false, "memcache.local": "\\OC\\Memcache\\APCu", "memcache.distributed": "\\OC\\Memcache\\Redis", "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 0, "dbindex": 0, "timeout": 1.5 }, "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory", "theme": "", "instanceid": "***REMOVED SENSITIVE VALUE***", "apps_paths": [ { "path": "\/usr\/local\/www\/nextcloud\/apps", "url": "\/apps", "writable": true }, { "path": "\/usr\/local\/www\/nextcloud\/apps-pkg", "url": "\/apps-pkg", "writable": false } ], "overwrite.cli.url": "https:\/\/exaapmle.com", "overwriteprotocol": "https", "mysql.utf8mb4": true, "app_install_overwrite": [ "rainloop", "bruteforcesettings" ] } } ```

Are you using external storage, if yes which one: smb

Are you using encryption: no

Are you using an external user-backend, if yes which one: ActiveDirectory

LDAP configuration (delete this part if not used)

LDAP config ``` +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Configuration | | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | hasMemberOfFilterSupport | 1 | | homeFolderNamingRule | | | lastJpegPhotoLookup | 0 | | ldapAgentName | CN=Administrator,CN=Users,DC=example,DC=com | | ldapAgentPassword | *** | | ldapAttributesForGroupSearch | | | ldapAttributesForUserSearch | | | ldapBackupHost | dc.exaample.com | | ldapBackupPort | 3269 | | ldapBase | CN=Users,DC=example,DC=com | | ldapBaseGroups | CN=Users,DC=example,DC=com | | ldapBaseUsers | CN=Users,DC=example,DC=com | ldapCacheTTL | 6000 | ldapConfigurationActive | 1 | ldapDefaultPPolicyDN | | ldapDynamicGroupMemberURL | | ldapEmailAttribute | mail | ldapExperiencedAdmin | 0 | ldapExpertUUIDGroupAttr | | ldapExpertUUIDUserAttr | | ldapExpertUsernameAttr | sAMAccountName | ldapExtStorageHomeAttribute | | ldapGidNumber | gidNumber | ldapGroupDisplayName | cn | ldapGroupFilter | (&(|(objectclass=group))(|(cn=Domain Admins)(cn=Domain Users)(cn=Shared))) | ldapGroupFilterGroups | Domain Admins;Domain Users;Shared | ldapGroupFilterMode | 0 | ldapGroupFilterObjectclass | group | ldapGroupMemberAssocAttr | member | ldapHost | ldaps://dc.example.com | ldapIgnoreNamingRules | | ldapLoginFilter | (&(&(|(objectclass=organizationalPerson)(objectclass=person)(objectclass=top)(objectclass=user)))(|(samaccountname=%uid)(|(mailPrimaryAddress=%uid)(mail=%uid)(userPrincipalName=%uid)))) | | ldapLoginFilterAttributes | | ldapLoginFilterEmail | 1 | ldapLoginFilterMode | 1 | ldapLoginFilterUsername | 1 | ldapMatchingRuleInChainState | unknown | ldapNestedGroups | 0 | ldapOverrideMainServer | | ldapPagingSize | 500 | ldapPort | 3269 | ldapQuotaAttribute | | ldapQuotaDefault | | ldapTLS | 0 | ldapUserAvatarRule | default | ldapUserDisplayName | displayname | ldapUserDisplayName2 | | ldapUserFilter | (&(|(objectclass=organizationalPerson)(objectclass=person)(objectclass=top)(objectclass=user))) | ldapUserFilterGroups | Domain Admins;Domain Users;Shared | ldapUserFilterMode | 0 | ldapUserFilterObjectclass | organizationalPerson;person;top;user | ldapUuidGroupAttribute | auto | ldapUuidUserAttribute | auto | turnOffCertCheck | 1 | turnOnPasswordChange | 0 | useMemberOfToDetectMembership | 1 ```

Client configuration

Browser: any browser

Operating system: any

Logs

Web server error log

Web server error log ``` No relevant records ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` No relevant records ```

Browser log

Browser log ``` No relevant records ```
oljask commented 2 years ago

I have 2 sites one with apache mod_php other with nginx php-fpm. Booth with Active directory, both with smb-external storage. share by url is broken in both either it works randomly or just disappears forever some minutes after link creation.

oljask commented 2 years ago

OK. ver 23 seems to fix this. Thank you.

oljask commented 2 years ago

Sadly issue is still there on ver 23. There is records in table oc_share, but link is not working, and it is not visible in webUI under "Shared by link" list.

oljask commented 2 years ago

This is somehow related with oc_storages table, or maybe the way smbclient authenticates with samba server. I have found that there is two login types in oc_storages table: smb::user@server.name//share// smb::user@domain.name@server.name//share// I think this is why I have some split-brain behavior. The way to determine which storage is actually active right now is not clear. Its clearly goes in periods. For some time it uses "user" login then for some time "user@domain.name" login.

justinplakoo commented 2 years ago

Hi,

Thank you for this feedback. For my part, I do not use samba client and since the 22.2.3 then 23.0 update, all the public links I create are inaccessible "file not found". Do you have a solution for me? Thanks in advance.

Justin De : oljask @.> Envoyé : mardi 7 décembre 2021 21:22 À : nextcloud/server @.> Cc : PLAKOO Justin @.>; Manual @.> Objet : Re: [nextcloud/server] Shared by link not found randomly in smb external (Issue #29804)

This is somehow related with oc_storages table, or maybe the way smbclient authenticates with samba server. I have found that there is two login types in oc_storages table: @.**@.>//share// @.@@.>//share// I think this is why I have some split-brain behavior. The way to determine which storage is actually active right now is not clear. Its clearly goes in periods. For some time it uses "user" login then for some time @.**@.>" login.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/nextcloud/server/issues/29804#issuecomment-988238202, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQVMQPHJHPYRVTWMQ5ODV2LUPZUHFANCNFSM5IM6MMNA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

oljask commented 2 years ago

Hi, Thank you for this feedback. For my part, I do not use samba client and since the 22.2.3 then 23.0 update, all the public links I create are inaccessible "file not found". Do you have a solution for me? Thanks in advance.

No, I do not have a solution yet. Do you use LDAP?

justinplakoo commented 2 years ago

Yes i use ldap.

De : oljask @.> Envoyé : mercredi 8 décembre 2021 09:45 À : nextcloud/server @.> Cc : PLAKOO Justin @.>; Manual @.> Objet : Re: [nextcloud/server] Shared by link not found randomly in smb external (Issue #29804)

Hi, Thank you for this feedback. For my part, I do not use samba client and since the 22.2.3 then 23.0 update, all the public links I create are inaccessible "file not found". Do you have a solution for me? Thanks in advance.

No, I do not have a solution yet. Do you use LDAP?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/nextcloud/server/issues/29804#issuecomment-988610612, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQVMQPHBGXD7SSSHPRU6UDLUP4LH5ANCNFSM5IM6MMNA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

oljask commented 2 years ago

Yes i use ldap.

I have not yet found actual cause of this. But my problems also started from ver. 22.

oljask commented 2 years ago

I have reconfigured LDAP removing option: When logging in, DOMAIN will find the user based on the following attributes: LDAP/AD Email Address I have changed samba server FQDN to IP. Behavior is same. half of the times it mounts user@IP storage other half it mounts user@domain.name@IP storage I have tried to use latest smb client wrapper from ICEWIND repo with no luck.

justinplakoo commented 2 years ago

Hi,

Have you progressed on shared link problem ?

Thanks

De : oljask @.> Envoyé : mercredi 8 décembre 2021 14:40 À : nextcloud/server @.> Cc : PLAKOO Justin @.>; Manual @.> Objet : Re: [nextcloud/server] Shared by link not found randomly in smb external (Issue #29804)

I have reconfigured LDAP removing option: When logging in, DOMAIN will find the user based on the following attributes: LDAP/AD Email Address I have changed samba server FQDN to IP. Behavior is same. half of the times it mounts @. storage other half it mounts @.@@.***@IP> storage I have tried to use latest smb client wrapper from ICEWIND repo with no luck.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/nextcloud/server/issues/29804#issuecomment-988823345, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQVMQPANKRY2JKVYFPRTOLTUP5N3PANCNFSM5IM6MMNA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

szaimen commented 1 year ago

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+

oljask commented 1 year ago

@szaimen Hi! I have changed login settings. Issue is somehow related to "login with email" checkbox. I have found that mysql table contains storage duplicates. Almost each user had two sets of storage mount ids, one with login and other with email. And they were switching in some kind of rr manner. So disabling "login with email" and than deleting orphaned mysql entries solved the problem.

szaimen commented 1 year ago

I see. So maybe indeed the login way matters? cc @icewind1991

joshtrichards commented 1 year ago

How are you storing login credentials for the external mounts?

https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage/auth_mechanisms.html#password-based-mechanisms