Skip to content

Commit 0655bee

Browse files
committed
Added ssh as protocol for shares. Fixes #277
1 parent cc397aa commit 0655bee

File tree

2 files changed

+72
-14
lines changed

2 files changed

+72
-14
lines changed

IETF-RFC.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -607,22 +607,23 @@ contain the following information about its OCM API:
607607
support at least `webdav`,
608608
any other combination of Resources and protocols is
609609
optional. Example:
610-
`json
610+
```json
611611
{
612612
"webdav": "/remote/dav/ocm/",
613613
"webapp": "/app/ocm/",
614614
"talk": "/apps/spreed/api/"
615615
}
616-
`
616+
```
617617
Fields:
618618
- webdav (string) - The top-level WebDAV [RFC4918] path at this
619619
endpoint. In order to access a Remote Resource, implementations
620-
MAY use this path as a prefix, or as the full path (see sharing
621-
examples).
620+
SHOULD use this path as a prefix (see sharing examples).
622621
- webapp (string) - The top-level path for web apps at this
623-
endpoint. This value is provided for documentation
624-
purposes, and it SHOULD NOT be intended as a prefix
625-
for share requests.
622+
endpoint. In order to access a remote web app, implementations
623+
SHOULD use this path as a prefix (see sharing examples).
624+
- ssh (string) - The top-level address in the form `host:port`
625+
of an endpoint that supports ssh and scp with a public/private
626+
key based authentication.
626627
- Any additional protocol supported for this Resource type MAY be
627628
advertised here, where the value MAY correspond to
628629
a top-level URI to be used for that protocol.
@@ -770,7 +771,8 @@ To create a Share, the Sending Server SHOULD make a HTTP POST request
770771
* REQUIRED protocol (object)
771772
JSON object with specific options for each protocol.
772773
The supported protocols are: - `webdav`, to access the data -
773-
`webapp`, to access remote web applications.
774+
`webapp`, to access remote web applications - `ssh`, to access
775+
the data via a public/private key pair.
774776
Other custom protocols might be added in the future.
775777
In case a single protocol is offered, there are three ways to
776778
specify this object:
@@ -854,6 +856,21 @@ To create a Share, the Sending Server SHOULD make a HTTP POST request
854856
- OPTIONAL sharedSecret (string)
855857
An optional secret to be used to access the remote
856858
web app, for example in the form of a bearer token.
859+
* Protocol details for `ssh` MAY contain:
860+
- OPTIONAL accessType (array of strings) - The type of access
861+
being granted to the remote resource. If omitted, it defaults to
862+
`['remote']`. A subset of: - `remote` signals the recipient that
863+
the resource is available for remote access, e.g. via sshfs.
864+
- `datatx` signals the recipient to transfer the resource
865+
from the given URI via scp. The recipient MAY delegate a
866+
third-party service to execute the data transfer on their behalf.
867+
- REQUIRED uri (string)
868+
The full address to be used for ssh or scp access, in the form
869+
`[email protected]:port/resource/path`, where authentication is
870+
expected to take place via public/private key: the Receiving Server
871+
MUST reply to such a Share Creation Notification by sending back
872+
their public key, for the Sender Server to authorize access to the
873+
Resource.
857874

858875
## Response
859876

@@ -866,6 +883,9 @@ A 201 response status means the Share Creation Notification Request was
866883
successful. In this case, the response body MUST contain a JSON
867884
document representing an object with the following string fields:
868885
- REQUIRED: `recipientDisplayName` - the Recipient's display name.
886+
- OPTIONAL: `recipientPublicKey` - the Recipient's public key.
887+
This property MUST be returned when the protocol of the incoming
888+
share was `ssh`.
869889
A 400 response status means some parameters were invalid or missing.
870890
A 401 response status means the Sender cannot be authenticated as
871891
a trusted service.

spec.yaml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,14 @@ paths:
7272
properties:
7373
recipientDisplayName:
7474
type: string
75-
description: display name of the recipient
75+
description: >
76+
Display name of the recipient
7677
example: John Doe
78+
recipientPublicKey:
79+
type: string
80+
description: >
81+
The public key of the recipient. This value MUST be provided
82+
in case the Share Creation Notification includes the `ssh` protocol.
7783
"400":
7884
description: >
7985
Bad request due to invalid parameters, e.g. when `shareWith` is not
@@ -83,26 +89,26 @@ paths:
8389
schema:
8490
$ref: "#/components/schemas/400"
8591
"401":
86-
description: Client cannot be authenticated as a trusted service.
92+
description: Sender cannot be authenticated as a trusted service.
8793
content:
8894
application/json:
8995
schema:
9096
$ref: "#/components/schemas/Error"
9197
"403":
92-
description: Trusted service is not authorized to create shares.
98+
description: Sender is not authorized to create shares.
9399
content:
94100
application/json:
95101
schema:
96102
$ref: "#/components/schemas/Error"
97103
"501":
98-
description: The consumer doesn't support incoming external shares, the share
104+
description: The Receiver doesn't support incoming external shares, the share
99105
type or the resource type is not supported.
100106
content:
101107
application/json:
102108
schema:
103109
$ref: "#/components/schemas/Error"
104110
"503":
105-
description: The consumer is temporary unavailable (e.g. due to planned
111+
description: The Receiver is temporary unavailable (e.g. due to planned
106112
maintenance).
107113
headers:
108114
Retry-After:
@@ -388,6 +394,12 @@ components:
388394
The top-level path for web apps at this endpoint. In order to
389395
access a remote web app, implementations SHOULD use this path
390396
as a prefix (see sharing examples).
397+
ssh:
398+
type: string
399+
description: >
400+
The top-level address in the form `host:port` of an endpoint
401+
that supports ssh and scp with a public/private key based
402+
authentication.
391403
additionalProperties:
392404
type: string
393405
description: >
@@ -688,7 +700,30 @@ components:
688700
in any URI. In a multi-protocol share scenario with WebDAV, the
689701
access requirements provided in the `webdav` part MUST apply for
690702
`webapp` accesses as well.
691-
703+
ssh:
704+
type: object
705+
properties:
706+
accessType:
707+
type: array
708+
description: >
709+
The type of access being granted to the remote resource.
710+
If omitted, it defaults to `['remote']`.
711+
- `remote` signals the recipient that the resource is available
712+
for remote access, e.g. via sshfs.
713+
- `datatx` signals the recipient to transfer the resource from
714+
the given URI via scp. The recipient MAY delegate a third-party
715+
service to execute the data transfer on their behalf.
716+
items:
717+
type: string
718+
enum:
719+
- remote
720+
- datatx
721+
uri:
722+
type: string
723+
description: >
724+
The full address to be used for ssh or scp access, in the form
725+
`[email protected]:port/resource/path`, where authentication is
726+
expected to take place via public/private key.
692727
additionalProperties:
693728
type: object
694729
description: >
@@ -724,6 +759,9 @@ components:
724759
uri: 7c084226-d9a1-11e6-bf26-cec0c932ce01
725760
sharedSecret: hfiuhworzwnur98d3wjiwhr
726761
viewMode: read
762+
ssh:
763+
accessType: ['datatx']
764+
uri: [email protected]:/7c084226-d9a1-11e6-bf26-cec0c932ce01
727765
NewNotification:
728766
type: object
729767
required:

0 commit comments

Comments
 (0)