-
-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to pass a pair of file descriptors as alternative to --rsh
#4749
Comments
Are there other tools which take FDs as an option and how is their cli option named? Guess it wouldn't be too hard to implement that, but it also needs to be tested, so how can one test this? |
I could’ve sworn I saw that, but I haven’t been able to find any example. Tools seem to prefer environment variables for that for some reason (which would be fine by me).
I think it might make more sense to allow passing a UNIX socket instead of a pair of file descriptors, maybe?
I have looked a slight bit into the code, and I saw that for testing, you fall back to invoking python with In a test, you could let the FD option take precedence over that and spawn a borg serve e.g. using |
--rsh
--rsh
Connecting to a UNIX socket file or connecting to a localhost TCP port would be nicer than file descriptors for most use cases I can think of. Socket files are a bit annoying in that they need to be unlinked before usage etc and ssh is not reliably unlinking socket files (at least for me). But there could be the option of doing both. Syntax could look something like this:
The reasoning behing calling the protocol borg would be because the socket would be connected to a To complement this
This behavior would make pull-style backups with borg serve running via ssh reverse tunnel as easy as this. Example to backup up host
or with TCP sockets:
One could even create an alias/wrapper to all of this. I don't know whether this would still be in the scope of borg:
could start borg serve on a temporary socket/port, start ssh remote port forwarding on a temporary port and call borg create on the remote host with the appropriate options, wait for the backup to complete and stop borg serve again. This might look like out of scope but borg can already backup to remote ssh repositories and call borg serve there. This means it already has the capabilities to call ssh. This would in theory just be the "reverse way" of doing borg create. IMHO this would simplify things a lot. |
@felinira that sounds pretty interesting, but what I don't like about it is the complex syntax for the REPO_ARCHIVE argument. Users would need to cope with that and our code also. I mean especially the socket file variant (the tcp variant is I guess easier to get right):
IMHO it was a mistake to ever have repo and archive name mixed together in one argument (see the complex / error prone parsing code we have for that). Your syntax suggestion would make this even way more complex than it already is and there would be quite some probability of introducing new parsing issues (and new usability issues on the user side). |
Yeah, I don't like it either. Of course you could add something like
I don't really know if this is better. |
Maybe this is something to postpone for an eventual 2.0 version where #948 is also addressed? I can think of two variants of how to support this in that case. VariantsVariant 1In that case, there could be a
What obviously is missing is that there’s no way to select the path to the repository for the If one wants to support multiple repositories, I think the only way which doesn’t lead to madness (and which is supported with Variant 2Have two arguments,
An archive is then addressed via three parameters:
I find Variant 2 much more consistent and prefer it. |
I prefer Version 2 too. One could add an option like The only issue with all these things is security. There needs to be an explicit security warning that you shall not expose |
Your observations sell me even more on Variant 2. Of course, this means that this needs to be postponed until a breaking release. But since a viable workaround (shellscript + --rsh) exists, I don’t think that’s too bad. |
You can even work around it without shell script and Are there any plans for such a breaking release? Glancing over the issue list I can see quite a few issues tagged |
! I did not realize that until now. Thanks. That’ll make things much nicer. Doesn’t even need bash, sh will do. |
Have you checked borgbackup docs, FAQ, and open Github issues?
Yes
Is this a BUG / ISSUE report or a QUESTION?
Feature request, I guess?
System information. For client/server mode post info for both machines.
Your borg version (borg -V).
borg 1.1.10
Operating system (distribution) and version.
Debian GNU/Linux bullseye/sid
Hardware / network configuration, and filesystems used.
N/A
How much data is handled by borg?
N/A
Describe the problem you're observing.
I am writing a few things to document and ease pull-style operation (#900). During this, I came across the issue that I somehow need to pass a socket or a pair of file descriptors to borg instead of a rsh command.
Of course, I can emulate that using a shell script like this as RSH:
However, it would be much easier if we could simply pass file descriptor numbers to
--rsh
on platforms which support that. Alternatively, pass a path to a unix socket to connect to.The text was updated successfully, but these errors were encountered: