Skip to content

Commit

Permalink
backup/restore: hardcode MD5 algo for format v2/v3 decryption
Browse files Browse the repository at this point in the history
Old OpenSSL versions (which were used to encrypt format v2 and v3
backups) defaulted to MD5 for key derivation from the password.

OpenSSL 1.1.0+ in R4.1+ changed that default (not only for encryption
but also for *decryption*) to SHA256:

openssl/openssl@f8547f6#diff-5a32e43870f189e8abf5e1b388115b001c9dadc23e582f28b667738857c237b6

Fixes QubesOS/qubes-issues#7852
  • Loading branch information
rustybird committed Nov 5, 2022
1 parent 991e47b commit 0f35e53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions qubesadmin/backup/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,8 @@ def __run__(self):
["openssl", "enc",
"-d",
"-" + self.crypto_algorithm,
"-md",
"MD5",
"-pass",
"pass:" + self.passphrase],
stdin=subprocess.PIPE,
Expand Down
3 changes: 2 additions & 1 deletion qubesadmin/tests/backup/backupcompatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,8 @@ def handle_v3_file(self, f_name, subdir, stream, compressed=True,
tar = subprocess.Popen(tar_cmdline, stdout=subprocess.PIPE)
if encrypted:
encryptor = subprocess.Popen(
["openssl", "enc", "-e", "-aes-256-cbc", "-pass", "pass:qubes"],
["openssl", "enc", "-e", "-aes-256-cbc",
"-md", "MD5", "-pass", "pass:qubes"],
stdin=tar.stdout,
stdout=subprocess.PIPE)
tar.stdout.close()
Expand Down

0 comments on commit 0f35e53

Please sign in to comment.