CollaboraOnline / online

Collabora Online is a collaborative online office suite based on LibreOffice technology. This is also the source for the Collabora Office apps for iOS and Android.
https://collaboraonline.com
Other
1.85k stars 701 forks source link

Shared secret for the Remote config #5076

Open kendy opened 2 years ago

kendy commented 2 years ago

To be able to add access token for the convert-to endpoint, it is necessary to setup trusted communication between the COOL and integration for Remote config.

The idea is that the Remote config URL will contain a token, that will be then used while requesting the Remote config from the integration.

Then - this remote config will define a token for the the convert-to endpoint.

@juliushaertl: Please do you have a preferred format for those URL's / tokens?

juliusknorr commented 1 year ago

I've been thinking about this one a bit more especially in terms of making the setup and connection to Nextcloud easier.

My proposal would actually be to have just a shared secret which could then be used to set the remote configuration from the Nextcloud side. Considering adding an endpoint to set the remote config url from outside, providing the shared secret it would be possible to have a very easy setup flow:

This saves the following steps:

@pedropintosilva Who would be the best from your side to check if such an approach makes sense to you?

eszkadev commented 1 year ago

cc @Rash419

mmeeks commented 1 year ago

@juliushaertl can you outline how the shared secret is exchanged ? =) how does Nextcloud verify this ? do we transfer the secret, or a crypted version of that ? or ... If we want to verify that a message is coming from COOL to Nextcloud - we should use the existing X-WOPI-Proof-key mechanism that handes timestamps, and crypto properly - we shouldn't invent a new mechanism I think. If we want to verify that COOL is connecting to the right Nextcloud server then we could of course have a key there; but I guess I'd really prefer Nextcloud to verify proof on a request for configuration from COOL - and then pass whatever secrets are needed across an https:// channel to COOL to pass back later (?) =) that'd help making cluster admin easier I guess. @Rash419 not sure how WOPI-proof key distribution over a cluster works currently though :-)

juliusknorr commented 1 year ago

As far as I remember proof key handling would only allow verifying that the WOPI requests originate from the Collabora server when it calls the Nextcloud server. The secret here would be for requests towards the other direction which is nothing that the WOPI standard currently covers. I'd rather stick to a simple secret for that as setting up crypto keys might be yet another hurdle for average admins there.

The exchange would be the only manual step then, where the shared secret is configured or autogenerated on the Collabora server and then configured in the admin UI of Nextcloud together with the URL of the Collabora server.

I think we should be fine just transmitting the secret in a POST request then as we'd recommend transport encryption using HTTPS anyways, but we could of course also think about some public/private key mechanism here.

mmeeks commented 1 year ago

Ah - fair cop - so, with the remote configuration stuff; we can fetch this key from you - and associate it with your server - such that we then trust requests with that shared secret coming from you ? =) if so, make perfect sense - and/or we can have users code it into the configuration too of course :-) for remote config to work nicely you'd want to use WOPI proof to check the request for remote config came from us - and we would need to add that which is quite some work.