Backup

That’s a negative Ghostrider, the pattern is full.

Secure backup

I have dealt with quite a few object storage providers professionally. For my day to day home server needs though, all of these were too enterprise. For my projects I use rsync.net.

After setting up an account, rsync.net gives you a host to run unix commands on.

A script to encrypt a file with pgp and sync it to my rsync.net host. No need for the pgp private keys to be on the box, the public key can be used to encrypt the file. If the file is needed in the future the private key will be needed.

My standard backup script includes an email for failure notifications.

backup.sh

#!/bin/bash
#
# securely backup a file to rsync.net

RECIPIENT=nick@yonson.dev
FILE=/data/lnd/backup/channel.backup

# --yes overwrites existing
if gpg --yes --recipient $RECIPIENT --encrypt "$FILE" &&
  # namespacing backups by host
  rsync --relative $FILE.gpg change@change.rsync.net:$HOSTNAME/ ; then
    echo "Successfully backed up $FILE"
  else
    echo "Error backing up $FILE"
    echo "Subject: Error rsyncing\nUnable to backup $FILE on $HOSTNAME" | msmtp nick@yonson.dev
fi

Copyright (c) 2021 Nick Johnson