Verschlüsselte Backups mit Duplicity

Duplicity ist ein Werkzeug um Backups über das Netzwerk machen. Als Cloud Storage verwende ich Telekom Mediacenter

Die Installation auf Debian ist recht einfach

apt-get install duplicity  python-gobject-2

Damit die Backups verschlüsselt werden braucht man einen Schlüssel den ich mit gpg erstellt habe

gpg --gen-key
gpg (GnuPG) 1.4.12; Copyright (C) 2012 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N)

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <>"

Real name: Hagen Bauer
Email address:
You selected this USER-ID:
    "Hagen Bauer <>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.

Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 204 more bytes)
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 518544471 marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   409DD /518544471 2013-11-26
      Key fingerprint = A2F0 Cxxxx xxxx xxxx xxxx xxxx xxxx xxx
uid                  Hagen Bauer <>
sub   40xxx/xxxxx 2013-11-26

Wir brauchen später die Id 518544471 und natürlcih die Passphrase

Für meinen Bedarf habe ich mir folgendes Script eingerichtet das ich täglich starte. Die Details kann man woanders nachlesen

export PASSPHRASE=yourpathphrase
duplicity --exclude-filelist /root/backup-progs/exclude-backup-dirs.conf --encrypt-key '518544471' --allow-source-mismatch  --full-if-older-than 1M / webdavs://
duplicity remove-all-but-n-full 1 --allow-source-mismatch --force webdavs://
duplicity cleanup --extra-clean --allow-source-mismatch --force webdavs://

Wenn man das startet sieht das bei mir so aus:

Reading filelist /root/backup-progs/exclude-backup-dirs.conf
Sorting filelist /root/backup-progs/exclude-backup-dirs.conf
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: none
Last full backup is too old, forcing full backup
--------------[ Backup Statistics ]--------------
StartTime 1385536920.80 (Wed Nov 27 07:22:00 2013)
EndTime 1385539022.61 (Wed Nov 27 07:57:02 2013)
ElapsedTime 2101.81 (35 minutes 1.81 seconds)
SourceFiles 40902
SourceFileSize 873079378 (833 MB)
NewFiles 40902
NewFileSize 873079378 (833 MB)
DeletedFiles 0
ChangedFiles 0
ChangedFileSize 0 (0 bytes)
ChangedDeltaSize 0 (0 bytes)
DeltaEntries 40902
RawDeltaSize 857825474 (818 MB)
TotalDestinationSizeChange 360110875 (343 MB)
Errors 0

Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Wed Nov 27 07:21:59 2013
No old backup sets found, nothing deleted.
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Wed Nov 27 07:21:59 2013
No extraneous files found, nothing deleted in cleanup.