Borg pour vos sauvegardes

https://www.borgbackup.org/ https://borgbackup.readthedocs.io/en/stable/

Fonctionnalités

  • Stockage efficace

  • Compression

  • Chiffrement

  • Local, distant

  • Montage d’une sauvegarde avec FUSE

  • Cython (bon, c’est multi-plateforme…)


Stockage efficace ?

  • Par blocs de données “chunk” uniques
  • Unicité déterminé par (hmac-)sha256
  • Déplacement d’un fichier pas de déplacement des données
  • Modification d’un gros fichier modification de quelques chunk

Chiffrement

  • Aucun
  • Authentifié par phrase de passe
  • Clé dans un dépôt + phrase de passe (recommandé)
  • Clé hors d’un dépôt + phrase de passe

Hash/MACNon-chiffré, authentifiéChiffré (AEAD avec AES), authentifié
SHA-256authenticatedrepokey keyfile
BLAKE2bauthenticated-blake2repokey-blake2 keyfile-blake2

Démonstration !

  • Création d’un dépôt local repokey-blake2
  • Exporter la clé, au cas où
  • Création d’une sauvegarde…
  • Exploration rapide du stockage du dépôt
  • …compressée
  • Lister les sauvegardes
  • Monter une sauvegarde

  1. borg init --encryption=repokey-blake2 ./repo
  2. borg key export {,--paper,--qr-html} ./data #la clé reste chiffrée
  3. borg create ./repo::jeudi18-1 ./data
  4. L’intérieur d’un dépôt
  5. Modifications puis refaire une sauvegarde : borg create -v --stats ./repo::jeudi18-2 ./data
  6. borg create -v --stats --compression=zlib,6 ./repo::jeudi18-3 #lz4 par défaut
  7. borg help compression #compression par chunk
  8. borg list ./repo
  9. borg info ./repo
  10. borg mount ./repo::jeudi18-1 ./mnt

borg create \
        --stats \
        --progress \
        --verbose \
        --compression=zstd,10 \
        --exclude 're:.*\.[0-9]+$' \
        --exclude "$BCKPPATH/**/cache/" \
        --exclude "$BCKPPATH/**/spotifycache/" \
        ::'{now:%FT%H-%M-%S}' \
        "./$BCKPPATH/Android" \
        "./$BCKPPATH/Download" \
        "./$BCKPPATH/Movies" \
        "./$BCKPPATH/Music" \
        "./$BCKPPATH/Pictures" \
        "./$BCKPPATH/obsidian" \
        "./$BCKPPATH/Signal" \
        "./$BCKPPATH/Telegram" \
        "./$BCKPPATH/Documents/Office Lens" \
        "./$BCKPPATH/DCIM"

Pourquoi s’embêter ?

Plus simple qu’un script : Borgmatic! https://torsion.org/borgmatic/ orienté system-wide


Et le dépôt distant ?

  • configuration manuel (ssh)
  • BorgBase

  1. borgmatic -c ./borgmatic.yaml list --match-archives '*'
  2. borgmatic -c ./borgmatic.yaml list --archive jeudi18-1
  3. Ajouter le dépot borgbase et commenter le locale
  4. ssh-add ~/.ssh/borg &&\ export BORG_RSA=“ssh -i ~/.ssh/borg” &&
    borgmatic -c ./borgmatic.yaml init —encryption repokey-blake2
  5. Remettre le dépôt local
  6. borgmatic -c ./borgmatic.yaml create --stats --files

Bientôt : Borg 2.0

https://www.borgbackup.org/releases/borg-2.0.html

Mode (K = keyfile or repokey)ID-HashEncryptionAuthentication
K-blake2-chacha20-poly1305BLAKE2bCHACHA20POLY1305
K-chacha20-poly1305HMAC-SHA-256CHACHA20POLY1305
K-blake2-aes-ocbBLAKE2bAES256-OCBAES256-OCB
K-aes-ocbHMAC-SHA-256AES256-OCBAES256-OCB
authenticated-blake2BLAKE2bnoneBLAKE2b
authenticatedHMAC-SHA-256noneHMAC-SHA256
noneSHA-256nonenone