Commit Graph

827 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
2c1e7927f6
gitlab-ci: fix codecov call 2021-02-19 16:54:19 +01:00
Marek Marczykowski-Górecki
0f42fd0580
tests: restoring a backup bigger than available space in /var/tmp
This test uses three tricks to test /var/tmp space monitoring:
1. Creates a big uncompressed backup (2GB file instead of few bytes)
2. Mount small tmpfs over /var/tmp (650MB - minimal space that should
   not deadlock the restore)
3. Artificially slow down data processing by adding sleep()

QubesOS/qubes-issues#4791
2021-01-05 04:50:59 +01:00
Marek Marczykowski-Górecki
af13c198be
tests: fix preparing multi-part disk volume
Storing encrypted filename into f_name shadowed unencrypted source file
name.
2021-01-05 04:46:12 +01:00
Marek Marczykowski-Górecki
93608658a9
backup: throttle backup extracting if there is not enough disk space
Instead of failing the restore process, pause data extracting, until
already extracted data gets processed.
This commit implements this for local tar extraction. Extracting data
received from a VM is handled in qfile-(dom0-)unpacker, which also has
similar feature, turned on in 6338b936e2.

Fixes QubesOS/qubes-issues#4791
2021-01-05 04:46:12 +01:00
Marek Marczykowski-Górecki
10d4381c14
backup: check if there is enough disk space available to restore
Avoid failing restore after potentially lengthy processing - check
available space first.

This will be even more important after adding waiting for free space -
then if there won't be enough free space, the process will deadlock.

QubesOS/qubes-issues#4791
2021-01-05 03:33:21 +01:00
Marek Marczykowski-Górecki
16ff6d0552
backup: cleanup retrieve_proc on failure 2021-01-05 03:32:21 +01:00
Marek Marczykowski-Górecki
d906fbc4bb
backup: add function parameter for override temp directory
This will be useful for tests.

QubesOS/qubes-issues#
2021-01-05 03:31:09 +01:00
Marek Marczykowski-Górecki
25a6a305c8
tests: avoid 'xrandr' call
Don't rely on tool existence, nor on a specific monitor layout in test
env.
2020-12-02 04:31:31 +01:00
Marek Marczykowski-Górecki
2266e432bf
gitlab-ci: adjust custom job
- split into two
- add codecov
2020-12-02 04:31:26 +01:00
Frédéric Pierret (fepitre)
e2de2bc0c4
Add .gitlab-ci.yml 2020-11-17 22:49:36 +01:00
Marek Marczykowski-Górecki
6f39533a65
tools/qvm-run: do not check if DispVM is paused before starting it
DispVM is created on start, so it can't be paused - it doesn't exist
yet.

Fixes: 4a6b5db "qvm-run will unpause paused VMs by defaults"
2020-10-24 16:41:22 +02:00
Marek Marczykowski-Górecki
a57396d462
version 4.1.10 2020-10-10 05:11:49 +02:00
Marta Marczykowska-Górecka
fa396a6da9
Better error reporting in qvm_start
When user provides incorrect image name/path, the tool
will now inform what's wrong.
2020-10-07 20:44:32 +02:00
Marek Marczykowski-Górecki
806753bbaa
Fix script executable bit 2020-09-30 02:09:45 +02:00
Marek Marczykowski-Górecki
4fa5154f48
Merge remote-tracking branch 'origin/pr/161'
* origin/pr/161:
  Added supported-service keyboard-layout to allow for better working Qube Manager
2020-09-30 02:09:35 +02:00
Marek Marczykowski-Górecki
2615340b2c
Merge remote-tracking branch 'origin/pr/160'
* origin/pr/160:
  doc: add 'input-dom0-proxy' feature
2020-09-30 02:08:56 +02:00
Marta Marczykowska-Górecka
7fa468eb0c
Added supported-service keyboard-layout to allow for better working Qube Manager
references QubesOS/qubes-issues#6030
2020-09-23 17:24:20 +02:00
Frédéric Pierret (fepitre)
69bf1c5765
doc: add 'input-dom0-proxy' feature 2020-09-20 18:52:53 +02:00
Marek Marczykowski-Górecki
07dfe826f7
qvm-device: improve error message on invalid device type
Fixes QubesOS/qubes-issues#6057
2020-09-16 13:34:56 +02:00
Marek Marczykowski-Górecki
e6186239ef
Make pylint happy
- fix super-with-arguments
- ignore raise-missing-from - too many intentional usages
2020-08-23 03:31:39 +02:00
Marta Marczykowska-Górecka
fe583cd88e
Make incorrect label name error more descriptive
Instead of unintuitive Value Error now we have dedicated QubesLabelNotFoundError.
2020-08-13 20:21:46 +02:00
Marek Marczykowski-Górecki
72f565a36b
version 4.1.9 2020-08-12 11:01:43 +02:00
Marek Marczykowski-Górecki
d8cb35bfac
version 4.1.8 2020-08-11 19:26:32 +02:00
Marek Marczykowski-Górecki
6e91fba942
Merge remote-tracking branch 'origin/pr/157'
* origin/pr/157:
  qvm-run will unpause paused VMs by defaults
2020-08-11 18:42:35 +02:00
Marek Marczykowski-Górecki
a7748d8cdf
Merge remote-tracking branch 'origin/pr/156'
* origin/pr/156:
  Added more resilience to missing permissions to utils
2020-08-11 18:41:55 +02:00
Marek Marczykowski-Górecki
7425a5359b
Cleanup Admin API denial reporting
Rename QubesDaemonNoResponseError to more intuitive
QubesDaemonAccessError (keep legacy name still working).
Use QubesPropertyAccessError whenever the access is about @property -
this makes it easy to use `getattr` to use default value instead.

QubesOS/qubes-issues#5811
2020-08-11 02:06:42 +02:00
Marek Marczykowski-Górecki
b04a14685c
Merge branch 'paranoid-restore'
* paranoid-restore:
  backup/restore: make error reporting work also for StandaloneVM based DispVM
  backup/restore: better error detection for --paranoid-mode
  doc: document 'tag-created-vm-with' feature
  tests: add paranoid backup restore unit tests
  tests: remove extra empty lines
  tests: extend run_service mockup for pre-recorded output
  rpm: add BR: python3-lxml and python3-xcffib
  backup/restore: add option for unattended restore and extracting log
  tools: remove obsolete _want_app argument
  Add "paranoid restore" mode
  rpm/deb: add dependency on scrypt
  utils: add simple locking primitive
  backup/restore: use qfile-unpacker in a VM, request disk space monitoring
  backup/restore: option for alternative qrexec service
  backup/restore: improve error message about restoring tags
  backup/restore: distinguish dom0 by name
2020-08-07 02:55:27 +02:00
Marek Marczykowski-Górecki
c75aeb400a
backup/restore: make error reporting work also for StandaloneVM based DispVM
If management dispvm is based on a StandaloneVM not a AppVM, then there
is just one level of templates, not two.

QubesOS/qubes-issues#4670
2020-08-07 02:12:39 +02:00
Marta Marczykowska-Górecka
4a6b5dbae2
qvm-run will unpause paused VMs by defaults
If qvm-run is run with the autostart option (true by default), it will
also unpause paused VMs.

fixes QubesOS/qubes-issues#5967
2020-08-05 20:49:38 +02:00
Marta Marczykowska-Górecka
37f0641c26
Added more resilience to missing permissions to utils
vm_dependencies function will now no longer throw an exception
when encountering rejection for property_is_default method.
2020-08-05 17:05:27 +02:00
Marek Marczykowski-Górecki
1660a1cbf6
backup/restore: better error detection for --paranoid-mode
Xterm doesn't preserve exit code of the process running inside. This
means, the whole xterm always exits with 0, even if qvm-backup-restore
failed.
Fix this by printing the exit code at the end to the log and then extract
that last line from the log on the calling side. This way we can also
distinguish whether qvm-backup-restore or xterm failed.
2020-08-05 05:06:54 +02:00
Marek Marczykowski-Górecki
0c73e83627
doc: document 'tag-created-vm-with' feature
The actual implementation lives in core-admin repository, but the
canonical list of know features is here.
2020-08-05 05:06:53 +02:00
Marek Marczykowski-Górecki
852b689984
tests: add paranoid backup restore unit tests 2020-08-05 05:06:53 +02:00
Marek Marczykowski-Górecki
bf7b6225e3
tests: remove extra empty lines 2020-08-05 04:37:45 +02:00
Marek Marczykowski-Górecki
7fb90e0233
tests: extend run_service mockup for pre-recorded output
And also handle input written if just stdin.flush() is called but not
stdin.close().
2020-08-05 04:37:45 +02:00
Marek Marczykowski-Górecki
889e606d7c
rpm: add BR: python3-lxml and python3-xcffib
Needed for sphinx documentation build.
2020-08-05 04:37:44 +02:00
Marek Marczykowski-Górecki
7d6cb655f8
backup/restore: add option for unattended restore and extracting log
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
2020-08-05 04:37:44 +02:00
Marek Marczykowski-Górecki
f16f14b020
utils: fix encoding '+' for qubes.VMExec
'+' in an argument needs to be encoded too, otherwise it is interpreted
as arguments separator.
2020-08-04 22:17:04 +02:00
Marek Marczykowski-Górecki
e9120e3196
tools: remove obsolete _want_app argument
It was copied from core-admin but it doesn't make sense here (there is
no loading of qubes.xml).
2020-08-04 04:06:53 +02:00
Marek Marczykowski-Górecki
cc71dd5876
Add "paranoid restore" mode
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
2020-08-04 04:06:53 +02:00
Marek Marczykowski-Górecki
2089e9e730
rpm/deb: add dependency on scrypt
Needed to extract backup archive

QubesOS/qubes-issues#5310
2020-08-04 04:06:30 +02:00
Marek Marczykowski-Górecki
81559d139c
utils: add simple locking primitive
Standard python locking modules do not provide detection if lock-holding
process is still alive. Add a simple wrapper around fcntl.lockf that do
just that.
2020-08-04 04:06:30 +02:00
Marek Marczykowski-Górecki
6338b936e2
backup/restore: use qfile-unpacker in a VM, request disk space monitoring
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
2020-08-04 04:06:30 +02:00
Marek Marczykowski-Górecki
db1d4b5d48
backup/restore: option for alternative qrexec service
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
2020-08-04 04:06:30 +02:00
Marek Marczykowski-Górecki
114f6fb250
backup/restore: improve error message about restoring tags
Before reporting a tag as not restored, verify if it really wasn't
restored. Generally created-by-* tags cannot be created manually. But
when restoring a backup in dom0, created-by-dom0 tag is added, which in
many cases will match what want to be restored.

Adjust tests to check this too.
2020-08-04 04:06:29 +02:00
Marek Marczykowski-Górecki
2b6b4e7954
backup/restore: distinguish dom0 by name
Getting name of QubesVM object doesn't require Admin API call that could
be not allowed by this VM

QubesOS/qubes-issues#5310
2020-08-04 04:06:29 +02:00
Marek Marczykowski-Górecki
b7eca976b5
tests: use asynctest some more
Instead of hoping normal Mock will work (which does not on Python 3.8).
2020-08-03 04:55:46 +02:00
Marek Marczykowski-Górecki
3e1d36fe4a
travis: use sourced config, switch to R4.1 2020-08-03 04:55:46 +02:00
Marek Marczykowski-Górecki
77e1e080d7
Merge remote-tracking branch 'origin/pr/154'
* origin/pr/154:
  Add qubes-guivm-session utility
  qvm-start-daemon: allow --watch without --all
  qvm-start-daemon: convert to async/await syntax
2020-07-31 00:41:27 +02:00
Paweł Marczewski
624e4e32fb
Add qubes-guivm-session utility
To be used in an xsession file (/usr/share/xsessions).
2020-07-29 12:11:03 +02:00