server icon indicating copy to clipboard operation
server copied to clipboard

[Bug]: Can't write over WebDAV "External Storage" to bitrix24

Open DKX47 opened this issue 3 years ago • 6 comments

⚠️ This issue respects the following points: ⚠️

  • [X] This is a bug, not a question or a configuration/webserver/proxy issue.
  • [X] This issue is not already reported on Github (I've searched it).
  • [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • [X] Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • [X] I agree to follow Nextcloud's Code of Conduct.

Bug description

I'm trying to integrate Storage vom bitrix24 via External Storage. I can integrate it but not write to it. The nextcloud files app says, that I don't have permission to upload or create files. It seems like the same issue as here (closed and with older nextcloud versions): https://github.com/nextcloud/server/issues/28890

I can browse the external storage and its subfolders but files in those folders are not shown.

I am testing with nextcloudpi on a raspberry pi 4 and Nextcloud Hub 4 26.0.1 and External storage support 1.18.0

Connecting to the same Drive via Gnome files works (I can see files and create/change files) using davs://{identifier}bitrix24.de/company/personal/user/1/disk/path/

Steps to reproduce

  1. Have a Bitrix24 cloud drive - accessible via WebDAV (bitrix24.de)
  2. Get the URL of the WebDav Driver: Click "Gear Icon" and "Network Drive": see the WebDAV URL to connect "https://{identifier}.bitrix24.de/company/personal/user/1/disk/path/"
  3. As NextCloud Admin, under Settings->Administration->External Storage enable "Allow users to mount external storage" and enable just "WebDAV"
  4. Logout as Admin and re-login as regular user
  5. Under Settings->External Storage add a new WebDAV mount with the URL from above, "secure https" enabled and the Bitrix username and password
  6. See there is a green checkmark - the mounting succeeded
  7. Go to "Files->All files" and into the mounted folder - there is "No files in here" displayed along with "You don’t have permission to upload or create files here" at the top

Expected behavior

Show the files and allow me to create new files or copy local files there.

Installation method

Other Community project

Nextcloud Server version

26

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MariaDB

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

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

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

Configuration report

No response

List of activated Apps

- activity: 2.18.0
  - calendar: 4.3.3
  - circles: 26.0.0
  - cloud_federation_api: 1.9.0
  - comments: 1.16.0
  - contacts: 5.2.0
  - dashboard: 7.6.0
  - dav: 1.25.0
  - federatedfilesharing: 1.16.0
  - files: 1.21.1
  - files_external: 1.18.0
  - files_pdfviewer: 2.7.0
  - files_rightclick: 1.5.0
  - files_sharing: 1.18.0
  - files_trashbin: 1.16.0
  - files_versions: 1.19.1
  - firstrunwizard: 2.15.0
  - logreader: 2.11.0
  - lookup_server_connector: 1.14.0
  - nextcloud_announcements: 1.15.0
  - nextcloudpi: 0.0.1
  - notes: 4.7.2
  - notifications: 2.14.0
  - notify_push: 0.6.3
  - oauth2: 1.14.0
  - password_policy: 1.16.0
  - photos: 2.2.0
  - privacy: 1.10.0
  - provisioning_api: 1.16.0
  - recommendations: 1.5.0
  - related_resources: 1.1.0-alpha1
  - serverinfo: 1.16.0
  - settings: 1.8.0
  - sharebymail: 1.16.0
  - support: 1.9.0
  - survey_client: 1.14.0
  - systemtags: 1.16.0
  - tables: 0.5.0
  - tasks: 0.14.5
  - text: 3.7.2
  - theming: 2.1.1
  - twofactor_backupcodes: 1.15.0
  - updatenotification: 1.16.0
  - user_status: 1.6.0
  - viewer: 1.10.0
  - workflowengine: 2.8.0

Nextcloud Signing status

No response

Nextcloud Logs

{"reqId":"ZFH1ekTK2jWzZTFJz7NP2gAAAhg","level":2,"time":"2023-05-03T05:47:38+00:00","remoteAddr":"2003:ce:70a:ab00:2b:c5a9:53ae:9e0e","user":"ncp","app":"no app in context","method":"PUT","url":"/apps/files_external/globalstorages/1","message":"External storage not available: Sabre\\HTTP\\ClientException: Could not resolve host: davs","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36","version":"26.0.1.1","exception":{"Exception":"OCP\\Files\\StorageNotAvailableException","Message":"Sabre\\HTTP\\ClientException: Could not resolve host: davs","Code":1,"Trace":[{"file":"/var/www/nextcloud/lib/private/Files/Storage/DAV.php","line":289,"function":"convertException","class":"OC\\Files\\Storage\\DAV","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/DAV.php","line":584,"function":"propfind","class":"OC\\Files\\Storage\\DAV","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Common.php","line":462,"function":"stat","class":"OC\\Files\\Storage\\DAV","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/MountConfig.php","line":131,"function":"test","class":"OC\\Files\\Storage\\Common","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/Controller/StoragesController.php","line":288,"function":"getBackendStatus","class":"OCA\\Files_External\\MountConfig","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/files_external/lib/Controller/GlobalStoragesController.php","line":201,"function":"updateStorageStatus","class":"OCA\\Files_External\\Controller\\StoragesController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"update","class":"OCA\\Files_External\\Controller\\GlobalStoragesController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1056,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/Files/Storage/DAV.php","Line":863,"Hint":"Storage is temporarily not available","message":"External storage not available: Sabre\\HTTP\\ClientException: Could not resolve host: davs","exception":[],"CustomMessage":"External storage not available: Sabre\\HTTP\\ClientException: Could not resolve host: davs"},"id":"6463d104503d0"}

Additional info

No response

DKX47 avatar May 16 '23 18:05 DKX47

That log seems to indicate that you have davs as the hostname. Any chance you inadvertenly included the davs:// part?

Alternatively, perhaps that's not the matching log entry with the replicated behavior and there's another one you can dig up from the right timeframe?

joshtrichards avatar May 17 '23 15:05 joshtrichards

Never mind - reproduced the behavior (not that log entry though) in terms of:

  • Green status even though it isn't accessible
  • Browsing folder message inability to to upload message

joshtrichards avatar May 17 '23 15:05 joshtrichards

I just checked again with different entries in the part marked red. Red is hostname, i think?

hostname

https://[identifier].bitrix24.de/company/personal/user/1/disk/path/ -> Green Checkmark but the described behavior (no writing possible / no files shown)

[identifier].bitrix24.de/company/personal/user/1/disk/path/ -> Green Checkmark but the described behavior (no writing possible / no files shown)

davs://[identifier].bitrix24.de/company/personal/user/1/disk/path/ -> Red Cross, so not working which seems to be expected

DKX47 avatar May 18 '23 07:05 DKX47

It appears that bitrix24 filters based on user-agent. I did some testing with curl and most arbitrary agents cause bitrix24 to display an HTML page during WebDAV requests (which is definitely wrong). One that does work is Microsoft-WebDAV-MiniRedir. This is basically lying by saying we're the MS Windows built-in WebDAV client.

It's a stupid security measure IMO, since it's easily worked around, but they're doing it nonetheless.

Unfortunately bitrix24 offers no documentation or mention of any of this behavior anywhere as far as I can tell.

Since you're a customer of theirs it might be worth contacting them to understand if the issue is:

a) they have a policy against 3rd-party WebDAV clients b) they have a policy only against certain 3rd-party WebDAV clients c) it was an oversight d) they expect legit clients to do something in particular e) their countermeasures are broken

There are references to this issue elsewhere:

  • https://github.com/cryptomator/android/issues/234
  • https://forum.rclone.org/t/saving-files-causes-wrong-modified-time-to-be-set-for-a-few-seconds-on-webdav-mount-with-bitrix24/36451?page=2

In theory we could spoof it in the NC webdav client, but that seems iffy since they're the ones doing the filtering.

joshtrichards avatar May 21 '23 13:05 joshtrichards

Thanks for digging into this, that seems really odd. I will get in touch with them and report back

DKX47 avatar May 24 '23 03:05 DKX47

Seems like there is no way to contact their support (or anyone else at the company), unless you have a paid subscription, which I don't have. So if you understandably don't want to spoof the user agent, this issue can be closed.

DKX47 avatar Jun 04 '23 19:06 DKX47