borgmatic-collective / docker-borgmatic

Borgmatic in Docker
GNU General Public License v3.0
314 stars 88 forks source link

BORG_RSH does not work #260

Open dave12311 opened 10 months ago

dave12311 commented 10 months ago

Command specified by BORG_RSH does not seem to get passed to ssh.

E.g. trying to specify a key with a non-default name BORG_RSH="ssh -i /root/.ssh/borgbase" results in

SSH command line: ['ssh', '<REDACTED>.repo.borgbase.com', 'borg', 'serve', '--debug']
Remote: <REDACTED>.repo.borgbase.com: Permission denied (publickey).
Connection closed by remote host. Is borg working on the server?
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/borg/archiver.py", line 5324, in main
    exit_code = archiver.run(args)
                ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/borg/archiver.py", line 5255, in run
    return set_ec(func(args))
                  ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/borg/archiver.py", line 161, in wrapper
    repository = RemoteRepository(location.omit_archive(), create=create, exclusive=argument(args, exclusive),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/borg/remote.py", line 578, in __init__
    raise ConnectionClosedWithHint('Is borg working on the server?') from None
borg.remote.ConnectionClosedWithHint: Connection closed by remote host. Is borg working on the server?

Platform: Linux 198e743aacb9 5.10.160-rk35xx #1 SMP Thu Jul 6 13:36:29 UTC 2023 aarch64
Linux: Unknown Linux  
Borg: 1.2.6  Python: CPython 3.11.5 msgpack: 1.0.5 fuse: llfuse 1.5.0 [pyfuse3,llfuse]
PID: 15  CWD: /
sys.argv: ['/usr/local/bin/borg', 'init', '--encryption', 'repokey-blake2', '--debug', 'ssh://<REDACTED>.repo.borgbase.com/./repo']
SSH_ORIGINAL_COMMAND: None

Renaming the key to the default id_rsa works.

witten commented 10 months ago

You may already be aware, but you can set the ssh_command option in borgmatic's configuration instead of the BORG_SSH environment variable.

modem7 commented 3 months ago

@dave12311 - did @witten's comment assist? Are you still having this issue?

dave12311 commented 3 months ago

I ended up just passing the key with the default name using VOLUME_SSH, but I guess the documentation should still be updated to reflect this. Thanks for the help though!

modem7 commented 3 months ago

I ended up just passing the key with the default name using VOLUME_SSH, but I guess the documentation should still be updated to reflect this. Thanks for the help though!

Happy to review a PR for this!