backup: verify if archive chunks are not reordered

Now, when file name is also integrity protected (prefixed to the
passphrase), we can make sure that input files are given in the same
order. And are parts of the same VM.

QubesOS/qubes-issues#971
This commit is contained in:
Marek Marczykowski-Górecki 2016-10-25 21:31:39 +02:00
parent 4ad15c082b
commit 51b66208f3
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1303,7 +1303,19 @@ class ExtractWorker3(ExtractWorker2):
os.remove(filename)
continue
else:
(basename, ext) = os.path.splitext(self.tar2_current_file)
previous_chunk_number = int(ext[1:])
expected_filename = basename + '.%03d' % (
previous_chunk_number+1)
if expected_filename != filename:
self.cleanup_tar2(wait=True, terminate=True)
self.log.error(
'Unexpected file in archive: {}, expected {}'.format(
filename, expected_filename))
os.remove(filename)
continue
self.log.debug("Releasing next chunck")
self.tar2_current_file = filename
run_error = handle_streams(