Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Debugging how Nextcloud access remote shares. #373

Open
MahdiBaghbani opened this issue Jun 15, 2023 · 11 comments
Open

Debugging how Nextcloud access remote shares. #373

MahdiBaghbani opened this issue Jun 15, 2023 · 11 comments
Assignees

Comments

@MahdiBaghbani
Copy link
Member

MahdiBaghbani commented Jun 15, 2023

On dev-stock run NRRO scenario.

when sharing from OC (marie) to NC (einstein):

OC access logs:

{"reqId":"qwIqD9dti0nLprTlbRGu","level":3,"time":"2023-06-15T10:05:28+00:00","remoteAddr":"172.18.0.10","user":"--","app":"PHP","method":"POST","url":"\/index.php\/apps\/sciencemesh\/~marie\/api\/storage\/GetMD","message":"Undefined index: path at \/var\/www\/html\/apps\/sciencemesh\/lib\/Controller\/RevaController.php#561"}
[Thu Jun 15 10:05:28.031790 2023] [php7:notice] [pid 165] [client 172.18.0.3:45118] RevaHttpClient createShare
[Thu Jun 15 10:05:28.031817 2023] [php7:notice] [pid 165] [client 172.18.0.3:45118] Calling reva/sciencemesh/create-share {"sourcePath":"\\/home\\/oc-to-nc\\/","targetPath":"\\/oc-to-nc\\/","type":"dir","recipientUsername":"einstein","recipientHost":"revanc1.docker","role":"viewer"}
[Thu Jun 15 10:05:28.101914 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] Authenticate
[Thu Jun 15 10:05:28.101928 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] RevaController init
[Thu Jun 15 10:05:28.101932 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] checkRevadAuth
[Thu Jun 15 10:05:28.130692 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] CreateHome
[Thu Jun 15 10:05:28.155310 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] RevaController init
[Thu Jun 15 10:05:28.155323 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] checkRevadAuth
[Thu Jun 15 10:05:28.160558 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] GetMD array (\n  'path' => '/home/oc-to-nc',\n)
[Thu Jun 15 10:05:28.160582 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] Interpreting /home/oc-to-nc as oc-to-nc
[Thu Jun 15 10:05:28.160587 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] Looking for nc path 'oc-to-nc' in user folder; reva path '/home/oc-to-nc' 
[Thu Jun 15 10:05:28.163348 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] User folder /marie/files has: /marie/files/oc-to-nc,/marie/files/welcome.txt
[Thu Jun 15 10:05:28.192249 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] RevaController init
[Thu Jun 15 10:05:28.192262 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] checkRevadAuth
[Thu Jun 15 10:05:28.196259 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] GetMD array (\n  'resource_id' => \n  array (\n    'storage_id' => '00000000-0000-0000-0000-000000000000',\n    'opaque_id' => 'fileid-/home/oc-to-nc',\n  ),\n)
[Thu Jun 15 10:05:28.196281 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] Interpreting /home/oc-to-nc as oc-to-nc
[Thu Jun 15 10:05:28.196621 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] Looking for nc path 'oc-to-nc' in user folder; reva path '' 
[Thu Jun 15 10:05:28.199926 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] User folder /marie/files has: /marie/files/oc-to-nc,/marie/files/welcome.txt
[Thu Jun 15 10:05:28.223775 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] RevaController init
[Thu Jun 15 10:05:28.223795 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] checkRevadAuth
[Thu Jun 15 10:05:28.228650 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] addSentShare array (\n  'userId' => 'marie',\n  '_route' => 'sciencemesh.reva.addSentShare',\n  'resourceId' => \n  array (\n    'storageId' => '00000000-0000-0000-0000-000000000000',\n    'opaqueId' => 'fileid-/home/oc-to-nc',\n  ),\n  'name' => 'oc-to-nc',\n  'token' => 'gwNrGJ8Tmau1YbxmBdj5OZj7SMRCgUKK',\n  'grantee' => \n  array (\n    'type' => 'GRANTEE_TYPE_USER',\n    'userId' => \n    array (\n      'idp' => 'revanc1.docker',\n      'opaqueId' => 'einstein',\n    ),\n  ),\n  'owner' => \n  array (\n    'idp' => 'https://revaoc2.docker/',\n    'opaqueId' => 'marie',\n  ),\n  'creator' => \n  array (\n    'idp' => 'https://revaoc2.docker/',\n    'opaqueId' => 'marie',\n  ),\n  'ctime' => \n  array (\n    'seconds' => '1686823528',\n    'nanos' => 202353407,\n  ),\n  'mtime' => \n  array (\n    'seconds' => '1686823528',\n    'nanos' => 202353407,\n  ),\n  'shareType' => 'SHARE_TYPE_USER',\n  'accessMethods' => \n  array (\n    0 => \n    array (\n      'webdavOptions' => \n      array (\n        'permissions' => \n        array (\n          'getPath' => true,\n          'getQuota' => true,\n          'initiateFileDownload' => true,\n          'listGrants' => true,\n          'listContainer' => true,\n          'listFileVersions' => true,\n          'listRecycle' => true,\n          'stat' => true,\n        ),\n      ),\n    ),\n    1 => \n    array (\n      'webappOptions' => \n      array (\n        'viewMode' => 'VIEW_MODE_READ_ONLY',\n      ),\n    ),\n  ),\n)
[Thu Jun 15 10:05:28.228683 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] Interpreting /home/oc-to-nc as oc-to-nc
[Thu Jun 15 10:05:28.228931 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] calling newShare
[Thu Jun 15 10:05:28.232569 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] SMSP: createInternal
[Thu Jun 15 10:05:28.232587 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] shareWith [email protected]
[Thu Jun 15 10:05:28.232594 2023] [php7:notice] [pid 169] [client 172.18.0.10:37596] checking if already shared oc-to-nc
172.18.0.10 - - [15/Jun/2023:10:05:28 +0000] "POST /index.php/apps/sciencemesh/~marie/api/auth/Authenticate HTTP/1.1" 200 2911 "-" "Go-http-client/1.1"
172.18.0.10 - - [15/Jun/2023:10:05:28 +0000] "POST /index.php/apps/sciencemesh/~marie/api/storage/CreateHome HTTP/1.1" 200 1040 "-" "Go-http-client/1.1"
172.18.0.10 - - [15/Jun/2023:10:05:28 +0000] "POST /index.php/apps/sciencemesh/~marie/api/storage/GetMD HTTP/1.1" 200 1579 "-" "Go-http-client/1.1"
172.18.0.10 - - [15/Jun/2023:10:05:28 +0000] "POST /index.php/apps/sciencemesh/~marie/api/storage/GetMD HTTP/1.1" 200 1575 "-" "Go-http-client/1.1"
172.18.0.10 - - [15/Jun/2023:10:05:28 +0000] "POST /index.php/apps/sciencemesh/~marie/api/ocm/addSentShare HTTP/1.1" 201 1038 "-" "Go-http-client/1.1"
172.18.0.3 - - [15/Jun/2023:10:05:27 +0000] "POST /ocs/v2.php/apps/files_sharing/api/v1/shares?format=json HTTP/1.1" 200 1785 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
172.18.0.3 - - [15/Jun/2023:10:05:28 +0000] "GET /ocs/v2.php/apps/files_sharing/api/v1/shares?format=json&path=%2Foc-to-nc&reshares=true HTTP/1.1" 200 1440 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
172.18.0.3 - - [15/Jun/2023:10:05:28 +0000] "GET /core/img/actions/settings-dark.svg HTTP/1.1" 200 1962 "https://oc2.docker/core/css/icons.css?v=f4d688419cd7ecfcd2b1c7a7b76b4e26" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
172.18.0.3 - - [15/Jun/2023:10:05:28 +0000] "GET /core/img/filetypes/folder-shared.svg HTTP/1.1" 200 1494 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"

OC Reva logs:

2023-06-15 10:05:28.076 WRN ../../workspace/dev-stock/reva/internal/http/interceptors/auth/auth.go:218 > core access token not set pid=117 pkg=rhttp traceid=07ea502ee3fbe32b82af48a5ad1c36b3
2023-06-15 10:05:28.076 DBG ../../workspace/dev-stock/reva/internal/http/interceptors/auth/auth.go:231 > credentials obtained from credential strategy: type: basic, client_id: marie pid=117 pkg=rhttp traceid=07ea502ee3fbe32b82af48a5ad1c36b3
2023-06-15 10:05:28.076 DBG ../../workspace/dev-stock/reva/internal/http/interceptors/auth/auth.go:257 > AuthenticateRequest: type: basic, client_id: marie against revaoc2.docker:19000 pid=117 pkg=rhttp traceid=07ea502ee3fbe32b82af48a5ad1c36b3
2023-06-15 10:05:28.077 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/Authenticate pid=117 pkg=rgrpc traceid=e1d55d179b85c9e7dadbecb6ccd6bbbb
2023-06-15 10:05:28.077 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.auth.registry.v1beta1.RegistryAPI/GetAuthProviders pid=117 pkg=rgrpc traceid=e8025bde9cbc5d62ce821f8ded6003a5
2023-06-15 10:05:28.077 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57044 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=137900 traceid=e8025bde9cbc5d62ce821f8ded6003a5 uri=/cs3.auth.registry.v1beta1.RegistryAPI/GetAuthProviders user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.077 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate pid=117 pkg=rgrpc traceid=b3911856c9db3efc6f58b9748860eb7c
2023-06-15 10:05:28.077 INF ../../workspace/dev-stock/reva/pkg/auth/manager/nextcloud/nextcloud.go:175 > Authenticate marie {"clientID":"marie","clientSecret":"tPJHwKBBXRmwvS6CNSi6dsTXyew4q1ZP"} pid=117 pkg=rgrpc traceid=b3911856c9db3efc6f58b9748860eb7c
2023-06-15 10:05:28.077 INF ../../workspace/dev-stock/reva/pkg/auth/manager/nextcloud/nextcloud.go:126 > am.do https://oc2.docker/index.php/apps/sciencemesh/~marie/api/auth/Authenticate {"clientID":"marie","clientSecret":"tPJHwKBBXRmwvS6CNSi6dsTXyew4q1ZP"} shared-secret-2 pid=117 pkg=rgrpc traceid=b3911856c9db3efc6f58b9748860eb7c
2023-06-15 10:05:28.106 INF ../../workspace/dev-stock/reva/pkg/auth/manager/nextcloud/nextcloud.go:145 > am.do response 200 {"user":{"id":{"idp":"https:\/\/revaoc2.docker\/","opaque_id":"marie"},"display_name":"marie","email":null,"type":1},"scopes":{"user":{"resource":{"decoder":"json","value":"eyJyZXNvdXJjZV9pZCI6eyJzdG9yYWdlX2lkIjoic3RvcmFnZS1pZCIsIm9wYXF1ZV9pZCI6Im9wYXF1ZS1pZCJ9LCJwYXRoIjoic29tZS9maWxlL3BhdGgudHh0In0="},"role":1}}} pid=117 pkg=rgrpc traceid=b3911856c9db3efc6f58b9748860eb7c
2023-06-15 10:05:28.106 INF ../../workspace/dev-stock/reva/internal/grpc/services/authprovider/authprovider.go:153 > user authenticated pid=117 pkg=rgrpc traceid=b3911856c9db3efc6f58b9748860eb7c userId={"idp":"https://revaoc2.docker/","opaque_id":"marie"}
2023-06-15 10:05:28.106 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57050 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=28777338 traceid=b3911856c9db3efc6f58b9748860eb7c uri=/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.107 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57052 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=112190 traceid=472b1d04e9f540d7c66f0f92f1e0d681 uri=/cs3.storage.registry.v1beta1.RegistryAPI/GetStorageProviders user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.107 INF ../../workspace/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:259 > CreateHome pid=117 pkg=rgrpc traceid=7c4d5942b32ed03657610bfce827e976
2023-06-15 10:05:28.107 INF ../../workspace/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:221 > nc.do req https://oc2.docker/index.php/apps/sciencemesh/~marie/api/storage/CreateHome  pid=117 pkg=rgrpc traceid=7c4d5942b32ed03657610bfce827e976
2023-06-15 10:05:28.131 INF ../../workspace/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:240 > nc.do res https://oc2.docker/index.php/apps/sciencemesh/~marie/api/storage/CreateHome "OK" pid=117 pkg=rgrpc traceid=7c4d5942b32ed03657610bfce827e976
2023-06-15 10:05:28.131 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57066 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=23901768 traceid=7c4d5942b32ed03657610bfce827e976 uri=/cs3.storage.provider.v1beta1.ProviderAPI/CreateHome user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.131 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:40348 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=54706016 traceid=e1d55d179b85c9e7dadbecb6ccd6bbbb uri=/cs3.gateway.v1beta1.GatewayAPI/Authenticate user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.132 INF ../../workspace/dev-stock/reva/internal/http/interceptors/auth/auth.go:271 > core access token generated pid=117 pkg=rhttp traceid=07ea502ee3fbe32b82af48a5ad1c36b3
2023-06-15 10:05:28.132 INF ../../workspace/dev-stock/reva/internal/http/interceptors/providerauthorizer/providerauthorizer.go:81 > skipping provider authorizer check for: /sciencemesh/create-share pid=117 pkg=rhttp traceid=07ea502ee3fbe32b82af48a5ad1c36b3
2023-06-15 10:05:28.132 DBG ../../workspace/dev-stock/reva/pkg/rhttp/rhttp.go:305 > http routing: url=sciencemesh pid=117 pkg=rhttp
2023-06-15 10:05:28.132 DBG ../../workspace/dev-stock/reva/internal/http/services/sciencemesh/sciencemesh.go:129 > sciencemesh routing path=/create-share pid=117 pkg=rhttp traceid=07ea502ee3fbe32b82af48a5ad1c36b3
2023-06-15 10:05:28.132 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/Stat pid=117 pkg=rgrpc traceid=d6fe2045338f87f54beeab2cd3bff1ff
2023-06-15 10:05:28.133 DBG ../../workspace/dev-stock/reva/internal/grpc/services/gateway/storageprovider.go:2131 > gateway: split: parts[1]:oc-to-nc != shareFolder:MyShares pid=117 pkg=rgrpc traceid=d6fe2045338f87f54beeab2cd3bff1ff
2023-06-15 10:05:28.133 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57052 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=263970 traceid=e33d6dfd180ed1c813b1233e20c44658 uri=/cs3.storage.registry.v1beta1.RegistryAPI/GetStorageProviders user-agent=
2023-06-15 10:05:28.134 INF ../../workspace/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:327 > GetMD {"ref":{"path":"/home/oc-to-nc"},"mdKeys":null} pid=117 pkg=rgrpc traceid=314c80d9585a2c409ac9c8393200b429
2023-06-15 10:05:28.134 INF ../../workspace/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:221 > nc.do req https://oc2.docker/index.php/apps/sciencemesh/~marie/api/storage/GetMD {"ref":{"path":"/home/oc-to-nc"},"mdKeys":null} pid=117 pkg=rgrpc traceid=314c80d9585a2c409ac9c8393200b429
2023-06-15 10:05:28.165 INF ../../workspace/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:240 > nc.do res https://oc2.docker/index.php/apps/sciencemesh/~marie/api/storage/GetMD {"opaque":{"map":null},"type":2,"id":{"opaque_id":"fileid-\/home\/oc-to-nc"},"checksum":{"type":0,"sum":""},"etag":"deadbeef","mime_type":"folder","mtime":{"seconds":1686823485},"path":"\/home\/oc-to-nc","permission_set":{"add_grant":false,"create_container":false,"delete":false,"get_path":false,"get_quota":false,"initiate_file_download":false,"initiate_file_upload":false},"size":0,"canonical_metadata":{"target":null},"arbitrary_metadata":{"metadata":{".placeholder":"ignore"}},"owner":{"opaque_id":"marie","idp":"https:\/\/revaoc2.docker\/"}} pid=117 pkg=rgrpc traceid=314c80d9585a2c409ac9c8393200b429
2023-06-15 10:05:28.165 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57066 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=31561518 traceid=314c80d9585a2c409ac9c8393200b429 uri=/cs3.storage.provider.v1beta1.ProviderAPI/Stat user-agent=
2023-06-15 10:05:28.166 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:40348 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=33394668 traceid=d6fe2045338f87f54beeab2cd3bff1ff uri=/cs3.gateway.v1beta1.GatewayAPI/Stat user-agent=
2023-06-15 10:05:28.166 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/GetInfoByDomain pid=117 pkg=rgrpc traceid=8a943898205a7486c18fe944280ac573
2023-06-15 10:05:28.167 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57070 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=112450 traceid=eafb5f07765a4a657bf62d37eac60e01 uri=/cs3.ocm.provider.v1beta1.ProviderAPI/GetInfoByDomain user-agent=
2023-06-15 10:05:28.167 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:40348 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=707470 traceid=8a943898205a7486c18fe944280ac573 uri=/cs3.gateway.v1beta1.GatewayAPI/GetInfoByDomain user-agent=
2023-06-15 10:05:28.167 DBG ../../workspace/dev-stock/reva/internal/http/services/sciencemesh/share.go:106 > calling gatewayClient.CreateOCMShare from sciencemesh/share.go pid=117 pkg=rhttp traceid=07ea502ee3fbe32b82af48a5ad1c36b3
2023-06-15 10:05:28.168 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/CreateOCMShare pid=117 pkg=rgrpc traceid=b63f34f1a1924a4ac9fddd7852ab2e91
2023-06-15 10:05:28.169 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/Stat pid=117 pkg=rgrpc traceid=daf0ba7dfbb111528889b614b9c5ff64
2023-06-15 10:05:28.17 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57052 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=133150 traceid=cedb838874ae4a8851433fd452a6bc40 uri=/cs3.storage.registry.v1beta1.RegistryAPI/GetStorageProviders user-agent=
2023-06-15 10:05:28.17 INF ../../workspace/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:327 > GetMD {"ref":{"resource_id":{"storage_id":"00000000-0000-0000-0000-000000000000","opaque_id":"fileid-/home/oc-to-nc"}},"mdKeys":null} pid=117 pkg=rgrpc traceid=dfa6d5320c4bb1911a3047540dc1d329
2023-06-15 10:05:28.17 INF ../../workspace/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:221 > nc.do req https://oc2.docker/index.php/apps/sciencemesh/~marie/api/storage/GetMD {"ref":{"resource_id":{"storage_id":"00000000-0000-0000-0000-000000000000","opaque_id":"fileid-/home/oc-to-nc"}},"mdKeys":null} pid=117 pkg=rgrpc traceid=dfa6d5320c4bb1911a3047540dc1d329
2023-06-15 10:05:28.201 INF ../../workspace/dev-stock/reva/pkg/storage/fs/nextcloud/nextcloud.go:240 > nc.do res https://oc2.docker/index.php/apps/sciencemesh/~marie/api/storage/GetMD {"opaque":{"map":null},"type":2,"id":{"opaque_id":"fileid-\/home\/oc-to-nc"},"checksum":{"type":0,"sum":""},"etag":"deadbeef","mime_type":"folder","mtime":{"seconds":1686823485},"path":"\/home\/oc-to-nc","permission_set":{"add_grant":false,"create_container":false,"delete":false,"get_path":false,"get_quota":false,"initiate_file_download":false,"initiate_file_upload":false},"size":0,"canonical_metadata":{"target":null},"arbitrary_metadata":{"metadata":{".placeholder":"ignore"}},"owner":{"opaque_id":"marie","idp":"https:\/\/revaoc2.docker\/"}} pid=117 pkg=rgrpc traceid=dfa6d5320c4bb1911a3047540dc1d329
2023-06-15 10:05:28.201 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57066 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=31122958 traceid=dfa6d5320c4bb1911a3047540dc1d329 uri=/cs3.storage.provider.v1beta1.ProviderAPI/Stat user-agent=
2023-06-15 10:05:28.202 DBG ../../workspace/dev-stock/reva/internal/grpc/services/gateway/storageprovider.go:2131 > gateway: split: parts[1]:oc-to-nc != shareFolder:MyShares pid=117 pkg=rgrpc traceid=daf0ba7dfbb111528889b614b9c5ff64
2023-06-15 10:05:28.202 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:40348 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=32525828 traceid=daf0ba7dfbb111528889b614b9c5ff64 uri=/cs3.gateway.v1beta1.GatewayAPI/Stat user-agent=
2023-06-15 10:05:28.202 INF ../../workspace/dev-stock/reva/pkg/ocm/share/repository/nextcloud/nextcloud.go:424 > am.do https://oc2.docker/index.php/apps/sciencemesh/~marie/api/ocm/addSentShare {"resourceId":{"storageId":"00000000-0000-0000-0000-000000000000","opaqueId":"fileid-/home/oc-to-nc"},"name":"oc-to-nc","token":"gwNrGJ8Tmau1YbxmBdj5OZj7SMRCgUKK","grantee":{"type":"GRANTEE_TYPE_USER","userId":{"idp":"revanc1.docker","opaqueId":"einstein"}},"owner":{"idp":"https://revaoc2.docker/","opaqueId":"marie"},"creator":{"idp":"https://revaoc2.docker/","opaqueId":"marie"},"ctime":{"seconds":"1686823528","nanos":202353407},"mtime":{"seconds":"1686823528","nanos":202353407},"shareType":"SHARE_TYPE_USER","accessMethods":[{"webdavOptions":{"permissions":{"getPath":true,"getQuota":true,"initiateFileDownload":true,"listGrants":true,"listContainer":true,"listFileVersions":true,"listRecycle":true,"stat":true}}},{"webappOptions":{"viewMode":"VIEW_MODE_READ_ONLY"}}]} pid=117 pkg=rgrpc traceid=d105da767aa1ab5fa1af1bfaad970085
2023-06-15 10:05:28.241 INF ../../workspace/dev-stock/reva/pkg/ocm/share/repository/nextcloud/nextcloud.go:445 > am.do response 201 "1" pid=117 pkg=rgrpc traceid=d105da767aa1ab5fa1af1bfaad970085
2023-06-15 10:05:28.241 DBG ../../workspace/dev-stock/reva/pkg/ocm/client/client.go:200 > Sending OCM /shares POST to https://revanc1.docker/ocm/shares: {"shareWith":"[email protected]","name":"oc-to-nc","description":"","providerId":"\"1\"","owner":"[email protected]","sender":"[email protected]","ownerDisplayName":"","senderDisplayName":"marie","shareType":"user","expiration":0,"resourceType":"folder","protocol":{"name":"multi","options":{},"webapp":{"uriTemplate":"https://cernbox.cern.ch/external/sciencemesh/gwNrGJ8Tmau1YbxmBdj5OZj7SMRCgUKK{relative-path-to-shared-resource}","viewMode":""},"webdav":{"sharedSecret":"gwNrGJ8Tmau1YbxmBdj5OZj7SMRCgUKK","permissions":["read"],"url":"https://oc2.docker/remote.php/dav/ocm/gwNrGJ8Tmau1YbxmBdj5OZj7SMRCgUKK"}}}
 pid=117 pkg=rgrpc traceid=d105da767aa1ab5fa1af1bfaad970085
2023-06-15 10:05:28.385 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:42284 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=215798226 traceid=d105da767aa1ab5fa1af1bfaad970085 uri=/cs3.sharing.ocm.v1beta1.OcmAPI/CreateOCMShare user-agent=
2023-06-15 10:05:28.385 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:40348 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=217044816 traceid=b63f34f1a1924a4ac9fddd7852ab2e91 uri=/cs3.gateway.v1beta1.GatewayAPI/CreateOCMShare user-agent=
2023-06-15 10:05:28.385 DBG ../../workspace/dev-stock/reva/internal/http/services/sciencemesh/share.go:124 > called gatewayClient.CreateOCMShare from sciencemesh/share.go pid=117 pkg=rhttp traceid=07ea502ee3fbe32b82af48a5ad1c36b3
2023-06-15 10:05:28.385 DBG ../../workspace/dev-stock/reva/internal/http/interceptors/log/log.go:108 > http end="15/Jun/2023:10:05:28 +0000" host=172.18.0.12 method=POST pid=117 pkg=rhttp proto=HTTP/2.0 size=860 start="15/Jun/2023:10:05:28 +0000" status=200 time_ns=309184970 traceid=07ea502ee3fbe32b82af48a5ad1c36b3 uri=/sciencemesh/create-share url=/create-share

NC access logs:

172.18.0.7 - - [15/Jun/2023:10:05:28 +0000] "POST /index.php/apps/sciencemesh/~unauthenticated/api/user/GetUser HTTP/1.1" 200 3283 "-" "Go-http-client/1.1"
172.18.0.7 - - [15/Jun/2023:10:05:28 +0000] "POST /index.php/apps/sciencemesh/~einstein/api/ocm/addReceivedShare HTTP/1.1" 201 1579 "-" "Go-http-client/1.1"

NC Reva Logs:

https://nc1.docker/index.php/apps/sciencemesh/~unauthenticated/api/user/GetUser
2023-06-15 10:05:28.244 INF ../../workspace/dev-stock/reva/internal/http/interceptors/auth/auth.go:172 > skipping auth check for: /ocm/shares pid=117 pkg=rhttp traceid=3a9874a70b90d7f9199f580a23d55bae
2023-06-15 10:05:28.244 WRN ../../workspace/dev-stock/reva/internal/http/interceptors/auth/auth.go:218 > core access token not set pid=117 pkg=rhttp traceid=3a9874a70b90d7f9199f580a23d55bae
2023-06-15 10:05:28.244 DBG ../../workspace/dev-stock/reva/internal/http/interceptors/auth/auth.go:227 > error retrieving credentials error="no basic auth provided" pid=117 pkg=rhttp traceid=3a9874a70b90d7f9199f580a23d55bae
2023-06-15 10:05:28.244 DBG ../../workspace/dev-stock/reva/internal/http/interceptors/auth/auth.go:227 > error retrieving credentials error="no bearer auth provided" pid=117 pkg=rhttp traceid=3a9874a70b90d7f9199f580a23d55bae
2023-06-15 10:05:28.244 DBG ../../workspace/dev-stock/reva/internal/http/interceptors/auth/auth.go:227 > error retrieving credentials error="no public token provided" pid=117 pkg=rhttp traceid=3a9874a70b90d7f9199f580a23d55bae
2023-06-15 10:05:28.244 INF ../../workspace/dev-stock/reva/internal/http/interceptors/providerauthorizer/providerauthorizer.go:81 > skipping provider authorizer check for: /ocm/shares pid=117 pkg=rhttp traceid=3a9874a70b90d7f9199f580a23d55bae
2023-06-15 10:05:28.244 DBG ../../workspace/dev-stock/reva/pkg/rhttp/rhttp.go:305 > http routing: url=ocm pid=117 pkg=rhttp
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/internal/http/services/ocmd/ocm.go:111 > ocm routing path=/shares pid=117 pkg=rhttp traceid=3a9874a70b90d7f9199f580a23d55bae
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/internal/http/services/ocmd/shares.go:90 > Determined Mesh Provider 'revaoc2.docker' from req.Sender '[email protected]' pid=117 pkg=rhttp traceid=3a9874a70b90d7f9199f580a23d55bae
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/IsProviderAllowed pid=117 pkg=rgrpc traceid=b4eff7e47fc20d8456de3be7e51c8e7a
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.ocm.provider.v1beta1.ProviderAPI/IsProviderAllowed pid=117 pkg=rgrpc traceid=947da8a4947fcc0050e260c3d877b25b
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/internal/grpc/services/ocmproviderauthorizer/ocmproviderauthorizer.go:123 > is provider 'revaoc2.docker' allowed? pid=117 pkg=rgrpc traceid=947da8a4947fcc0050e260c3d877b25b
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/pkg/ocm/provider/authorizer/json/json.go:147 > Comparing 'revad1.docker' to 'revaoc2.docker' pid=117 pkg=rgrpc traceid=947da8a4947fcc0050e260c3d877b25b
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/pkg/ocm/provider/authorizer/json/json.go:147 > Comparing 'revad2.docker' to 'revaoc2.docker' pid=117 pkg=rgrpc traceid=947da8a4947fcc0050e260c3d877b25b
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/pkg/ocm/provider/authorizer/json/json.go:147 > Comparing 'revanc1.docker' to 'revaoc2.docker' pid=117 pkg=rgrpc traceid=947da8a4947fcc0050e260c3d877b25b
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/pkg/ocm/provider/authorizer/json/json.go:147 > Comparing 'revanc2.docker' to 'revaoc2.docker' pid=117 pkg=rgrpc traceid=947da8a4947fcc0050e260c3d877b25b
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/pkg/ocm/provider/authorizer/json/json.go:147 > Comparing 'revaoc1.docker' to 'revaoc2.docker' pid=117 pkg=rgrpc traceid=947da8a4947fcc0050e260c3d877b25b
2023-06-15 10:05:28.245 DBG ../../workspace/dev-stock/reva/pkg/ocm/provider/authorizer/json/json.go:147 > Comparing 'revaoc2.docker' to 'revaoc2.docker' pid=117 pkg=rgrpc traceid=947da8a4947fcc0050e260c3d877b25b
2023-06-15 10:05:28.246 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57084 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=263260 traceid=947da8a4947fcc0050e260c3d877b25b uri=/cs3.ocm.provider.v1beta1.ProviderAPI/IsProviderAllowed user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.246 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:40340 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=685820 traceid=b4eff7e47fc20d8456de3be7e51c8e7a uri=/cs3.gateway.v1beta1.GatewayAPI/IsProviderAllowed user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.246 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/GetUser pid=117 pkg=rgrpc traceid=7c5aa8fa2503ce90eaaf55f3f78c96d2
2023-06-15 10:05:28.246 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.identity.user.v1beta1.UserAPI/GetUser pid=117 pkg=rgrpc traceid=8aa78f25db587e394ea3360b91cb11ec
2023-06-15 10:05:28.321 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:57098 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=74334695 traceid=8aa78f25db587e394ea3360b91cb11ec uri=/cs3.identity.user.v1beta1.UserAPI/GetUser user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.321 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:40340 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=74950035 traceid=7c5aa8fa2503ce90eaaf55f3f78c96d2 uri=/cs3.gateway.v1beta1.GatewayAPI/GetUser user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.322 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/CreateOCMCoreShare pid=117 pkg=rgrpc traceid=5c95820b650938c7467aa0e112786af8
2023-06-15 10:05:28.323 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.ocm.core.v1beta1.OcmCoreAPI/CreateOCMCoreShare pid=117 pkg=rgrpc traceid=f53bddb499689777adb576c0f413e06f
2023-06-15 10:05:28.323 INF ../../workspace/dev-stock/reva/pkg/ocm/share/repository/nextcloud/nextcloud.go:424 > am.do https://nc1.docker/index.php/apps/sciencemesh/~einstein/api/ocm/addReceivedShare {"name":"oc-to-nc","remoteShareId":"\"1\"","grantee":{"type":"GRANTEE_TYPE_USER","userId":{"idp":"https://revanc1.docker/","opaqueId":"einstein"}},"owner":{"idp":"revaoc2.docker","opaqueId":"marie","type":"USER_TYPE_FEDERATED"},"creator":{"idp":"revaoc2.docker","opaqueId":"marie","type":"USER_TYPE_FEDERATED"},"ctime":{"seconds":"1686823528"},"mtime":{"seconds":"1686823528"},"shareType":"SHARE_TYPE_USER","protocols":[{"webappOptions":{"uriTemplate":"https://cernbox.cern.ch/external/sciencemesh/gwNrGJ8Tmau1YbxmBdj5OZj7SMRCgUKK{relative-path-to-shared-resource}"}},{"webdavOptions":{"sharedSecret":"gwNrGJ8Tmau1YbxmBdj5OZj7SMRCgUKK","permissions":{"permissions":{"getPath":true,"initiateFileDownload":true,"listContainer":true,"stat":true}},"uri":"https://oc2.docker/remote.php/dav/ocm/gwNrGJ8Tmau1YbxmBdj5OZj7SMRCgUKK"}}],"state":"SHARE_STATE_PENDING","resourceType":"RESOURCE_TYPE_CONTAINER"} pid=117 pkg=rgrpc traceid=f53bddb499689777adb576c0f413e06f
2023-06-15 10:05:28.384 INF ../../workspace/dev-stock/reva/pkg/ocm/share/repository/nextcloud/nextcloud.go:445 > am.do response 201 1 pid=117 pkg=rgrpc traceid=f53bddb499689777adb576c0f413e06f
2023-06-15 10:05:28.384 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:42294 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=60602266 traceid=f53bddb499689777adb576c0f413e06f uri=/cs3.ocm.core.v1beta1.OcmCoreAPI/CreateOCMCoreShare user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.384 DBG ../../workspace/dev-stock/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="15/Jun/2023:10:05:28 +0000" from=tcp://127.0.0.1:40340 pid=117 pkg=rgrpc start="15/Jun/2023:10:05:28 +0000" time_ns=62172576 traceid=5c95820b650938c7467aa0e112786af8 uri=/cs3.gateway.v1beta1.GatewayAPI/CreateOCMCoreShare user-agent=grpc-go/1.52.0
2023-06-15 10:05:28.384 DBG ../../workspace/dev-stock/reva/internal/http/interceptors/log/log.go:108 > http end="15/Jun/2023:10:05:28 +0000" host=172.18.0.10 method=POST pid=117 pkg=rhttp proto=HTTP/2.0 size=3 start="15/Jun/2023:10:05:28 +0000" status=201 time_ns=140126731 traceid=3a9874a70b90d7f9199f580a23d55bae uri=/ocm/shares url=/shares
@MahdiBaghbani
Copy link
Member Author

Nextcloud doesn't do anything until accepting the share. ownCloud logs also show no trace of accessing.

After clicking on accept on Nextcloud:

ownCloud access logs:

172.18.0.9 - - [15/Jun/2023:10:16:10 +0000] "GET /ocm-provider/ HTTP/1.1" 200 2815 "-" "Nextcloud Server Crawler"
172.18.0.9 - - [15/Jun/2023:10:16:10 +0000] "POST /index.php/apps/federatedfilesharing/notifications HTTP/1.1" 201 2625 "-" "Nextcloud Server Crawler"
172.18.0.9 - - [15/Jun/2023:10:16:11 +0000] "GET /ocs-provider/ HTTP/1.1" 200 3207 "-" "Nextcloud Server Crawler"
172.18.0.9 - - [15/Jun/2023:10:16:11 +0000] "PROPFIND /public.php/webdav/ HTTP/1.1" 401 2983 "-" "sabre-dav/4.4.0 (http://sabre.io/)"
172.18.0.9 - gwNrGJ8Tmau1YbxmBdj5OZj7SMRCgUKK [15/Jun/2023:10:16:11 +0000] "PROPFIND /public.php/webdav/ HTTP/1.1" 207 1835 "-" "sabre-dav/4.4.0 (http://sabre.io/)"
172.18.0.9 - - [15/Jun/2023:10:16:27 +0000] "GET /ocs-provider/ HTTP/1.1" 200 3187 "-" "Nextcloud Server Crawler"

Nextcloud access logs:

172.18.0.3 - - [15/Jun/2023:10:16:10 +0000] "POST /index.php/apps/files_sharing/api/externalShares HTTP/1.1" 200 1164 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
172.18.0.3 - - [15/Jun/2023:10:16:10 +0000] "PROPFIND /remote.php/dav/files/einstein/ HTTP/1.1" 207 1649 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
172.18.0.3 - - [15/Jun/2023:10:16:11 +0000] "GET /index.php/avatar/[email protected]/32 HTTP/1.1" 404 806 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
172.18.0.3 - - [15/Jun/2023:10:16:11 +0000] "GET /index.php/avatar/marie%40oc2.docker/32 HTTP/1.1" 404 1126 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
172.18.0.3 - - [15/Jun/2023:10:16:11 +0000] "GET /index.php/apps/theming/img/core/filetypes/folder-shared.svg?v=24ffca89 HTTP/1.1" 200 2060 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"

@MahdiBaghbani
Copy link
Member Author

Nextcloud behaviour is different from what Giuseppe has seen via CernBox:

CernBox logs:

167.99.95.2 - - [14/Jun/2023:17:57:24 +0200] "GET /ocm-provider/ HTTP/1.1" 200 429 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [14/Jun/2023:17:57:24 +0200] "GET /ocs-provider/ HTTP/1.1" 200 338 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [14/Jun/2023:17:57:24 +0200] "POST /ocs/v2.php/cloud/shares/182/accept?format=json HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [14/Jun/2023:17:57:25 +0200] "GET /ocs-provider/ HTTP/1.1" 200 338 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [14/Jun/2023:17:57:25 +0200] "PROPFIND /remote.php/dav/ocm/ HTTP/2.0" 401 0 "-" "sabre-dav/4.4.0 (http://sabre.io/)" "-"
167.99.95.2 - - [14/Jun/2023:17:57:25 +0200] "GET /status.php HTTP/1.1" 200 218 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [14/Jun/2023:17:57:25 +0200] "POST /index.php/apps/files_sharing/shareinfo?t=sSPNPOcJkCV8U3AGkjuaBqIsZ88acAqX HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"

@MahdiBaghbani MahdiBaghbani self-assigned this Jun 15, 2023
@MahdiBaghbani MahdiBaghbani changed the title debugging how Nextcloud access remote shares. Debugging how Nextcloud access remote shares. Jun 15, 2023
@MahdiBaghbani
Copy link
Member Author

MahdiBaghbani commented Jun 15, 2023

I found what happens when Nextcloud removes the CernBox share from the db without any warnings.

A detailed report in next comment.

@MahdiBaghbani
Copy link
Member Author

@glpatcern
Copy link

Following all your findings, and as also discussed with @labkode, I would rather propose you @MahdiBaghbani and @michielbdejong a different approach.

AFAIU you can intercept in Nextcloud the "click" from the frontend that requests to browse a federated share, and redirect it to wherever you like. This intercept may well require a patch in Nextcloud core, that's fine. If you hook an action of the nc-sciencemesh app, then you can implement the action by going to the remote reva using the OCM access, as already documented (see e.g. https://github.com/cs3org/OCM-API#share-access). This has multiple advantages:

  1. We stop spending time reverse engineering Nextcloud and patching Reva.
  2. We are future-proof compared to how NC may evolve, given that all those /ocs endpoints are "internal" and subject to change without notice.

Let's discuss that tomorrow over gitter.

@MahdiBaghbani
Copy link
Member Author

MahdiBaghbani commented Jun 16, 2023

Nextcloud code flow for accepting a remote share.

When the share arrives and you decide to accept the share, this function will be called:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/apps/files_sharing/lib/External/Manager.php#L310

/**
 * accept server-to-server share
 *
 * @param int $id
 * @return bool True if the share could be accepted, false otherwise
 */
public
function acceptShare($id)
{
    $share = $this->getShare($id);
    $result = false;

    if ($share) {
        \OC_Util::setupFS($this->uid);
        $shareFolder = Helper::getShareFolder(null, $this->uid);
        $mountPoint = Files::buildNotExistingFileName($shareFolder, $share['name']);
        $mountPoint = Filesystem::normalizePath($mountPoint);
        $hash = md5($mountPoint);
        $userShareAccepted = false;

        if ((int)$share['share_type'] === IShare::TYPE_USER) {
            $acceptShare = $this->connection->prepare('
				UPDATE `*PREFIX*share_external`
				SET `accepted` = ?,
					`mountpoint` = ?,
					`mountpoint_hash` = ?
				WHERE `id` = ? AND `user` = ?');
            $userShareAccepted = $acceptShare->execute([1, $mountPoint, $hash, $id, $this->uid]);
        } else {
            $parentId = (int)$share['parent'];
            if ($parentId !== -1) {
                // this is the sub-share
                $subshare = $share;
            } else {
                $subshare = $this->fetchUserShare($id, $this->uid);
            }

            if ($subshare !== null) {
                try {
                    $acceptShare = $this->connection->prepare('
						UPDATE `*PREFIX*share_external`
						SET `accepted` = ?,
							`mountpoint` = ?,
							`mountpoint_hash` = ?
						WHERE `id` = ? AND `user` = ?');
                    $acceptShare->execute([1, $mountPoint, $hash, $subshare['id'], $this->uid]);
                    $result = true;
                } catch (Exception $e) {
                    $this->logger->emergency('Could not update share', ['exception' => $e]);
                    $result = false;
                }
            } else {
                try {
                    $this->writeShareToDb(
                        $share['remote'],
                        $share['share_token'],
                        $share['password'],
                        $share['name'],
                        $share['owner'],
                        $this->uid,
                        $mountPoint, $hash, 1,
                        $share['remote_id'],
                        $id,
                        $share['share_type']);
                    $result = true;
                } catch (Exception $e) {
                    $this->logger->emergency('Could not create share', ['exception' => $e]);
                    $result = false;
                }
            }
        }
        if ($userShareAccepted !== false) {
            $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept');
            $event = new FederatedShareAddedEvent($share['remote']);
            $this->eventDispatcher->dispatchTyped($event);
            $this->eventDispatcher->dispatchTyped(new Files\Events\InvalidateMountCacheEvent($this->userManager->get($this->uid)));
            $result = true;
        }
    }

    // Make sure the user has no notification for something that does not exist anymore.
    $this->processNotification($id);

    return $result;
}

This line is important, it calls the end API endpoint to notify the remote server about the share being accepted:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/apps/files_sharing/lib/External/Manager.php#L374

$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept');

This function is here:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/apps/files_sharing/lib/External/Manager.php#L467

/**
 * inform remote server whether server-to-server share was accepted/declined
 *
 * @param string $remote
 * @param string $token
 * @param string $remoteId Share id on the remote host
 * @param string $feedback
 * @return boolean
 */
private function sendFeedbackToRemote($remote, $token, $remoteId, $feedback) {
    $result = $this->tryOCMEndPoint($remote, $token, $remoteId, $feedback);

    if (is_array($result)) {
        return true;
    }

    $federationEndpoints = $this->discoveryService->discover($remote, 'FEDERATED_SHARING');
    $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares';

    $url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . Share::RESPONSE_FORMAT;
    $fields = ['token' => $token];

    $client = $this->clientService->newClient();

    try {
        $response = $client->post(
            $url,
            [
                'body' => $fields,
                'connect_timeout' => 10,
            ]
        );
    } catch (\Exception $e) {
        return false;
    }

    $status = json_decode($response->getBody(), true);

    return ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200);
}

At this line, it tries the ocm endpoint first:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/apps/files_sharing/lib/External/Manager.php#L468

$result = $this->tryOCMEndPoint($remote, $token, $remoteId, $feedback);

Which is this function:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/apps/files_sharing/lib/External/Manager.php#L508

/**
 * try send accept message to ocm end-point
 *
 * @param string $remoteDomain
 * @param string $token
 * @param string $remoteId id of the share
 * @param string $feedback
 * @return array|false
 */
protected function tryOCMEndPoint($remoteDomain, $token, $remoteId, $feedback) {
    switch ($feedback) {
        case 'accept':
            $notification = $this->cloudFederationFactory->getCloudFederationNotification();
            $notification->setMessage(
                'SHARE_ACCEPTED',
                'file',
                $remoteId,
                [
                    'sharedSecret' => $token,
                    'message' => 'Recipient accept the share'
                ]

            );
            return $this->cloudFederationProviderManager->sendNotification($remoteDomain, $notification);
        case 'decline':
            $notification = $this->cloudFederationFactory->getCloudFederationNotification();
            $notification->setMessage(
                'SHARE_DECLINED',
                'file',
                $remoteId,
                [
                    'sharedSecret' => $token,
                    'message' => 'Recipient declined the share'
                ]

            );
            return $this->cloudFederationProviderManager->sendNotification($remoteDomain, $notification);
    }

    return false;
}

Then in this line, it calls the send notification function:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/apps/files_sharing/lib/External/Manager.php#L522

return $this->cloudFederationProviderManager->sendNotification($remoteDomain, $notification);

Which is located here:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/lib/private/Federation/CloudFederationProviderManager.php#L170

/**
 * @param string $url
 * @param ICloudFederationNotification $notification
 * @return array|false
 */
public function sendNotification($url, ICloudFederationNotification $notification) {
    $ocmEndPoint = $this->getOCMEndPoint($url);

    if (empty($ocmEndPoint)) {
        return false;
    }

    $client = $this->httpClientService->newClient();
    try {
        $response = $client->post($ocmEndPoint . '/notifications', [
            'body' => json_encode($notification->getMessage()),
            'headers' => ['content-type' => 'application/json'],
            'timeout' => 10,
            'connect_timeout' => 10,
        ]);
        if ($response->getStatusCode() === Http::STATUS_CREATED) {
            $result = json_decode($response->getBody(), true);
            return (is_array($result)) ? $result : [];
        }
    } catch (\Exception $e) {
        // log the error and return false
        $this->logger->error('error while sending notification for federated share: ' . $e->getMessage(), ['exception' => $e]);
    }

    return false;
}

In above function it calls this function first:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/lib/private/Federation/CloudFederationProviderManager.php#L171

$ocmEndPoint = $this->getOCMEndPoint($url);

Which is:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/lib/private/Federation/CloudFederationProviderManager.php#L211

/**
 * check if server supports the new OCM api and ask for the correct end-point
 *
 * @param string $url full base URL of the cloud server
 * @return string
 */
protected function getOCMEndPoint($url) {
    if (isset($this->ocmEndPoints[$url])) {
        return $this->ocmEndPoints[$url];
    }

    $client = $this->httpClientService->newClient();
    try {
        $response = $client->get($url . '/ocm-provider/', ['timeout' => 10, 'connect_timeout' => 10]);
    } catch (\Exception $e) {
        $this->ocmEndPoints[$url] = '';
        return '';
    }

    $result = $response->getBody();
    $result = json_decode($result, true);

    $supportedVersion = isset($result['apiVersion']) && $result['apiVersion'] === $this->supportedAPIVersion;

    if (isset($result['endPoint']) && $supportedVersion) {
        $this->ocmEndPoints[$url] = $result['endPoint'];
        return $result['endPoint'];
    }

    $this->ocmEndPoints[$url] = '';
    return '';
}

This is the function responsible for the first ocm-provider call in both ownCloud and CERNBox
in
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/lib/private/Federation/CloudFederationProviderManager.php#L218

$response = $client->get($url . '/ocm-provider/', ['timeout' => 10, 'connect_timeout' => 10]

ownCloud:

172.18.0.9 - - [15/Jun/2023:10:16:10 +0000] "GET /ocm-provider/ HTTP/1.1" 200 2815 "-" "Nextcloud Server Crawler"

CERNBox

167.99.95.2 - - [14/Jun/2023:17:57:24 +0200] "GET /ocm-provider/ HTTP/1.1" 200 429 "-" "Nextcloud Server Crawler" "-"

Now the first culprit responsible for failing to access the share from CERNBox is here in line:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/lib/private/Federation/CloudFederationProviderManager.php#L227

SupportedVersion = isset($result['apiVersion']) && $result['apiVersion'] === $this->supportedAPIVersion;

It checks apiVersion against a hardcoded version defined here:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/lib/private/Federation/CloudFederationProviderManager.php#LL62C3-L62C49

private $supportedAPIVersion = '1.0-proposal1';

When the version doesn't match, Nextcloud will simply return an empty string:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/lib/private/Federation/CloudFederationProviderManager.php#L235

return '';

Then the sendNotification function will return false:
https://github.com/nextcloud/server/blob/f815190afae7ce8a62cd7d4087d35f573a06c2eb/lib/private/Federation/CloudFederationProviderManager.php#L173

return false;

This where @glpatcern wants to know about:
So why when Giuseppe changed the version, it still didn't work?
now comes the second culprit:
https://github.com/nextcloud/server/blob/7afcc44827333683dc104cc9701963151d22946a/lib/private/Federation/CloudFederationProviderManager.php#L60

/** @var array cache OCM end-points */
	private $ocmEndPoints = [];

It uses cache 😄

if it finds ocm endpoint add it to the cache:
https://github.com/nextcloud/server/blob/7afcc44827333683dc104cc9701963151d22946a/lib/private/Federation/CloudFederationProviderManager.php#L229-L232

if (isset($result['endPoint']) && $supportedVersion) {
    $this->ocmEndPoints[$url] = $result['endPoint'];
    return $result['endPoint'];
}

if not it will add an empty string:
https://github.com/nextcloud/server/blob/7afcc44827333683dc104cc9701963151d22946a/lib/private/Federation/CloudFederationProviderManager.php#L234

this->ocmEndPoints[$url] = '';

and in consecutive calls, it just looks at the cache:
https://github.com/nextcloud/server/blob/7afcc44827333683dc104cc9701963151d22946a/lib/private/Federation/CloudFederationProviderManager.php#L212

if (isset($this->ocmEndPoints[$url])) {
    return $this->ocmEndPoints[$url];
}

Now back to the debugging:
if ocm succeeds, in ownCloud case, it will call the sendNotification, and then actually sends the notification in:
https://github.com/nextcloud/server/blob/7afcc44827333683dc104cc9701963151d22946a/lib/private/Federation/CloudFederationProviderManager.php#L179-L184

$response = $client->post($ocmEndPoint . '/notifications', [
    'body' => json_encode($notification->getMessage()),
    'headers' => ['content-type' => 'application/json'],
    'timeout' => 10,
    'connect_timeout' => 10,
]);

which maps to this ownCloud access log:

172.18.0.9 - - [15/Jun/2023:10:16:10 +0000] "POST /index.php/apps/federatedfilesharing/notifications HTTP/1.1" 201 2625 "-" "Nextcloud Server Crawler"

@MahdiBaghbani
Copy link
Member Author

MahdiBaghbani commented Jun 20, 2023

this function checkStorageAvailability

is being called here:
https://github.com/nextcloud/server/blob/358ce60b1003fd6b00e26dc046466b60d423a25d/apps/files_sharing/lib/External/Scanner.php#L33-L71

class Scanner extends \OC\Files\Cache\Scanner {
	/** @var \OCA\Files_Sharing\External\Storage */
	protected $storage;

	public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
		// Disable locking for federated shares
		parent::scan($path, $recursive, $reuse, false);
	}

	/**
	 * Scan a single file and store it in the cache.
	 * If an exception happened while accessing the external storage,
	 * the storage will be checked for availability and removed
	 * if it is not available any more.
	 *
	 * @param string $file file to scan
	 * @param int $reuseExisting
	 * @param int $parentId
	 * @param array | null $cacheData existing data in the cache for the file to be scanned
	 * @param bool $lock set to false to disable getting an additional read lock during scanning
	 * @return array | null an array of metadata of the scanned file
	 */
	public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) {
		try {
			return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock, $data);
		} catch (ForbiddenException $e) {
			$this->storage->checkStorageAvailability();
		} catch (NotFoundException $e) {
			// if the storage isn't found, the call to
			// checkStorageAvailable() will verify it and remove it
			// if appropriate
			$this->storage->checkStorageAvailability();
		} catch (StorageInvalidException $e) {
			$this->storage->checkStorageAvailability();
		} catch (StorageNotAvailableException $e) {
			$this->storage->checkStorageAvailability();
		}
	}
}

@MahdiBaghbani
Copy link
Member Author

Nextcloud accessing ownCloud is like this:
https://github.com/nextcloud/server/blob/b961171b600c05b0a6abae4cadd5dd5df7eec3c3/build/integration/features/auth.feature#L39-L67

# WebDAV
	Scenario: using WebDAV anonymously
		When requesting "/remote.php/webdav" with "PROPFIND"
		Then the HTTP status code should be "401"

	Scenario: using WebDAV with basic auth
		When requesting "/remote.php/webdav" with "PROPFIND" using basic auth
		Then the HTTP status code should be "207"

	Scenario: using WebDAV with unrestricted basic token auth
		When requesting "/remote.php/webdav" with "PROPFIND" using unrestricted basic token auth
		Then the HTTP status code should be "207"

	Scenario: using WebDAV with restricted basic token auth
		When requesting "/remote.php/webdav" with "PROPFIND" using restricted basic token auth
		Then the HTTP status code should be "207"

	Scenario: using old WebDAV endpoint with unrestricted client token
		When requesting "/remote.php/webdav" with "PROPFIND" using an unrestricted client token
		Then the HTTP status code should be "207"

	Scenario: using new WebDAV endpoint with unrestricted client token
		When requesting "/remote.php/dav/" with "PROPFIND" using an unrestricted client token
		Then the HTTP status code should be "207"

	Scenario: using WebDAV with browser session
		Given a new browser session is started
		When requesting "/remote.php/webdav" with "PROPFIND" using browser session
		Then the HTTP status code should be "207"

first a 401 then 207

but it doesn't happen when trying to access CERNBox. just single 401.

@MahdiBaghbani
Copy link
Member Author

After fixing API version with Giuseppe we came to new logs in Nextcloud and CERNBox:

Nextcloud extra logs:

[Fri Jun 16 15:45:13.357822 2023] [php:notice] [pid 624] [client 192.248.171.117:51186] NEXTCLOUD ExternalSharesController create share
[Fri Jun 16 15:45:13.389093 2023] [php:notice] [pid 624] [client 192.248.171.117:51186] NEXTCLOUD getOCMEndPoint Start
[Fri Jun 16 15:45:13.389208 2023] [php:notice] [pid 624] [client 192.248.171.117:51186] NEXTCLOUD getOCMEndPoint try to get
[Fri Jun 16 15:45:13.609152 2023] [php:notice] [pid 624] [client 192.248.171.117:51186] NEXTCLOUD getOCMEndPoint results:array (\n  'enabled' => true,\n  'apiVersion' => '1.0-proposal1',\n  'endPoint' => 'https://sm2.cernbox.cern.ch/ocm',\n  'provider' => 'CERNBox',\n  'resourceTypes' => \n  array (\n    0 => \n    array (\n      'name' => 'file',\n      'shareTypes' => \n      array (\n        0 => 'user',\n      ),\n      'protocols' => \n      array (\n        'webapp' => '/external/sciencemesh/',\n        'webdav' => '/remote.php/dav/ocm/',\n      ),\n    ),\n  ),\n  'capabilities' => \n  array (\n    0 => '/invite-accepted',\n  ),\n)
[Fri Jun 16 15:45:13.609295 2023] [php:notice] [pid 624] [client 192.248.171.117:51186] NEXTCLOUD getOCMEndPoint returns endpoint
[Fri Jun 16 15:45:14.165221 2023] [php:notice] [pid 624] [client 192.248.171.117:51186] NEXTCLOUD after sendFeedbackToRemote
[Fri Jun 16 15:45:14.165743 2023] [php:notice] [pid 624] [client 192.248.171.117:51186] NEXTCLOUD after FederatedShareAddedEvent
[Fri Jun 16 15:45:14.165782 2023] [php:notice] [pid 624] [client 192.248.171.117:51186] NEXTCLOUD after dispatchTyped($event)
[Fri Jun 16 15:45:14.165893 2023] [php:notice] [pid 624] [client 192.248.171.117:51186] NEXTCLOUD after Files\\Events\\InvalidateMountCacheEvent

CERNBox logs:

167.99.95.2 - - [16/Jun/2023:17:45:13 +0200] "GET /ocm-provider/ HTTP/1.1" 200 437 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:17:45:13 +0200] "POST /ocm/notifications HTTP/1.1" 404 19 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:17:45:13 +0200] "GET /ocs-provider/ HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:17:45:14 +0200] "POST /ocs/v2.php/cloud/shares/187/accept?format=json HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:17:45:14 +0200] "GET /ocs-provider/ HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:17:45:14 +0200] "PROPFIND /public.php/webdav/ HTTP/2.0" 401 0 "-" "sabre-dav/4.4.0 (http://sabre.io/)" "-"
167.99.95.2 - - [16/Jun/2023:17:45:15 +0200] "GET /status.php HTTP/1.1" 200 218 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:17:45:15 +0200] "POST /index.php/apps/files_sharing/shareinfo?t=LGp9cy6gIaN9scqlKbn99p79ylDaqgkG HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"

@MahdiBaghbani
Copy link
Member Author

MahdiBaghbani commented Jun 21, 2023

This problem:

167.99.95.2 - - [16/Jun/2023:17:45:13 +0200] "POST /ocm/notifications HTTP/1.1" 404 19 "-" "Nextcloud Server Crawler" "-"

Has been fixed by Giuseppe returning the STATUS_CREATED (201) to the notification.

This is what Nextcloud sends to /notifications endpoint:

{
  "notificationType": "SHARE_ACCEPTED",
  "resourceType": "file",
  "providerId": "191",
  "notification": {
    "sharedSecret": "3V8XxPPHIo9XGkPdthICsgQuFQVNeq0T",
    "message": "Recipient accept the share"
  }
}

CERNBox logs:

167.99.95.2 - - [16/Jun/2023:18:06:53 +0200] "GET /ocm-provider/ HTTP/1.1" 200 437 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:18:06:53 +0200] "POST /ocm/notifications HTTP/1.1" 201 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:18:06:54 +0200] "GET /ocs-provider/ HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:18:06:54 +0200] "PROPFIND /public.php/webdav/ HTTP/2.0" 401 0 "-" "sabre-dav/4.4.0 (http://sabre.io/)" "-"
167.99.95.2 - - [16/Jun/2023:18:06:54 +0200] "GET /status.php HTTP/1.1" 200 218 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:18:06:54 +0200] "POST /index.php/apps/files_sharing/shareinfo?t=11GUVqGhbq1EWHUvRvj2kM2fDOwTrWt9 HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"

as seen in new logs, Nextcloud doesn't go to this anymore:

167.99.95.2 - - [16/Jun/2023:17:45:13 +0200] "GET /ocs-provider/ HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:17:45:14 +0200] "POST /ocs/v2.php/cloud/shares/187/accept?format=json HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"

yet the problem still exists:

167.99.95.2 - - [16/Jun/2023:17:45:14 +0200] "GET /ocs-provider/ HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [16/Jun/2023:17:45:14 +0200] "PROPFIND /public.php/webdav/ HTTP/2.0" 401 0 "-" "sabre-dav/4.4.0 (http://sabre.io/)" "-"

as seen oc-provider gives 401 because it doesn't exist and Nextcloud reverts to default /public.php/webdav/ on propfind! although ocm-provider exists with the right value for webdav.

curl https://sm1.cernbox.cern.ch/ocm-provider --user-agent "Nextcloud Server Crawler"
{
   "enabled": true,
   "apiVersion": "1.0-proposal1",
   "endPoint": "https://sm1.cernbox.cern.ch/ocm",
   "provider": "CERNBox",
   "resourceTypes": [
      {
         "name": "file",
         "shareTypes": [
            "user"
         ],
         "protocols": {
            "webapp": "/external/sciencemesh/",
            "webdav": "/remote.php/dav/ocm/"
         }
      }
   ],
   "capabilities": [
      "/invite-accepted"
   ]
}

So after Giuseppe added ocs-provider to CERNBox we came to this:

CERNBox ocs-provider:

{
   "version": 2,
   "services": {
      "PRIVATE_DATA": {
         "endpoints": {},
         "version": 1
      },
      "SHARING": {
         "endpoints": {},
         "version": 1
      },
      "FEDERATED_SHARING": {
         "endpoints": {
            "share": "/remote.php/dav/ocm/",
            "webdav": "/remote.php/dav/ocm/"
         },
         "version": 1
      },
      "PROVISIONING": {
         "endpoints": {},
         "version": 1
      }
   }
}

CERNBox logs:

167.99.95.2 - - [19/Jun/2023:09:17:28 +0200] "GET /ocm-provider/ HTTP/1.1" 200 437 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [19/Jun/2023:09:17:28 +0200] "POST /ocm/notifications HTTP/1.1" 201 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [19/Jun/2023:09:17:29 +0200] "GET /ocs-provider/ HTTP/1.1" 200 465 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [19/Jun/2023:09:17:29 +0200] "PROPFIND /remote.php/dav/ocm/ HTTP/2.0" 401 0 "-" "sabre-dav/4.4.0 (http://sabre.io/)" "-"
167.99.95.2 - - [19/Jun/2023:09:17:29 +0200] "GET /status.php HTTP/1.1" 200 218 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [19/Jun/2023:09:17:30 +0200] "POST /index.php/apps/files_sharing/shareinfo?t=3V8XxPPHIo9XGkPdthICsgQuFQVNeq0T HTTP/1.1" 401 0 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [19/Jun/2023:09:17:30 +0200] "GET /ocm-provider/ HTTP/1.1" 200 437 "-" "Nextcloud Server Crawler" "-"
167.99.95.2 - - [19/Jun/2023:09:17:30 +0200] "POST /ocm/notifications HTTP/1.1" 201 0 "-" "Nextcloud Server Crawler" "-"

now it uses the right endpoint for PROPFIND but fails again on PROPFIND and doesn't go to the second PROPFIND with token.

Problems:

  1. Nextcloud doesn't get the webdav endpoint from ocm-provider and tries ocs-provider
  2. after 401 on the first anonymous PROPFIND, Nextcloud doesn't try the second PROPFIND with a token (like when it does with ownCloud).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants