Commit Graph

346 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
afc9e645fa
tests: Update tests after fix for filtering stderr 2017-12-05 22:20:53 +01:00
Marek Marczykowski-Górecki
1813988074
Merge remote-tracking branch 'qubesos/pr/39'
* qubesos/pr/39:
  Stop leaking terminal escapes via stderr
2017-12-05 22:18:42 +01:00
Jean-Philippe Ouellet
87230fc042
Stop leaking terminal escapes via stderr
This restores Qubes R3.2 behavior

Before this patch, the following:

    qvm-run -p sys-firewall 'echo -e "\e[0;46mcyan!" >&2' | wc -l

leaks the escape sequences through to the dom0 terminal via stderr,
in this case demonstrated by the ability to change the text color while
it should be fixed to red.

This can also be abused with xterm reporting sequences to cause input
to be sent to the dom0 terminal. This is potentially a security issue.
2017-11-20 23:33:44 -05:00
Marek Marczykowski-Górecki
91759077ff
version 4.0.11 2017-11-21 04:52:46 +01:00
Marek Marczykowski-Górecki
afe4eef15f
Merge remote-tracking branch 'qubesos/pr/38'
* qubesos/pr/38:
  Restore correct colors in verbose mode
  Fix setting stderr default coloring policy
2017-11-20 13:04:42 +01:00
Jean-Philippe Ouellet
6afe5a98c2
Restore correct colors in verbose mode
Restore stderr color when printing to stderr, not stdout color
2017-11-20 00:45:53 -05:00
Jean-Philippe Ouellet
57bf88aa30
Fix setting stderr default coloring policy
stderr default should be set if stderr is None, not if stdout is None
2017-11-20 00:44:07 -05:00
qubesuser
6e844940cc replace key in dir(self) with faster and better code 2017-11-10 16:31:45 +01:00
qubesuser
b731ef3885 replace console entry points with just importing the module
importing pkg_resources and looking up entry points wastes 100ms+
of time, which is totally unnecessary
2017-11-10 16:31:45 +01:00
qubesuser
d08f1a58b7 don't import pkg_resources in the top of qubesadmin/utils.py
It's slow to import
2017-11-10 16:31:45 +01:00
qubesuser
dbd2f0ee06 remove format_doc and docutils import
This wastes 100-200ms loading and removing markup every run and none
of the strings contain any markup anyway...
2017-11-10 16:31:45 +01:00
Marek Marczykowski-Górecki
da327d7abd
version 4.0.10 2017-11-09 11:56:18 +01:00
Marek Marczykowski-Górecki
dc5afa56bf
Merge remote-tracking branch 'qubesos/pr/35'
* qubesos/pr/35:
  make qvm-run work for non-blocking stdin
2017-11-07 22:22:29 +01:00
qubesuser
cb644eb174 make qvm-run work for non-blocking stdin
The main process sometimes sets fd 1 to O_NONBLOCK, and since in the
terminal case fd 0 and 1 are the same fd, this also results in fd 0
being non-blocking, causing qvm-run to crash with EAGAIN.

So just make the code work for both blocking and non-blocking stdin.
2017-11-07 20:43:16 +01:00
Marek Marczykowski-Górecki
7f728e2dad
backup: fix handling labels in Qubes 4.0 backups
Labels can be referred as either id or name. Support both ways.

Fixes QubesOS/qubes-issues#3211
2017-10-29 02:58:37 +02:00
Marek Marczykowski-Górecki
7bcab46f96
tools/qvm-shutdown: fix handling shutdown timeout for multiple VMs
When some VM timeout on shutdown, the tool will try to kill all of them,
but at this point some of them may be already powered off (not all
hanged during shutdown, but only some). Handle this
situation instead of crashing. And add appropriate test.
2017-10-28 22:40:24 +02:00
Marek Marczykowski-Górecki
2fac77da6f
Document device attach options in man page
Fixes QubesOS/qubes-issues#3204
2017-10-24 03:24:43 +02:00
Marek Marczykowski-Górecki
ef17e86810
version 4.0.9 2017-10-21 04:11:20 +02:00
Marek Marczykowski-Górecki
7f269770d5
Merge branch 'fixes-20171019'
* fixes-20171019:
  tools: fix handling qvm-run --no-autostart
  backup: improve migrating templates from Qubes 3.x
2017-10-21 04:10:02 +02:00
Marek Marczykowski-Górecki
61ddccb6d6
Merge branch 'bug3179'
* bug3179:
  Drop log.DBusHandler
  vm: fix handling policy deny on admin.vm.List
2017-10-21 04:09:41 +02:00
Marek Marczykowski-Górecki
8981e71b88
tools: fix handling qvm-run --no-autostart
Fixes QubesOS/qubes-issues#3083
2017-10-19 14:55:33 +02:00
Marek Marczykowski-Górecki
f89d67c3e3
backup: improve migrating templates from Qubes 3.x
In Qubes 3.x any PV template had qrexec-agent and gui-agent installed.
Adjust features appropriately while restoring them.
2017-10-19 14:54:30 +02:00
Marek Marczykowski-Górecki
abc0d0063e
Fix DeviceInfo objects comparing
Do not crash if the other object is completely different type. Return
False ("unequal") instead.

This crashed preparing list of devices in qubes-vm-boot-from-device.

Fixes QubesOS/qubes-issues#3182
2017-10-17 20:40:16 +02:00
Frédéric Pierret
d3ea2845cd
Add CentOS support and fix python3 dependencies for CentOS (except python3-sphinx and python3-daemon which has no python34 package) 2017-10-16 10:20:23 +02:00
Marek Marczykowski-Górecki
bb02c6f4a9
version 4.0.8 2017-10-16 04:44:26 +02:00
Marek Marczykowski-Górecki
a6ff459a1d
tests: multi-part volume in backup tests
Create on of VM's disk volumes big enough to split it into multiple
parts. To do that, add a test of uncompressed backup.

QubesOS/qubes-issues#3167
2017-10-16 04:11:04 +02:00
Marek Marczykowski-Górecki
513163276f
backup: do not try to read tar's stderr past EOF
If EOF is reached on tar's stderr, stop reading it, even if didn't found
expected data. Log this event.

This may happen when tar output some fatal error, instead of filelist.
2017-10-16 04:11:04 +02:00
Marek Marczykowski-Górecki
7a6e8d04b8
backup: improve restoring HVMs from Qubes 3.2
Set kernel to '' - boot from VM's own bootloader.
Keep it on MiniOS-based stubdomain - otherwise Windows would not boot.
2017-10-16 04:11:04 +02:00
Marek Marczykowski-Górecki
d1eab2d4f5
backup: update DispVM template property: template_for_dispvms
It was renamed from 'dispvm_allowed'.

QubesOS/qubes-issues#3047
2017-10-16 04:11:03 +02:00
Marek Marczykowski-Górecki
001b42f7d8
backup: fix name of meminfo-writer feature
It's 'service.meminfo-writer'.
2017-10-16 04:11:02 +02:00
Marek Marczykowski-Górecki
cbdc2170b4
tools: clarify that qvm-backup needs absolute path
Fixes QubesOS/qubes-issues#3066
2017-10-16 03:09:10 +02:00
Marek Marczykowski-Górecki
9cdb2a8152
backup: fix restoring template VMs
os.path.splitext fails on path without proper file base name, like
'/something/..000'. Use plain string methods (rsplit).

Fixes QubesOS/qubes-issues#3167
2017-10-16 03:04:59 +02:00
Marek Marczykowski-Górecki
654da7cb03
Drop log.DBusHandler
Packages had missing dependency on python-dbus. Since DBusHandler isn't
used anywhere, drop it, instead of introducing more dependencies.

Reported by @pietrushnic
QubesOS/qubes-issues#3179
2017-10-16 01:33:03 +02:00
Marek Marczykowski-Górecki
2f7d1ca476
vm: fix handling policy deny on admin.vm.List
vm.get_power_state() have specifically documented 'NA' state for cases
when it's unable to get VM's power state. Use this when qrexec policy
forbid checking it.

Reported by @pietrushnic
Fixes QubesOS/qubes-issues#3179
2017-10-16 01:32:56 +02:00
Marek Marczykowski-Górecki
17670eae1b
version 4.0.7 2017-10-08 18:42:41 +02:00
Marek Marczykowski-Górecki
0187588531
tools: adjust qvm-start message and logic, update tests
QubesOS/qubes-issues#3130
2017-10-08 18:17:03 +02:00
Marek Marczykowski-Górecki
bf4c9bacb4
Merge remote-tracking branch 'qubesos/pr/28'
* qubesos/pr/28:
  qvm-start: exit if domain running and no --skip-if-running
2017-10-08 17:14:47 +02:00
Marek Marczykowski-Górecki
45a7c5516c
rpm: add conflict with too-old qubes-manager
There is an API change, be sure to install both updates at the same
time.
2017-10-08 16:59:55 +02:00
Marek Marczykowski-Górecki
98e39ca63b
vm: drop suspend and resume methods - not part of the Admin API 2017-10-04 15:26:57 +02:00
Marek Marczykowski-Górecki
559cc9b0d6
tools/qvm-start: fix starting a VM with cdrom image
1. Output of `losetup` command contains `\n` - strip it.
2. Provide read-only option - if device info hasn't propagated to qubesd
yet, it will not be set automatically.

Fixes QubesOS/qubes-issues#3146
2017-10-04 15:18:28 +02:00
Marek Marczykowski-Górecki
8476afc306
tools: finish 'qvm-volume revert' implementation, add tests
It wasn't aware of snapshot identifier, fix that. Also update to use
VM:VOLUME syntax, not POOL:VID.
2017-10-02 21:12:17 +02:00
Marek Marczykowski-Górecki
c87820fba8
Drop individual VM classes as python types completely
Since those are unused now, remove them from the source, so it is easier
to debug the code (avoid never matching isinstance(...)).
2017-10-02 21:12:16 +02:00
Marek Marczykowski-Górecki
b55f615942
Move vm.appvms to QubesVM
First, TemplateVM is not used anymore (see previous commit). Second,
don't harcode on client side that "only TemplateVM can be a template for
any VM" (which actually isn't true: AppVM can be a template for DispVM).
2017-10-02 21:12:16 +02:00
Marek Marczykowski-Górecki
edcaed537a
Always use QubesVM objects, instead of AppVM/TemplateVM etc
Very few calls at client side really needs VM class name. So, even in
non-blind mode use just QubesVM class, to avoid strange cases depending
on blind mode being enabled or not. Then, have VM class name in 'klass'
property. If known at object creation time, cache it, otherwise query
qubesd at first access.
2017-10-02 21:12:16 +02:00
Mindy Preston
76c4a6421b qvm-start: exit if domain running and no --skip-if-running 2017-09-27 17:15:52 -05:00
Marek Marczykowski-Górecki
ab9a57a544
tools: fix qvm-run --help
QubesOS/qubes-issues#
2017-09-20 22:53:30 +02:00
Marek Marczykowski-Górecki
0a06ad9152
events: ignore events from non-existing domains
It may happen that when client handle the event, domain no longer
exists. This is for example common for DispVMs, which get removed just
after shutdown.
This will cause some events to be dropped, but one can enable blind
mode, to get them anyway (because it will not cause KeyError, even if
domain is already removed).

QubesOS/qubes-issues#3100
2017-09-20 20:19:38 +02:00
Marek Marczykowski-Górecki
b28ddb6621
Implement "blind mode" to avoid listing objects
This allows to perform actions on objects (VM, storage etc), without
listing them. This is useful when calling VM have minimal permissions
and only selected actions are allowed.

This means that app.domains['some-name'] will not raise KeyError, even
when domain do not exists. But performing actual action (like
vm.start()) will fail in that case.
2017-09-20 20:18:59 +02:00
Marek Marczykowski-Górecki
0eec5cb8c9
version 4.0.6 2017-09-14 02:47:48 +02:00
Marek Marczykowski-Górecki
5e2638ab5e
tools: restore qvm-start --cdrom and similar options
Booting a VM from cdrom require attaching the device before VM startup,
which is possible only in persistent mode. But for qvm-start --cdrom
adding a cdrom only temporarily, use new update_persistence() function
to convert the assignment to temporary one.

Fixes QubesOS/qubes-issues#3055
2017-09-05 08:33:47 +02:00