Commit Graph

386 Commits

Author SHA1 Message Date
7f04a0c1c5 Forwarding succesfully added e saved in XML 2021-06-25 10:50:02 +02:00
0b476df8b5 Fix bugs found in testing 2021-06-25 02:05:54 +02:00
0256ec981d Added copypasted srcports= support 2021-06-22 18:51:48 +02:00
e7d006f986 Added forward to qvm-firewall help 2021-06-22 01:41:37 +02:00
Marek Marczykowski-Górecki
638dbf6143
Fix gui-daemon cleanup
The cleanup requires XID of the domain, but when it's shut off already,
it's too late to retrieve it. Cache value retrieved when the domain was
still running (either domain-start event, or program startup).
2021-05-22 13:02:40 +02:00
Marek Marczykowski-Górecki
8be74249df
Guard qvm-start-daemon with generic 'guivm' or 'audiovm' services
Not a flavor-specific one (guivm-gui-agent).

QubesOS/qubes-issues#4186
2021-05-21 21:03:36 +02:00
3hhh
7c977f98a5
qvm-ls & qvm-device: Handle removal of VM during on_shutdown.
Fixes QubesOS/qubes-issues#5105
2021-04-09 18:19:39 +02:00
Marek Marczykowski-Górecki
6c376d68c4
qvm-template: fix installing already cached templates
And also enhance tests to verify download() function return value.
2021-04-02 03:50:11 +02:00
Marek Marczykowski-Górecki
7978e17aeb
Merge remote-tracking branch 'origin/pr/145'
* origin/pr/145: (119 commits)
  qvm-template: fix downloading template for install
  tests: add tests for other qvm-template functions
  tests: improve TestProcess behavior
  tests: add tests for qvm-template reinstall/up/downgrade when nothing needs to be done
  tests: fix mock return values of get_dl_list when testing `qvm-template reinstall`
  qvm-template: update comments to reflect e424c7d
  qvm-template: only ask for confirmation during install if something is being done
  tests: add more tests re. install, remove, and get_keys_for_repos
  qvm-template: test != 1 instead of == 0 for template-dummy feature
  tests: fix tests for verify_rpm involving incorrect template names
  tests: add tests for qvm-template remove
  tests: some more for qvm-template
  qvm-template: mute pylint complains about typing.NamedTuple
  tests: qvm-template-postprocess - template.conf handling
  qvm-template-postprocess: fix allowed features list
  qvm-template-postprocess: extract config handling into separate function
  qvm-template-postprocess: treat missing appmenus files as warnings only
  qvm-template: default confirm to 'n'
  qvm-template: verify template package signature directly at download
  qvm-template: improve error reporting
  ...
2021-04-01 20:23:46 +02:00
Marek Marczykowski-Górecki
9020f2e1fd
qvm-template: fix downloading template for install
Donwload a template into a cache dir, not into default of `qvm-template
download` (current directory).
2021-04-01 01:48:29 +02:00
WillyPillow
fc520f8ed4
qvm-template: update comments to reflect e424c7d 2021-02-21 02:11:23 +08:00
WillyPillow
dedf5ac6e6
qvm-template: only ask for confirmation during install if something is being done 2021-02-21 02:09:23 +08:00
WillyPillow
60f5ba0e23
qvm-template: test != 1 instead of == 0 for template-dummy feature 2021-02-20 09:57:59 +08:00
WillyPillow
ed3e368673
tests: add tests for qvm-template remove 2021-02-20 09:46:56 +08:00
Marek Marczykowski-Górecki
f4e826e65d
qvm-template: mute pylint complains about typing.NamedTuple
This is false positive, PyCQA/pylint#3732
2021-02-19 17:21:39 +01:00
Marek Marczykowski-Górecki
2c5572b3d9
qvm-template-postprocess: fix allowed features list
Add missing coma, otherwise 'gui-emulated' and 'qrexec' were glued
together.
2021-02-19 15:10:16 +01:00
Marek Marczykowski-Górecki
c4efdf41c5
qvm-template-postprocess: extract config handling into separate function
Keep post_install() short.
2021-02-19 15:10:15 +01:00
Marek Marczykowski-Górecki
bcf59579f1
qvm-template-postprocess: treat missing appmenus files as warnings only
Do not fail if *-whitelisted-appmenus.list files are not included in the
template package, only log an error.

While at it, use pathlib there to make the code a bit nicer.
2021-02-19 14:02:53 +01:00
Marek Marczykowski-Górecki
e6360da22e
qvm-template: default confirm to 'n'
Capital 'N' in the prompt suggests it is the default - really make it
the default.
2021-02-19 01:12:26 +01:00
Marek Marczykowski-Górecki
e424c7df9c
qvm-template: verify template package signature directly at download
Make the download() function save the package into a temporary space and
move to the target location only after checking the signature. This is
safer option than requiring all callers to explicitly verify the
signature. Also, make the download() function verify if the template
name inside the package matches what was requested.
Especially, make `qvm-template download` action verify the signature
too.

On `qvm-template install` avoid checking the signature again for
downloaded packages, by passing extra argument to the verify_rpm()
function. But still verify signature of packages loaded from disk.
2021-02-18 21:43:57 +01:00
Marek Marczykowski-Górecki
ce36dc55c5
qvm-template: improve error reporting
Do not print the whole traceback by default - do that only when
--verbose is used.
2021-02-07 03:35:17 +01:00
Marek Marczykowski-Górecki
8795668233
qvm-template-postprocess: do not generate appmenus twice
Skip initial generate, as it's done before actual menu entries are
extracted from the template. But do call it if we aren't going to
extract menu entries initially - it will create just "settings" menu
entry.
2021-02-07 03:35:16 +01:00
Marek Marczykowski-Górecki
b7446afe3b
qvm-template: use key specified in the repo definition if possible
This makes the package verified against _only_ the key specified in the
repo config, not all the trusted keys.
If repo does not specify a key, use the default one (change this to a
single file, instead of the whole directory). Existing 'gpgkey' entry
pointing at non-existing file will result in an error.
2021-02-07 03:35:16 +01:00
Marek Marczykowski-Górecki
4f9757ca88
qvm-template: by default list only latest available template
But add --all-versions option to get all the available versions.
2021-02-07 03:35:16 +01:00
Marek Marczykowski-Górecki
86326b53c4
qvm-template: factor filter_version() out of get_dl_list()
This allows reusing version filtering (getting only a single version per
template) in other places.

For equal versions packages, prefer the one from non-testing repository.
2021-02-07 03:35:16 +01:00
Marek Marczykowski-Górecki
10bea1b77e
qvm-template: allow global arguments after action name
It's convenient to use for example
`qvm-template list --enablerepo=*-testing`
Previously, _some_ options needed to be before action name.
2021-02-07 03:35:16 +01:00
Marek Marczykowski-Górecki
e0063d8808
qvm-template: use QubesArgumentParser
It produces consistent help for subcommands and already handles
--verbose/--quiet.
2021-02-07 03:35:15 +01:00
Marek Marczykowski-Górecki
6980e7ba14
Store template repo configuration in /etc
This way it's easier to permanently enable repos.
2021-02-06 16:03:40 +01:00
Marek Marczykowski-Górecki
ed6aff3b1e
qvm-template-preprocess: remove confusing message
Don't confuse user during normal template install.
2021-02-06 16:03:40 +01:00
Marek Marczykowski-Górecki
f053f51644
qvm-template: remove downloaded package after installation
At least by default. Otherwise they will pile up in the cache dir.
2021-02-06 16:03:39 +01:00
Marek Marczykowski-Górecki
fe369ce523
qvm-template: cleanup install function
Remove now unused try/finally in install() and reduce indentation.

No functional change.
2021-02-06 16:03:39 +01:00
Marek Marczykowski-Górecki
f1424812b0
qvm-template: improve install lock
Use fcntl.flock() instead of just file existence check, so it won't fail
on a stale lock file. While at it, move locking to a function decorator,
to de-clutter the install function a bit. This will allow reducing
indentation level, but don't do it yet, to make the patch readable.

Move lock testing into a separate test, and remove it from install
tests.

QubesOS/qubes-issues#2534
2021-02-06 16:03:39 +01:00
Marek Marczykowski-Górecki
febf014d14
qvm-template-postprocess: improve data validation
- validate if IP has correct syntax
- print warning if value is invalid

QubesOS/qubes-issues#2534
2021-02-06 16:03:39 +01:00
Marek Marczykowski-Górecki
940124948a
qvm-template: minor improvements
- rename parser_gen to get_parser - for consistency with other tools
- clarify 'storage pool'
- move '-' to the end in regex characters list

QubesOS/qubes-issues#2534
2021-02-06 16:03:38 +01:00
Marek Marczykowski-Górecki
8aede943cc
qvm-template: add copyright header 2021-02-06 16:03:38 +01:00
Marek Marczykowski-Górecki
aeeb3daa80
qvm-template: handle template extraction failure
QubesOS/qubes-issues#2534
2021-02-06 16:03:38 +01:00
Marek Marczykowski-Górecki
f3954fb225
qvm-template: download templates to a temporary directory
Avoid risk of conflicting downloads to the same directory, reusing
partial downloads, leaving broken files etc. Move template package out
of temporary directory only after its verified.

QubesOS/qubes-issues#2534
2021-02-06 16:03:38 +01:00
Marek Marczykowski-Górecki
f3f6750a3f
qvm-template: call rpmkeys --checksig for signature verification
RPM API is confusing and it's easy to get it wrong when verifying
package signatures.
Call 'rpmkeys --checksig' which is more rebust here - RPM authors should
know how to use their API.

QubesOS/qubes-issues#2534
2021-02-06 16:03:38 +01:00
Marek Marczykowski-Górecki
b500462abb
qvm-template: use UpdateVM by default
Do not hardcode sys-firewall
2021-02-06 16:03:37 +01:00
Rusty Bird
e78512b4b1
qvm-backup: dom0 dst relative to cwd of tool, not qubesd 2021-02-02 19:05:12 +00: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
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
WillyPillow
1671b4216f
qvm-template: Add tests for download function and fix minor bugs 2020-10-04 03:05:14 +08: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
WillyPillow
5f03640467
qvm-template: Fix broken indention 2020-09-15 01:30:57 +08:00
WillyPillow
7facc7d35f
qvm-template: Fix minor bugs
* Incomprehensive spec filtering in `list_templates`
* Type error of `install_time` in `list_templates`
* Incorrect version comparision in `search`
2020-09-15 00:23:06 +08:00
WillyPillow
b9f1d4c633
qvm-template: Make pylint happy 2020-09-07 02:12:22 +08:00
WillyPillow
554459ef42
qvm-template: Fix compatibility with Python 3.6 2020-09-07 01:53:43 +08:00
WillyPillow
3fac2097eb
qvm-template: Add partial tests for qrexec_repoquery 2020-09-07 01:52:56 +08:00
WillyPillow
89895038b5
qvm-template: Fix date formats to "%Y-%m-%d %H:%M:%S" 2020-09-06 23:57:42 +08:00