Blog · Infrastructure

Encrypted offsite backup for Proxmox with rclone

· updated · 2 min read · by

Originally written in Portuguese. Português

Dark cover with the title Encrypted offsite backup for Proxmox with rclone and the flow vzdump, rclone crypt and offsite storage

2 min read

Having daily backups of your virtual machines is the first step. But if every copy stays on the same hardware, a disk failure, a fire or ransomware takes everything at once.

The 3-2-1 rule, recommended by CISA, sums up the minimum: 3 copies of every important file, on 2 different types of media, with 1 of them offsite.

In short

  • Proxmox VE’s vzdump makes the daily local backup of each VM, with retention per job.
  • A weekly routine sends the most recent copies to offsite storage with rclone, using the crypt backend: content and file names are encrypted before they leave the server.
  • After the upload, rclone cryptcheck checks integrity without having to download and decrypt the files.
  • The encryption passwords are kept off the server, and restore was tested before the schedule was turned on.

The architecture

VMs -> vzdump (diário, local) -> rclone crypt (semanal) -> armazenamento externo
                                       |
                                       +-> cryptcheck + retenção + e-mail de resultado
  • Local backup: one vzdump job per VM, at different times, so they do not compete for disk and network.
  • Offsite copy: a weekly script takes the most recent file of each VM and sends it to the encrypted destination.
  • Minimal access: the destination is accessed by a service account with permission only on the backup folder.

The rclone crypt configuration

crypt is a remote that “wraps” another remote. Everything that goes through it is encrypted before upload. A simplified example, with a drive accessed through a service account:

[externo]
type = drive
service_account_file = /root/.config/rclone/conta-de-servico.json

[externo-crypt]
type = crypt
remote = externo:backups-proxmox
filename_encryption = standard
directory_name_encryption = true
password = <gerado pelo rclone config, guardado fora do servidor>
password2 = <idem>

Verify, do not just copy

Copying without checking is trusting too much. rclone cryptcheck compares the local file with the encrypted one at the destination: it reads the nonce of each remote file, encrypts the local file with the same nonce and compares the checksums.

rclone copy /var/lib/vz/dump/vzdump-qemu-100-*.vma.zst externo-crypt:vm-100/ --bwlimit 12M
rclone cryptcheck /var/lib/vz/dump/ externo-crypt:vm-100/ --one-way

The script also applies retention (we keep the two most recent copies of each VM) and emails the result through Proxmox’s own notification system.

Important precautions

  • Store the crypt passwords off the server. Without them, nobody can restore the backup, not even you.
  • Limit bandwidth (--bwlimit) so you do not saturate the link during business hours.
  • Test the restore. Before enabling the schedule, we uploaded a test file, downloaded it back and compared its hash with the original.
  • Monitor the result. A backup that fails silently is worse than none, because it gives a false sense of security.

A backup that has never been restored is just an assumption.

References

Want to review your company’s backup strategy? Talk to us.