hello,
i wondered if we could have client-side online encryption to have vzdump backup stored encrypted on the target datastore.
i guess this is something many people can need and which currently is only available with proxmox backup server.
i have taken a look into that , and it should probably be not too hard to be implemented.
all you need to do is passsing the backup stream via pipe trough an encryption tool.
i assume this can perhaps be done via a vzdump hook script, but i need to get into the details how to use stdin/stdout with that. not sure if it's doable and maybe somebody can help with building such or maybe that already exists ?
anyhow, i think it would be valuable if it would be available as a standard option in proxmox.
here is what i did as a proof of concept:
- add encryption bash script:
- add password to /root/openssl.pass
- add enc.sh to VZDump.pm (ok, this is _really_ a little bit of hacky )
- restart pvedeamon
- run backup
and voila:
decryption :
i wondered if we could have client-side online encryption to have vzdump backup stored encrypted on the target datastore.
i guess this is something many people can need and which currently is only available with proxmox backup server.
i have taken a look into that , and it should probably be not too hard to be implemented.
all you need to do is passsing the backup stream via pipe trough an encryption tool.
i assume this can perhaps be done via a vzdump hook script, but i need to get into the details how to use stdin/stdout with that. not sure if it's doable and maybe somebody can help with building such or maybe that already exists ?
anyhow, i think it would be valuable if it would be available as a standard option in proxmox.
here is what i did as a proof of concept:
- add encryption bash script:
Code:
# cat /root/enc.sh
#!/bin/bash
openssl aes-256-cbc -in /dev/stdin -out - -pbkdf2 -iter 1000000 -pass file:/root/openssl.pass
- add enc.sh to VZDump.pm (ok, this is _really_ a little bit of hacky )
Code:
# diff -Naur //usr/share/perl5/PVE/VZDump.pm.orig //usr/share/perl5/PVE/VZDump.pm
--- //usr/share/perl5/PVE/VZDump.pm.orig 2023-03-19 10:28:41.955284343 +0100
+++ //usr/share/perl5/PVE/VZDump.pm 2023-03-19 10:23:59.157730485 +0100
@@ -757,7 +757,7 @@
my $cpuinfo = PVE::ProcFSTools::read_cpuinfo();
$zstd_threads = int(($cpuinfo->{cpus} + 1)/2);
}
- return ("zstd --rsyncable --threads=${zstd_threads}", 'zst');
+ return ("zstd --rsyncable --threads=${zstd_threads} | /root/enc.sh", 'zst');
} else {
die "internal error - unknown compression option '$opt_compress'";
}
- run backup
and voila:
Code:
# file vzdump-qemu-104-2023_03_19-10_25_07.vma.dat
vzdump-qemu-104-2023_03_19-10_25_07.vma.zst: openssl enc'd data with salted password
decryption :
Code:
cat vzdump-qemu-104-2023_03_19-10_25_07.vma.dat | openssl aes-256-cbc -d -in - -out - -pbkdf2 -iter 1000000 -pass file:/root/openssl.pass >unencrypted
Last edited: