Skip to content

Commit

Permalink
Merge pull request #938 from freedomofpress/whonix-17
Browse files Browse the repository at this point in the history
Support Whonix 17
  • Loading branch information
zenmonkeykstop authored Feb 6, 2024
2 parents 4b1ebfb + 66b737b commit 2b3b03d
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ sd-app: prep-dev ## Provisions SD APP VM

sd-whonix: prep-dev ## Provisions SD Whonix VM
sudo qubesctl --show-output state.sls sd-whonix
sudo qubesctl --show-output --skip-dom0 --targets whonix-gw-16,sd-whonix state.highstate
sudo qubesctl --show-output --skip-dom0 --targets whonix-gateway-17,sd-whonix state.highstate

sd-viewer: prep-dev ## Provisions SD Submission Viewing VM
sudo qubesctl --show-output state.sls sd-viewer
Expand Down
12 changes: 0 additions & 12 deletions dom0/sd-dom0-files.sls
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ dom0-securedrop-icon:
- require:
- file: dom0-securedrop-icons-directory

dom0-enabled-apparmor-on-whonix-gw-template:
qvm.vm:
- name: whonix-gw-16
- prefs:
- kernelopts: "nopat apparmor=1 security=apparmor"

dom0-enabled-apparmor-on-whonix-ws-template:
qvm.vm:
- name: whonix-ws-16
- prefs:
- kernelopts: "nopat apparmor=1 security=apparmor"

dom0-create-opt-securedrop-directory:
file.directory:
- name: /opt/securedrop
Expand Down
45 changes: 42 additions & 3 deletions dom0/sd-sys-whonix-vms.sls
Original file line number Diff line number Diff line change
@@ -1,22 +1,61 @@
# -*- coding: utf-8 -*-
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :

##
# Install latest Whonix template, configure apparmor on installed templates,
# and ensure sys-whonix and anon-whonix use latest version.
##

include:
- sd-upgrade-templates

{% set sd_supported_whonix_version = '17' %}

whonix-gateway-installed:
qvm.template_installed:
- name: whonix-gateway-{{ sd_supported_whonix_version }}
- fromrepo: qubes-templates-community

whonix-workstation-installed:
qvm.template_installed:
- name: whonix-workstation-{{ sd_supported_whonix_version }}
- fromrepo: qubes-templates-community

dom0-enabled-apparmor-on-whonix-gw-template:
qvm.vm:
- name: whonix-gateway-{{ sd_supported_whonix_version }}
- prefs:
- kernelopts: "nopat apparmor=1 security=apparmor"
- require:
- sls: sd-upgrade-templates
- qvm: whonix-gateway-installed
- qvm: whonix-workstation-installed

dom0-enabled-apparmor-on-whonix-ws-template:
qvm.vm:
- name: whonix-workstation-{{ sd_supported_whonix_version }}
- prefs:
- kernelopts: "nopat apparmor=1 security=apparmor"
- require:
- sls: sd-upgrade-templates
- qvm: whonix-gateway-installed
- qvm: whonix-workstation-installed

# 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-16
- template: whonix-gateway-{{ sd_supported_whonix_version }}
- require:
- sls: sd-upgrade-templates
- qvm: dom0-enabled-apparmor-on-whonix-gw-template

anon-whonix-template-config:
qvm.vm:
- name: anon-whonix
- prefs:
- template: whonix-ws-16
- template: whonix-workstation-{{ sd_supported_whonix_version }}
- require:
- qvm: dom0-enabled-apparmor-on-whonix-ws-template
4 changes: 3 additions & 1 deletion dom0/sd-whonix.sls
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

include:
- sd-upgrade-templates
- sd-sys-whonix-vms

sd-whonix:
qvm.vm:
Expand All @@ -24,7 +25,7 @@ sd-whonix:
- label: purple
- mem: 500
- prefs:
- template: whonix-gw-16
- template: whonix-gateway-17
- provides-network: true
- netvm: "sys-firewall"
- autostart: true
Expand All @@ -35,3 +36,4 @@ sd-whonix:
- sd-{{ sdvars.distribution }}
- require:
- sls: sd-upgrade-templates
- sls: sd-sys-whonix-vms
4 changes: 2 additions & 2 deletions dom0/securedrop-handle-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if [[ $TASK == "prepare" ]]; then
# is not, we want to ensure a smooth upgrade.
if qvm-check --quiet sd-whonix; then
BASE_TEMPLATE=$(qvm-prefs sd-whonix template)
if [[ ! $BASE_TEMPLATE =~ "16" ]]; then
if [[ ! $BASE_TEMPLATE =~ "17" ]]; then
qvm-shutdown --wait sd-proxy
qvm-shutdown --wait sd-whonix
fi
Expand All @@ -71,7 +71,7 @@ if [[ $TASK == "prepare" ]]; then
# 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 =~ "16" ]]; then
if [[ ! $BASE_TEMPLATE =~ "17" ]]; then
if qvm-check --quiet --running sys-whonix; then
qvm-kill sys-whonix
# Wait for machine to stop fully, since qvm-kill doesn't block
Expand Down
2 changes: 1 addition & 1 deletion launcher/sdw_updater_gui/Updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"sd-log": "sd-small-{}-template".format(DEBIAN_VERSION),
"sd-devices": "sd-large-{}-template".format(DEBIAN_VERSION),
"sd-proxy": "sd-small-{}-template".format(DEBIAN_VERSION),
"sd-whonix": "whonix-gw-16",
"sd-whonix": "whonix-gateway-17",
"sd-gpg": "sd-small-{}-template".format(DEBIAN_VERSION),
}

Expand Down
4 changes: 2 additions & 2 deletions launcher/tests/test_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def test_shutdown_and_start_vms(
call("fedora-38"),
call("sd-large-{}-template".format(DEBIAN_VERSION)),
call("sd-small-{}-template".format(DEBIAN_VERSION)),
call("whonix-gw-16"),
call("whonix-gateway-17"),
]
app_vm_calls = [
call("sd-app"),
Expand Down Expand Up @@ -541,7 +541,7 @@ def test_shutdown_and_start_vms_sysvm_fail(
call("fedora-38"),
call("sd-large-{}-template".format(DEBIAN_VERSION)),
call("sd-small-{}-template".format(DEBIAN_VERSION)),
call("whonix-gw-16"),
call("whonix-gateway-17"),
]
error_calls = [
call("Error while killing system VM: sys-firewall"),
Expand Down
2 changes: 1 addition & 1 deletion rpm-build/SPECS/securedrop-workstation-dom0-config.spec
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ find /srv/salt -maxdepth 1 -type f -iname '*.top' \

# Force full run of all Salt states - uncomment in release branch
# mkdir -p /tmp/sdw-migrations
# touch /tmp/sdw-migrations/f38-update
# touch /tmp/sdw-migrations/whonix-17-update

%changelog
* Thu Nov 23 2023 SecureDrop Team <[email protected]> - 0.9.0
Expand Down
2 changes: 1 addition & 1 deletion tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
WANTED_VMS = ["sd-gpg", "sd-log", "sd-proxy", "sd-app", "sd-viewer", "sd-whonix", "sd-devices"]
CURRENT_FEDORA_VERSION = "38"
CURRENT_FEDORA_TEMPLATE = "fedora-" + CURRENT_FEDORA_VERSION
CURRENT_WHONIX_VERSION = "16"
CURRENT_WHONIX_VERSION = "17"


# Lifted from launcher/sdw_util/Util.py
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vms_exist.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_sd_whonix_config(self):
self.assertTrue(nvm.name == "sys-firewall")
wanted_kernelopts = "nopat apparmor=1 security=apparmor"
self.assertEqual(vm.kernelopts, wanted_kernelopts)
self.assertTrue(vm.template == "whonix-gw-16")
self.assertTrue(vm.template == "whonix-gateway-17")
self.assertTrue(vm.provides_network)
self.assertTrue(vm.autostart is True)
self.assertFalse(vm.template_for_dispvms)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_vms_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@


BULLSEYE_STRING = "Debian GNU/Linux 11 (bullseye)"
BOOKWORM_STRING = "Debian GNU/Linux 12 (bookworm)"

SUPPORTED_SD_DEBIAN_DIST = "bullseye"
SUPPORTED_WHONIX_PLATFORMS = [BULLSEYE_STRING]
SUPPORTED_WHONIX_PLATFORMS = [BOOKWORM_STRING]


apt_url = ""
Expand Down

0 comments on commit 2b3b03d

Please sign in to comment.