diff -Nur -x '*.orig' -x '*.rej' smeserver-BackupPC-0.1/root/etc/BackupPC/localArchive.conf mezzanine_patched_smeserver-BackupPC-0.1/root/etc/BackupPC/localArchive.conf --- smeserver-BackupPC-0.1/root/etc/BackupPC/localArchive.conf 2009-05-13 01:35:34.000000000 +0200 +++ mezzanine_patched_smeserver-BackupPC-0.1/root/etc/BackupPC/localArchive.conf 2009-05-13 01:33:52.000000000 +0200 @@ -7,6 +7,23 @@ # Compression. Can be gzip, bzip2 or none compress = gzip +# Encryption of the archives, using OpenSSL +# You can put here the name of the cipher you want to use +# To obtain a list of available cipher, run the command +# man enc +# eg: cipher = aes-256-cbc +# If encryption is turned on, .enc will be appended +# At the end of the archive's name. +# To be able tu use this archive talter, you'll have to +# decrypt it using the same key +# cat archive.tar.gz.enc | openssl enc aes-256-cbc -d -pass file:/etc/BackupPC/archive.key > archive.tar.gz +cipher = off + +# The key file to use to encrypt the archive +# You should backup this key somewhere. If you lost it +# your archives will be unusuable +key = /etc/BackupPC/archive.key + # The backup number to archive, -1 means the last one backupNum = -1 diff -Nur -x '*.orig' -x '*.rej' smeserver-BackupPC-0.1/root/etc/BackupPC/remoteArchive.conf mezzanine_patched_smeserver-BackupPC-0.1/root/etc/BackupPC/remoteArchive.conf --- smeserver-BackupPC-0.1/root/etc/BackupPC/remoteArchive.conf 2009-05-13 01:35:34.000000000 +0200 +++ mezzanine_patched_smeserver-BackupPC-0.1/root/etc/BackupPC/remoteArchive.conf 2009-05-13 01:34:34.000000000 +0200 @@ -10,6 +10,23 @@ # Compression. Can be gzip, bzip2 or none compress = gzip +# Encryption of the archives, using OpenSSL +# You can put here the name of the cipher you want to use +# To obtain a list of available cipher, run the command +# man enc +# eg: cipher = aes-256-cbc +# If encryption is turned on, .enc will be appended +# At the end of the archive's name. +# To be able tu use this archive talter, you'll have to +# decrypt it using the same key +# cat archive.tar.gz.enc | openssl enc aes-256-cbc -d -pass file:/etc/BackupPC/archive.key > archive.tar.gz +cipher = off + +# The key file to use to encrypt the archive +# You should backup this key somewhere. If you lost it +# your archives will be unusuable +key = /etc/BackupPC/archive.key + # The backup number to archive, -1 means the last one backupNum = -1 diff -Nur -x '*.orig' -x '*.rej' smeserver-BackupPC-0.1/root/etc/BackupPC/usbArchive.conf mezzanine_patched_smeserver-BackupPC-0.1/root/etc/BackupPC/usbArchive.conf --- smeserver-BackupPC-0.1/root/etc/BackupPC/usbArchive.conf 2009-05-13 01:35:34.000000000 +0200 +++ mezzanine_patched_smeserver-BackupPC-0.1/root/etc/BackupPC/usbArchive.conf 2009-05-13 01:34:12.000000000 +0200 @@ -7,6 +7,23 @@ # Compression. Can be gzip, bzip2 or none compress = gzip +# Encryption of the archives, using OpenSSL +# You can put here the name of the cipher you want to use +# To obtain a list of available cipher, run the command +# man enc +# eg: cipher = aes-256-cbc +# If encryption is turned on, .enc will be appended +# At the end of the archive's name. +# To be able tu use this archive talter, you'll have to +# decrypt it using the same key +# cat archive.tar.gz.enc | openssl enc aes-256-cbc -d -pass file:/etc/BackupPC/archive.key > archive.tar.gz +cipher = off + +# The key file to use to encrypt the archive +# You should backup this key somewhere. If you lost it +# your archives will be unusuable +key = /etc/BackupPC/archive.key + # The backup number to archive, -1 means the last one backupNum = -1 diff -Nur -x '*.orig' -x '*.rej' smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_localArchive mezzanine_patched_smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_localArchive --- smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_localArchive 2008-10-06 19:01:51.000000000 +0200 +++ mezzanine_patched_smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_localArchive 2009-05-11 17:19:09.000000000 +0200 @@ -39,6 +39,8 @@ 'destination'=>"/tmp/", 'split'=>"0", 'compress'=>"gzip", + 'cipher'=>'off', + 'key'=>'/etc/BackupPC/archive.key', 'backupNum'=>"-1", 'share'=>"*", 'parity'=>'0', @@ -53,7 +55,7 @@ print STDERR "\nYou have requested to archive these hosts: $params{hosts} to this destination: $params{destination}\n\n"; -localArchive($params{hosts},$params{backupNum},$params{share},$params{compress},$params{split},$params{destination}); +localArchive($params{hosts},$params{backupNum},$params{share},$params{compress},$params{split},$params{cipher},$params{key},$params{destination}); print STDERR "\n\nArchive finished: ".`$path{date}`."\n"; diff -Nur -x '*.orig' -x '*.rej' smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_remoteArchive mezzanine_patched_smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_remoteArchive --- smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_remoteArchive 2008-10-06 19:01:05.000000000 +0200 +++ mezzanine_patched_smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_remoteArchive 2009-05-11 21:11:02.000000000 +0200 @@ -40,6 +40,8 @@ 'remoteUser'=>"backuppc", 'remoteDir'=>"/tmp/", 'compress'=>"gzip", + 'cipher'=>'off', + 'key'=>'/etc/BackupPC/archive.key', 'backupNum'=>"-1", 'share'=>"*", 'hosts'=>'localhost', @@ -53,7 +55,7 @@ print STDERR "\nYou have requested to archive these hosts: $params{hosts} to this destination: $params{remoteUser}\@$params{remoteHost}:/$params{remoteDir}\n\n"; -remoteArchive($params{remoteHost},$params{remoteUser},$params{remoteDir},$params{hosts},$params{backupNum},$params{share},$params{compress}); +remoteArchive($params{remoteHost},$params{remoteUser},$params{remoteDir},$params{hosts},$params{backupNum},$params{share},$params{compress},$params{cipher},$params{key}); print STDERR "\n\nArchive finished: ".`$path{date}`."\n"; diff -Nur -x '*.orig' -x '*.rej' smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_usbArchive mezzanine_patched_smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_usbArchive --- smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_usbArchive 2008-10-06 18:58:43.000000000 +0200 +++ mezzanine_patched_smeserver-BackupPC-0.1/root/usr/share/BackupPC/bin/BackupPC_SME_usbArchive 2009-05-11 17:21:32.000000000 +0200 @@ -39,7 +39,8 @@ my %params=( 'split'=>"0", 'compress'=>"/bin/gzip", - 'extension'=>"tar.gz", + 'cipher'=>'off', + 'key'=>'/etc/BackupPC/archive.key', 'backupNum'=>"-1", 'share'=>"*", 'hosts'=>'localhost', @@ -59,7 +60,7 @@ $check = mountUsb($params{destination},$params{device}); if ($check eq 1){ - localArchive($params{hosts},$params{backupNum},$params{share},$params{compress},$params{split},$params{destination}); + localArchive($params{hosts},$params{backupNum},$params{share},$params{compress},$params{split},$params{cipher},$params{key},$params{destination}); } else{ print STDERR "\n\nAborting, an error occured while mounting the removable device $params{device} on $params{destination}\n\n"; diff -Nur -x '*.orig' -x '*.rej' smeserver-BackupPC-0.1/root/usr/share/BackupPC/lib/BackupPC/SMEarchive.pm mezzanine_patched_smeserver-BackupPC-0.1/root/usr/share/BackupPC/lib/BackupPC/SMEarchive.pm --- smeserver-BackupPC-0.1/root/usr/share/BackupPC/lib/BackupPC/SMEarchive.pm 2008-10-06 19:05:37.000000000 +0200 +++ mezzanine_patched_smeserver-BackupPC-0.1/root/usr/share/BackupPC/lib/BackupPC/SMEarchive.pm 2009-05-11 21:10:15.000000000 +0200 @@ -43,6 +43,7 @@ $path{bzip2} = '/usr/bin/bzip2'; $path{rsync} = '/usr/bin/rsync'; $path{tar} = '/bin/tar'; +$path{openssl} = '/usr/bin/openssl'; sub checkExec{ # On vérifie que les executables sont bien executables @@ -157,8 +158,8 @@ system("$path{rm} -f $file"); } -sub localArchive($$$$$$){ - my ($hosts,$backupNum,$share,$compress,$split,$destination) = @_; +sub localArchive($$$$$$$$){ + my ($hosts,$backupNum,$share,$compress,$split,$cipher,$key,$destination) = @_; my $check = 1; my $extension = 'tar'; # on fixe l'extension de l'archive en fonction de la compression utilisée @@ -190,6 +191,10 @@ if (($compress eq 'gzip') || ($compress eq 'bzip2')){ $cmd .= "| $path{$compress} -c "; } + if (($cipher ne 'off') && (-e $key)){ + $cmd .= "| $path{openssl} enc -$cipher -salt -pass file:$key"; + $extension .= '.enc'; + } if ($split eq '0'){ $cmd .= "> $destination/$host.$backupNum.$extension"; } @@ -255,8 +260,8 @@ return $ok; } -sub remoteArchive($$$$$$$){ - my ($remoteHost,$remoteUser,$remoteDir,$hosts,$backupNum,$share,$compress) = @_; +sub remoteArchive($$$$$$$$$){ + my ($remoteHost,$remoteUser,$remoteDir,$hosts,$backupNum,$share,$compress,$cipher,$key) = @_; my $check = 1; my $extension = 'tar'; # on fixe l'extension de l'archive en fonction de la compression utilisée @@ -277,7 +282,10 @@ if (($compress eq 'gzip') || ($compress eq 'bzip2')){ $cmd .= "| $path{$compress} -c "; } - + if (($cipher ne 'off') && (-e $key)){ + $cmd .= "| $path{openssl} enc -$cipher -salt -pass file:$key"; + $extension .= '.enc'; + } $cmd .= " | $path{ssh} -l $remoteUser $remoteHost \"(cd $remoteDir && $path{cat} > $remoteDir/$host.$backupNum.$extension)\""; logAndPerform($cmd);