-
Notifications
You must be signed in to change notification settings - Fork 47
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
Updates Whonix-based templates 14 -> 15 #358
Changes from 7 commits
24e6c22
8468657
4ea1524
15f5914
d49f1d9
17adecb
760168b
a1768ec
e6798e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: set syntax=yaml ts=2 sw=2 sts=2 et : | ||
|
||
include: | ||
# Import the upstream Qubes-maintained anon-whonix settings. | ||
# The anon-whoni config pulls in sys-whonix and sys-firewall, | ||
# as well as ensures the latest versions of Whonix are installed. | ||
- qvm.anon-whonix | ||
|
||
# The Qubes logic is too polite about enforcing template | ||
# settings, using "present" rather than "prefs". Below | ||
# we force the template updates. | ||
sys-whonix-template-config: | ||
qvm.vm: | ||
- name: sys-whonix | ||
- prefs: | ||
- template: whonix-gw-15 | ||
- require: | ||
- sls: qvm.anon-whonix | ||
|
||
anon-whonix-template-config: | ||
qvm.vm: | ||
- name: anon-whonix | ||
- prefs: | ||
- template: whonix-ws-15 | ||
- require: | ||
- sls: qvm.anon-whonix |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,33 @@ if [[ $TASK == "prepare" ]]; then | |
fi | ||
fi | ||
|
||
# For Whonix VMs, shut them down, so we can upate the TemplateVM settings. | ||
# We shut down sd-proxy before sd-whonix, since its netvm is sd-whonix, which won't | ||
# shutdown if a client is connected. | ||
if qvm-check --quiet sd-proxy; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-proxy template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
qvm-shutdown --wait sd-proxy | ||
fi | ||
fi | ||
|
||
if qvm-check --quiet sd-whonix; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-whonix template) | ||
if [[ ! $BASE_TEMPLATE =~ "15" ]]; then | ||
qvm-shutdown --wait sd-whonix | ||
fi | ||
fi | ||
|
||
# Kill sys-whonix, to make sure connected clients don't prevent shutdown. | ||
if qvm-check --quiet sys-whonix; then | ||
BASE_TEMPLATE=$(qvm-prefs sys-whonix template) | ||
if [[ ! $BASE_TEMPLATE =~ "15" ]]; then | ||
if qvm-check --quiet --running sys-whonix; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: weird indentation for sys-whonix here, makes it a bit hard to read There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @emkll Ack, this is tabs-versus-spaces. Most of the scripts in the repo use 4 spaces for bash scripts, but this one and only this one uses tabs instead—I wasn't careful about making sure to force use of tabs when editing the script. Agreed, we should indeed clean it up to avoid large amounts of frustration. 😃 |
||
qvm-kill sys-whonix | ||
fi | ||
fi | ||
fi | ||
|
||
# Finally for sd-gpg, we simply shutdown the machine | ||
if qvm-check --quiet sd-gpg; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-gpg template) | ||
|
@@ -57,7 +84,7 @@ if [[ $TASK == "prepare" ]]; then | |
elif [[ $TASK == "remove" ]]; then | ||
# For each template, ensure the TemplateVM exists, that it is shut down | ||
# before deleting it. | ||
for template in sd-svs-template sd-svs-disp-template sd-export-template | ||
for template in sd-svs-template sd-svs-disp-template sd-export-template sd-proxy-template | ||
do | ||
if qvm-check "${template}" --quiet; then | ||
if qvm-check --running "${template}"; then | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import unittest | ||
|
||
from qubesadmin import Qubes | ||
|
||
|
||
CURRENT_FEDORA_VERSION = "30" | ||
CURRENT_WHONIX_VERSION = "15" | ||
|
||
|
||
class SD_Qubes_VM_Tests(unittest.TestCase): | ||
""" | ||
Ensures that the upstream, Qubes-maintained VMs are | ||
sufficiently up to date. | ||
""" | ||
|
||
def setUp(self): | ||
self.app = Qubes() | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_current_fedora_for_sys_vms(self): | ||
""" | ||
Checks that all sys-* VMs are configured to use | ||
an up-to-date version of Fedora. | ||
""" | ||
sys_vms = [ | ||
"sys-firewall", | ||
"sys-net", | ||
"sys-usb", | ||
] | ||
for sys_vm in sys_vms: | ||
vm = self.app.domains[sys_vm] | ||
self.assertTrue(vm.template.name == "fedora-" + CURRENT_FEDORA_VERSION) | ||
|
||
def test_current_whonix_vms(self): | ||
""" | ||
Checks that the Qubes-maintained Whonix tooling | ||
has been updated to the most recent version. | ||
""" | ||
whonix_vms = [ | ||
"sys-whonix", | ||
"anon-whonix", | ||
] | ||
for whonix_vm in whonix_vms: | ||
vm = self.app.domains[whonix_vm] | ||
self.assertTrue(vm.template.name.startswith("whonix-")) | ||
self.assertTrue(vm.template.name.endswith("-" + CURRENT_WHONIX_VERSION)) | ||
|
||
|
||
def load_tests(loader, tests, pattern): | ||
suite = unittest.TestLoader().loadTestsFromTestCase(SD_Qubes_VM_Tests) | ||
return suite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we must require sls sd-upgrade-templates here , to ensure the template update was successful before cloning whonix-ws-15 to sd-proxy-buster-template