[Borgbackup] Borg through Tor

amuza amuza at riseup.net
Fri Feb 5 15:39:46 EST 2021


Hello everyone!

I'm new to Borg.

I am playing with it trying to make it work through Tor.

I have tried everything without Tor and it works great. Then I installed
Tor on both computers and configured an onion SSH service in the remote
Borg server. I can SSH to it through Tor from the local computer without
a problem. However, when trying to use Borg through Tor, I am getting
the following errors (as well as a success status):

------------------
terminating with success status, rc 0

Fri Feb  5 20:41:40 2021 Pruning repository

Remote: ssh: Could not resolve hostname
theverymuchlongversion3onionaddress.onion: Name or service not known
Connection closed by remote host. Is borg working on the server?
terminating with error status, rc 2

Fri Feb  5 20:41:43 CET 2021 Backup and/or Prune finished with errors
------------------

Why do I get those messages? What do they mean?

You can find below the script I did (I simply tell Borg to  use Torsocks
and give it the onion address). Please let me know if you have any
suggestion. Thank you!


------------------
#!/bin/sh

export
BORG_REPO=ssh://remoteuser@theverymuchlongversion3onionaddress.onion:2222/path/to/repo

export BORG_PASSPHRASE='my-passphrase-here'

export BORG_RSH='ssh -i /home/localuser/.ssh/id_rsa'

info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM

info "Starting backup"


torsocks borg create                \
    --verbose                       \
    --filter AME                    \
    --list                          \
    --stats                         \
    --show-rc                       \
    --compression lz4               \
    --exclude-caches                \
    --exclude '/home/*/.cache/*'    \
    --exclude '/var/cache/*'        \
                                    \
    ::'{hostname}-{now}'            \
    /home                           \

backup_exit=$?

info "Pruning repository"

borg prune                          \
    --list                          \
    --prefix '{hostname}-'          \
    --show-rc                       \
    --keep-daily    7               \
    --keep-weekly   4               \
    --keep-monthly  6               \

prune_exit=$?

if [ ${global_exit} -eq 0 ]; then
    info "Backup and Prune finished successfully"
elif [ ${global_exit} -eq 1 ]; then
    info "Backup and/or Prune finished with warnings"
else
    info "Backup and/or Prune finished with errors"
fi

exit ${global_exit}
-------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://mail.python.org/pipermail/borgbackup/attachments/20210205/24f96580/attachment.sig>


More information about the Borgbackup mailing list