Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper "paranoid mode" backup restore using DisposableVM #5310

Closed
marmarek opened this issue Sep 10, 2019 · 1 comment
Closed

Proper "paranoid mode" backup restore using DisposableVM #5310

marmarek opened this issue Sep 10, 2019 · 1 comment
Labels
C: core P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. release notes This issue should be mentioned in the release notes. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Milestone

Comments

@marmarek
Copy link
Member

The problem you're addressing (if any)
Ease restoring backup using DisposableVM and Admin API. Context: https://www.qubes-os.org/news/2017/04/26/qubes-compromise-recovery/

Describe the solution you'd like
It's already possible to restore using DisposableVM, but the process is manual. Especially setting qrexec policy is non-trivial.

Where is the value to a user, and who might that user be?
Easier safe data migration from potentially compromised machine.

Additional context
This is follow up work for QSB #51

@marmarek marmarek added T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. labels Sep 10, 2019
@marmarek marmarek added this to the Release 4.1 milestone Sep 10, 2019
marmarek added a commit to marmarek/qubes-core-agent-linux that referenced this issue Sep 14, 2019
Add pair of services:
1. qubes.RegisterBackupLocation - called by dom0, registers what backup
location (including both file and command options) can be accessed.
Registered location gets an ID returned to the caller. The location (and
its ID) is valid as long as the service call remains open.

2. qubes.RestoreById - called by restoring DispVM to retrieve the backup
content. The service expects location ID as an argument, and then list
of files/directories (separated with spaces) on the first line of stdin.
This is very similar to qubes.Restore service, with exception for the
archive location control.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Sep 29, 2019
Getting name of QubesVM object doesn't require Admin API call that could
be not allowed by this VM

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Sep 29, 2019
Allow setting alternative qrexec service to retrieve backup content. The
service API is slightly different than the default one: it will get only
list of files/directories to extract on its stdin, but not backup
location. The latter could be provided as a service argument, or using
other out-of-band mechanism.
This will be useful for paranoid backup restore mode, to take away
control over location/command from sandboxed qvm-backup-restore process.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Sep 29, 2019
…ring

Make it possible to use qvm-backup-restore in a VM. This commit is about
accessing backup itself, when stored in another VM. This involve using
qfile-unpacker instead of qfile-dom0-unpacker and also requesting disk
space monitoring, as a VM probably won't have enough space to hold the
whole backup at once.

QubesOS/qubes-issues#4791
QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Sep 29, 2019
Needed to extrac backup archive

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Sep 29, 2019
Having Admin API, it is possible to do this properly now:
 - create DisposableVM
 - assign it proper permissions to create VMs and control those created
   VMs
 - run restore process inside
 - cleanup DisposableVM afterwards

This feature depends on modifications in various other components,
including:
 - linux-utils and core-agent-linux for update qfile-unpacker
 - core-admin for qrexec policy modification

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Sep 29, 2019
…files

This will be useful for "paranoid mode" backup restore policy.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Sep 29, 2019
When a VM with 'tag-created-vm-with' feature set creates a VM (using
Admin API), that VM will get all the tags listed in the feature.
Multiple tags can be separated with spaces.

This will be useful to tag VMs created during paranoid mode backup
restore.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Sep 29, 2019
Do not allow starting a VM while the restoring management VM has still
control over it. Specifically, that restoring VM will not be able to
start just restored VM.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Sep 29, 2019
Policy allows a VM with 'backup-restore-mgmt' tag to create VMs, and
then manage VMs with 'backup-restore-in-progress' tag (which is added by
AdminExtension, based on 'tag-created-vm-with' feature).

VM with 'backup-restore-mgmt' tag can also call qubes.RestoreById
service to a VM with 'backup-restore-storage' tag. This service allows
to retrieve backup archive.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Sep 29, 2019
…files

This will be useful for "paranoid mode" backup restore policy.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Sep 29, 2019
When a VM with 'tag-created-vm-with' feature set creates a VM (using
Admin API), that VM will get all the tags listed in the feature.
Multiple tags can be separated with spaces.

This will be useful to tag VMs created during paranoid mode backup
restore.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Sep 29, 2019
Do not allow starting a VM while the restoring management VM has still
control over it. Specifically, that restoring VM will not be able to
start just restored VM.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Sep 29, 2019
Policy allows a VM with 'backup-restore-mgmt' tag to create VMs, and
then manage VMs with 'backup-restore-in-progress' tag (which is added by
AdminExtension, based on 'tag-created-vm-with' feature).

VM with 'backup-restore-mgmt' tag can also call qubes.RestoreById
service to a VM with 'backup-restore-storage' tag. This service allows
to retrieve backup archive.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-agent-linux that referenced this issue Oct 18, 2019
Add pair of services:
1. qubes.RegisterBackupLocation - called by dom0, registers what backup
location (including both file and command options) can be accessed.
Registered location gets an ID returned to the caller. The location (and
its ID) is valid as long as the service call remains open.

2. qubes.RestoreById - called by restoring DispVM to retrieve the backup
content. The service expects location ID as an argument, and then list
of files/directories (separated with spaces) on the first line of stdin.
This is very similar to qubes.Restore service, with exception for the
archive location control.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Oct 18, 2019
Getting name of QubesVM object doesn't require Admin API call that could
be not allowed by this VM

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Oct 18, 2019
Allow setting alternative qrexec service to retrieve backup content. The
service API is slightly different than the default one: it will get only
list of files/directories to extract on its stdin, but not backup
location. The latter could be provided as a service argument, or using
other out-of-band mechanism.
This will be useful for paranoid backup restore mode, to take away
control over location/command from sandboxed qvm-backup-restore process.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Oct 18, 2019
…ring

Make it possible to use qvm-backup-restore in a VM. This commit is about
accessing backup itself, when stored in another VM. This involve using
qfile-unpacker instead of qfile-dom0-unpacker and also requesting disk
space monitoring, as a VM probably won't have enough space to hold the
whole backup at once.

QubesOS/qubes-issues#4791
QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Oct 18, 2019
Needed to extrac backup archive

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Oct 18, 2019
Having Admin API, it is possible to do this properly now:
 - create DisposableVM
 - assign it proper permissions to create VMs and control those created
   VMs
 - run restore process inside
 - cleanup DisposableVM afterwards

Since the RestoreInDisposableVM class contains de facto reverse parser
for qvm-backup-restore command line, add a test that will spot when it
gets out of sync.

This feature depends on modifications in various other components,
including:
 - linux-utils and core-agent-linux for update qfile-unpacker
 - core-admin for qrexec policy modification

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Oct 18, 2019
Allow running unattended, with qvm-backup-restore --passphrase-file.
This require few modifications:
 - copy the passphrase file into the DisposableVM (that VM knows the
         passphrase anyway, so there is no extra data leak)
 - close the terminal when operation finishes

Closing the terminal would eliminate almost all the feedback (operation
log, errors, warnings etc), so write it into a file in DisposableVM and
later extract it and show on the stdout. Similar to qvm-run, color it
red as a content coming from a VM.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Oct 18, 2019
…files

This will be useful for "paranoid mode" backup restore policy.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 3, 2020
Needed to extrac backup archive

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 3, 2020
Having Admin API, it is possible to do this properly now:
 - create DisposableVM
 - assign it proper permissions to create VMs and control those created
   VMs
 - run restore process inside
 - cleanup DisposableVM afterwards

Since the RestoreInDisposableVM class contains de facto reverse parser
for qvm-backup-restore command line, add a test that will spot when it
gets out of sync.

This feature depends on modifications in various other components,
including:
 - linux-utils and core-agent-linux for update qfile-unpacker
 - core-admin for qrexec policy modification

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 3, 2020
Allow running unattended, with qvm-backup-restore --passphrase-file.
This require few modifications:
 - copy the passphrase file into the DisposableVM (that VM knows the
         passphrase anyway, so there is no extra data leak)
 - close the terminal when operation finishes

Closing the terminal would eliminate almost all the feedback (operation
log, errors, warnings etc), so write it into a file in DisposableVM and
later extract it and show on the stdout. Similar to qvm-run, color it
red as a content coming from a VM.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 3, 2020
Allow running unattended, with qvm-backup-restore --passphrase-file.
This require few modifications:
 - copy the passphrase file into the DisposableVM (that VM knows the
         passphrase anyway, so there is no extra data leak)
 - close the terminal when operation finishes

Closing the terminal would eliminate almost all the feedback (operation
log, errors, warnings etc), so write it into a file in DisposableVM and
later extract it and show on the stdout. Similar to qvm-run, color it
red as a content coming from a VM.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 4, 2020
Getting name of QubesVM object doesn't require Admin API call that could
be not allowed by this VM

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 4, 2020
Allow setting alternative qrexec service to retrieve backup content. The
service API is slightly different than the default one: it will get only
list of files/directories to extract on its stdin, but not backup
location. The latter could be provided as a service argument, or using
other out-of-band mechanism.
This will be useful for paranoid backup restore mode, to take away
control over location/command from sandboxed qvm-backup-restore process.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 4, 2020
…ring

Make it possible to use qvm-backup-restore in a VM. This commit is about
accessing backup itself, when stored in another VM. This involve using
qfile-unpacker instead of qfile-dom0-unpacker and also requesting disk
space monitoring, as a VM probably won't have enough space to hold the
whole backup at once.

QubesOS/qubes-issues#4791
QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 4, 2020
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 4, 2020
Having Admin API, it is possible to do this properly now:
 - create DisposableVM
 - assign it proper permissions to create VMs and control those created
   VMs
 - run restore process inside
 - cleanup DisposableVM afterwards

Since the RestoreInDisposableVM class contains de facto reverse parser
for qvm-backup-restore command line, add a test that will spot when it
gets out of sync.

This feature depends on modifications in various other components,
including:
 - linux-utils and core-agent-linux for update qfile-unpacker
 - core-admin for qrexec policy modification

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 4, 2020
Allow running unattended, with qvm-backup-restore --passphrase-file.
This require few modifications:
 - copy the passphrase file into the DisposableVM (that VM knows the
         passphrase anyway, so there is no extra data leak)
 - close the terminal when operation finishes

Closing the terminal would eliminate almost all the feedback (operation
log, errors, warnings etc), so write it into a file in DisposableVM and
later extract it and show on the stdout. Similar to qvm-run, color it
red as a content coming from a VM.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Aug 5, 2020
Allow running unattended, with qvm-backup-restore --passphrase-file.
This require few modifications:
 - copy the passphrase file into the DisposableVM (that VM knows the
         passphrase anyway, so there is no extra data leak)
 - close the terminal when operation finishes

Closing the terminal would eliminate almost all the feedback (operation
log, errors, warnings etc), so write it into a file in DisposableVM and
later extract it and show on the stdout. Similar to qvm-run, color it
red as a content coming from a VM.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Aug 5, 2020
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Aug 6, 2020
Policy allows a VM with 'backup-restore-mgmt' tag to create VMs, and
then manage VMs with 'backup-restore-in-progress' tag (which is added by
AdminExtension, based on 'tag-created-vm-with' feature).

VM with 'backup-restore-mgmt' tag can also call qubes.RestoreById
service to a VM with 'backup-restore-storage' tag. This service allows
to retrieve backup archive.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Aug 6, 2020
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Aug 6, 2020
Policy allows a VM with 'backup-restore-mgmt' tag to create VMs, and
then manage VMs with 'backup-restore-in-progress' tag (which is added by
AdminExtension, based on 'tag-created-vm-with' feature).

VM with 'backup-restore-mgmt' tag can also call qubes.RestoreById
service to a VM with 'backup-restore-storage' tag. This service allows
to retrieve backup archive.

QubesOS/qubes-issues#5310
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Aug 6, 2020
marmarek added a commit to QubesOS/qubes-core-admin-client that referenced this issue Oct 24, 2020
Getting name of QubesVM object doesn't require Admin API call that could
be not allowed by this VM

QubesOS/qubes-issues#5310

(cherry picked from commit 2b6b4e7)
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Oct 24, 2020
Getting name of QubesVM object doesn't require Admin API call that could
be not allowed by this VM

QubesOS/qubes-issues#5310

(cherry picked from commit 2b6b4e7)
@marmarek marmarek added the release notes This issue should be mentioned in the release notes. label Jun 17, 2021
@marmarek
Copy link
Member Author

This has been completed. Updating documentation is tracked separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: core P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. release notes This issue should be mentioned in the release notes. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Projects
None yet
Development

No branches or pull requests

2 participants