[Idea] How to allow multiple repos per key and rsync access all at the same time
Hey, I know I have brought this up before, but this time I'm coming with a solution, that would as a side product also allow rsync access to the repositories. The issue I'm referring to is that SSH keys must be unique.
Now due to me messing around with backing up the repository itself to a different remote storage I was facing the issue that you can only specify the key once and therefore if you want to restrict it to 2 services like borg and rsync, you're kinda out of luck. Unless you write your own script that accepts both.
The environment gets the useful variable SSH_ORIGINAL_COMMAND. Which allows switching what you want to allow. And since the repository path is in that command that also allows giving access to multiple repositories with one key.
If this is something you'd be willing to add, I'd be more than happy to contribute the script part, so that borg serve can serve multiple repos and that rsync can also allow access to these repos as well (allows easy up- and downloading of existing repos.
I've kept this intentionally vague at the moment because there's not much of a point in getting into details if this is not something you're interested in adding at all.
I'll likely create a fork as proof of concept where I'll for the start allow multiplexing between rsync and borg for single repos. This then can be expanded almost trivially to allow the same key to serve multiple repos.
POC is here: https://github.com/BrainStone/borgwarehouse/tree/connection_multiplexing
This is working great so far. Though just a single repo at the moment, since the application doesn't allow multiple repos with the same key anyways.