Skip to content

Commit

Permalink
backup: improve error reporting about passphrase retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarek committed Jul 29, 2017
1 parent bde8d45 commit 27ce27b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions qubes/api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import itertools
import os
import string
import subprocess

import libvirt
import pkg_resources
Expand Down Expand Up @@ -1146,8 +1147,16 @@ def _load_backup_profile(self, profile_name, skip_passphrase=False):
except KeyError:
raise qubes.exc.QubesException(
'Invalid backup profile - invalid passphrase_vm')
passphrase, _ = yield from passphrase_vm.run_service_for_stdio(
'qubes.BackupPassphrase+' + self.arg)
try:
passphrase, _ = yield from passphrase_vm.run_service_for_stdio(
'qubes.BackupPassphrase+' + self.arg)
# make it foolproof against "echo passphrase" implementation
passphrase = passphrase.strip()
assert b'\n' not in passphrase
except subprocess.CalledProcessError:
raise qubes.exc.QubesException(
'Failed to retrieve passphrase from \'{}\' VM'.format(
passphrase_vm_name))
else:
raise qubes.exc.QubesException(
'Invalid backup profile - you need to '
Expand Down

0 comments on commit 27ce27b

Please sign in to comment.