Open creativeprojects opened 3 years ago
That's funny, because before stepping over resticprofile, I was thinking that it would be nice to have a server to manage restic configuration and clients that securely connect to the server to apply it on endpoints. Combined with a management web UI (for admins) to control auth, clients and settings, and a self-service UI (for endpoints) to restore data from snapshots. From my perspective this is a good idea, but it has to be done very carefully as it can lead to serious loss of information.
Some thoughts:
password-file
and authorization against the repository (and itself) and bind this to clients so that access can also be revoked easily. --append-only
mode of restic-rest-server
to protect from ransomware (or misconfiguration). E.g. clients can only append but never delete. Retention & checks are handled by the server (that has full access).Design considerations:
resticprofile-service
that dedicates only to this task (e.g. securely transferring profiles, passwords, status, logs and triggering actions).resticprofile
should remain dedicated to one task of executing profiles only and not do client & server communication by itself.only-if-host-is: [...]
, only-if-os-is: [...]
, only-if-path-exists: [...]
, etc.) that way they can be created generically.resticprofile show
could be enhanced to create machine readable output (while evaluating conditionals) so that a resticprofile-service
can create profiles that are dedicated to a certain endpoint.While it is a side effect when backup schedules are controlled by a central unit, I'd like to add that push based scheduling allows to use backup queues per repository that control backup concurrency and limit load. E.g. a profile with a schedule of "Every day at 12:00" could run on a larger amount of endpoints when only some endpoints may run the backup concurrently.
This can even make sense with a hand-full of endpoints when the repo is something like a consumer NAS. Current solution is to have different schedules for different endpoints.
It looks like we do have similar ideas 😄
Client & server communication must be implemented with very high security standards. E.g. TLS-1.3+ and exchange of public keys like in SSH or Wireguard.
This one is tricky though:
I'd not strip down security just because someone could have the impression that it can be used securely without VPN. Personally I do not trust my own network since any desktop (or server) could get infected and attack others to some extent. If it can be done in a secure way and still work quite simple (e.g. public key exchange using a key that is not too long when string encoded), I'd use that but still mention that it is not a good idea to use it without VPN or similar.
Winter is coming so I'll have a bit more time at the week-ends: I'll start preparing a design document 😄
Same here (regarding time :)). Wanted to create a quick prototype on HTTP(S)+Websockets+SSH (SSH via Websockets for identification, commands & logs, HTTP/S for everything else). Was thinking about the communication part a bit and while client-certs can be a solution to identify agents uniquely, using HTTPS only means that middle boxes or proxies may create issues (technical and data protection). Embedding SSH with websockets allows to use something proven that is secure even when outer transfer is only HTTP. Nevertheless my aim is just to test whether this works well without heavy externals dependencies. It should not mean that this has to be the way to go.
Funny enough I was doing a quick PoC the other day: transparent AES encryption over HTTP. I'm not sure how usable it actually is, but it's very simple: https://github.com/creativeprojects/encryption
Randomly, I just found this discussion 🤔 https://github.com/restic/restic/issues/299
Thanks a lot for reference. My (somewhat biased) takeaways are: There is a demand for a pull based system and it may be sufficient to use a remote shell for this. While both client and backup-server must be protected its important that a client has minimal access to the backup so that malicious software cannot easily do harm. For the same reasons the repository should not require to be reachable in the same (e.g. public) network as where the client sits.
I'd add that it is also very crucial that the client has to be protected to avoid take over or dataloss so a too permissive remote shell or even a homegrown remote-fs doesn't sound like a good plan.
While it seems there is something going on @ restic/restic with regards to pulling from remote sources, I think for resticprofile
it still is good to consider supporting pull based operation. This could be done with remote shell support instead of implementing a full client & server model which would be the much higher hanging fruit and harder to maintain.
As a quick wrap-up this is what I think would be required when we choose to support remote shells:
General
resticprofile
allows running commands in local or remote shells (likely SSH but not limited to).hostname
)Security
Usability
resticprofile
should be the only command that a remote shell needs to run directly. Technically this means resticprofile
communicates with resticprofile
on the other side (should to be secured, e.g. via pairing).resticprofile
can print the entry for authorized_keys
that the clients needs to use including all restrictions that should apply and it could manage known_hosts
locally containing all the clients.resticprofile
has some convenience features, e.g. auto-deployment of restic
on supported platforms.Under the assumption that the best match for a remote shell is SSH to begin with, the only disadvantages I see is supporting Windows and Desktops as in both cases SSH is uncommon.
I think I like this version better than the original idea:
With this, no need to create a separate service, install it on a client and wait for requests. All we need is allowing SSH to the machine. There's openSSH included in Windows 10 now (maybe starting with pro I don't know, but I had it on my Windows laptop at my previous job)
We could also implement ephemeral keys: the server creates a new repository key before sending it to the client and destroys it after the backup is finished. Although if the attacker already has access to the client, it could potentially intercept the backup request and steal the key. Still, that's another level of protection to go through.
Quick ideas: https://github.com/creativeprojects/resticprofile/wiki/Design
Are you able to update the wiki? (I never used that feature before)
I've not used it either. Looks like I can clone it but not push. Also have no buttons for editing.
Today, all the backup operations are initiated by the client (push). What if you would want a backup server asking for files from the clients? (pull).
I'm opening this issue as a discussion around the client/server model: a resticprofile server could wait for commands to trigger a backup, via a simple REST API.
Is it a good idea?