Skip to content

Commit 20c89cb

Browse files
authored
Merge pull request #1415 from freedomofpress/456-whonix-deprecation-part2
Remove sd-whonix and whonix-gateway FPF packages and repos
2 parents f7b79a3 + 11698da commit 20c89cb

22 files changed

+97
-335
lines changed

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ test-app: test-prereqs ## Runs tests for SD APP VM config
9292
test-proxy: test-prereqs ## Runs tests for SD Proxy VM
9393
pytest -v tests/test_proxy_vm.py
9494

95-
test-whonix: test-prereqs ## Runs tests for SD Whonix VM
96-
pytest -v tests/test_sd_whonix.py
97-
9895
test-gpg: test-prereqs ## Runs tests for SD GPG functionality
9996
pytest -v tests/test_gpg.py
10097

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The current architecture replaces the *Journalist Workstation* and *Secure Viewi
5353

5454
Currently, the following VMs are provisioned:
5555

56-
- `sd-proxy` is where the SecureDrop proxy and the Tor gateway reside, which allows the non-networked `sd-app` vm to communicate with the *Journalist Interface* over Tor.
56+
- `sd-proxy` is where the SecureDrop proxy resides, which allows the non-networked `sd-app` vm to communicate with the *Journalist Interface* over Tor. It's configured with the auth key for the hidden service.
5757
- `sd-app` is a non-networked VM in which the *SecureDrop Client* runs used to store and explore submissions after they're unarchived and decrypted. Any files opened in this VM are opened in a disposable VM.
5858
- `sd-gpg` is a Qubes split-gpg AppVM, used to hold submission decryption keys and do the actual submission crypto.
5959
- `sd-viewer` is an AppVM used as the template for the disposable VMs used for processing and opening files.
@@ -92,11 +92,10 @@ This repo also contains the following developer-facing components:
9292
SecureDrop Workstation has a companion repository, [SecureDrop Client](https://github.com/freedomofpress/securedrop-client/),
9393
that contains component code for all of the packages we ship in individual VMs once they have been provisioned:
9494
- The [SecureDrop Client](https://github.com/freedomofpress/securedrop-client/tree/main/client#readme) is installed in `sd-app` and will be used to access the SecureDrop server *Journalist Interface* via the SecureDrop proxy.
95-
- The [SecureDrop Proxy](https://github.com/freedomofpress/securedrop-client/tree/main/proxy#readme) is installed in `sd-proxy` to communicate to the SecureDrop server *Journalist Interface* via `sd-whonix`.
95+
- The [SecureDrop Proxy](https://github.com/freedomofpress/securedrop-client/tree/main/proxy#readme) is installed in `sd-proxy` to communicate to the SecureDrop server *Journalist Interface* via Tor.
9696
- [SecureDrop Export](https://github.com/freedomofpress/securedrop-client/tree/main/export#readme) is installed in `sd-devices` and is used to manage printing and exporting files.
9797
- The *SecureDrop Client* opens all submissions in the networkless, disposable `sd-viewer` VM
9898
- A logging VM, `sd-log`, is provisioned to capture logs locally from various parts of the system
99-
- A [Whonix](https://www.whonix.org/wiki/Homepage) VM, `sd-whonix`, is provisioned with instance-specific information required to access the authenticated onion service used by journalists.
10099

101100
### Additional Notes:
102101

files/sdw-admin.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
from qubesadmin import Qubes
1515

16-
from sdw_util import Util
17-
1816
# The max concurrency reduction (4->2) was required to avoid "did not return clean data"
1917
# errors from qubesctl. It may be possible to raise this again.
2018
MAX_CONCURRENCY = 2
@@ -111,12 +109,15 @@ def provision_and_configure():
111109
provision("Provisioning base template", "securedrop_salt.sd-base-template")
112110
configure("Configuring base template", ["sd-base-bookworm-template"])
113111
provision_all()
114-
configure("Enabling Whonix customizations", [f"whonix-gateway-{Util.get_whonix_version()}"])
115112
configure(
116113
"Configure all SecureDrop Workstation VMs with service-specific configs",
117114
[q.name for q in Qubes().domains if "sd-workstation" in q.tags],
118115
)
119116

117+
if "whonix-gateway-17" in Qubes().domains:
118+
# Qubes installations without whonix
119+
configure("Disabling Whonix customizations", ["whonix-gateway-17"])
120+
120121
sync_appmenus()
121122

122123
if "sd-fedora-42-dvm" in Qubes().domains:
@@ -213,14 +214,8 @@ def sync_appmenus():
213214
run_cmd(["qvm-sync-appmenus", "sd-large-bookworm-template"])
214215
run_cmd(["qvm-shutdown", "sd-large-bookworm-template"])
215216

216-
whonix_gateway = f"whonix-gateway-{Util.get_whonix_version()}"
217-
run_cmd(["qvm-start", "--skip-if-running", whonix_gateway])
218-
run_cmd(["qvm-sync-appmenus", whonix_gateway])
219-
run_cmd(["qvm-shutdown", whonix_gateway])
220-
221217
# These are the ones we show in prod VMs, so sync explicitly
222218
run_cmd(["qvm-sync-appmenus", "--regenerate-only", "sd-devices"])
223-
run_cmd(["qvm-sync-appmenus", "--regenerate-only", "sd-whonix"])
224219
run_cmd(["qvm-sync-appmenus", "--regenerate-only", "sd-log"])
225220

226221

launcher/tests/test_updater.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"sd-viewer",
1818
"sd-gpg",
1919
"sd-proxy",
20-
"sd-whonix",
2120
"sd-devices",
2221
]
2322

@@ -53,14 +52,12 @@
5352
}
5453

5554

56-
@mock.patch("sdw_util.Util.get_whonix_version", return_value=WHONIX_VERSION)
57-
def test__get_current_vms(mocked_get_whonix_version):
58-
assert len(Updater._get_current_vms()) == 8
55+
def test__get_current_vms():
56+
assert len(Updater._get_current_vms()) == 7
5957

6058

61-
@mock.patch("sdw_util.Util.get_whonix_version", return_value=WHONIX_VERSION)
62-
def test__get_current_templates(mocked_get_whonix_version):
63-
assert len(Updater._get_current_templates()) == 4
59+
def test__get_current_templates():
60+
assert len(Updater._get_current_templates()) == 3
6461

6562

6663
@mock.patch("sdw_updater.Updater._write_updates_status_flag_to_disk")
@@ -130,8 +127,7 @@ def test_apply_templates_success(
130127
),
131128
],
132129
)
133-
@mock.patch("sdw_util.Util.get_whonix_version", return_value=WHONIX_VERSION)
134-
def test_apply_templates(whonix_ver_mock, templates, stderr, expected):
130+
def test_apply_templates(templates, stderr, expected):
135131
with (
136132
mock.patch(
137133
"sdw_updater.Updater._start_qubes_updater_proc",

launcher/tests/test_util.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,3 @@ def test_is_sdapp_halted_error(patched_subprocess, os_release_fixture, version_c
304304
"""
305305

306306
assert not Util.is_sdapp_halted()
307-
308-
309-
@mock.patch("subprocess.check_output", return_value=str(WHONIX_VERSION))
310-
def test_get_whonix_version(patched_subprocess):
311-
assert Util.get_whonix_version() == WHONIX_VERSION
312-
313-
314-
@mock.patch("subprocess.check_output", side_effect=subprocess.CalledProcessError(1, "check_output"))
315-
def test_get_whonix_version__on_error(patched_subprocess):
316-
with pytest.raises(RuntimeError, match="Whonix version could not be obtained"):
317-
Util.get_whonix_version()

sdw_updater/Updater.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939

4040
def _get_current_vms():
4141
debian_version = "bookworm"
42-
whonix_version = Util.get_whonix_version()
4342

4443
# The are the TemplateVMs that require full patch level at boot in order to start the client,
4544
# as well as their associated TemplateVMs.
@@ -51,7 +50,6 @@ def _get_current_vms():
5150
"sd-log": f"sd-small-{debian_version}-template",
5251
"sd-devices": f"sd-large-{debian_version}-template",
5352
"sd-proxy": f"sd-small-{debian_version}-template",
54-
"sd-whonix": f"whonix-gateway-{whonix_version}",
5553
"sd-gpg": f"sd-small-{debian_version}-template",
5654
}
5755

sdw_util/Util.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -148,40 +148,6 @@ def get_qubes_version():
148148
return version
149149

150150

151-
def get_whonix_version():
152-
"""
153-
Obtain Whonix version from /srv/formulas/base/virtual-machine-formula/qvm/whonix.jinja
154-
155-
In '.sls' files the whonix version is obtained with
156-
157-
{% import "qvm/whonix.jinja" as whonix %}
158-
{{ whonix.whonix_version }}
159-
160-
This function extracts this value so that it can be on this script.
161-
162-
NOTE: function takes a few seconds to run
163-
"""
164-
165-
try:
166-
output = subprocess.check_output(
167-
[
168-
"sudo",
169-
"qubesctl",
170-
"jinja.load_map",
171-
"qvm/whonix.jinja",
172-
"whonix_version",
173-
"--out",
174-
"newline_values_only",
175-
], # avoid "local:" prefix
176-
universal_newlines=True,
177-
)
178-
whonix_version = int(output.strip())
179-
except (AttributeError, ValueError, subprocess.CalledProcessError):
180-
raise RuntimeError("Whonix version could not be obtained")
181-
182-
return whonix_version
183-
184-
185151
def get_logger(prefix=SD_LOGGER_PREFIX, module=None):
186152
if module is None:
187153
return logging.getLogger(prefix)

securedrop_salt/sd-base-template-packages.sls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ install-qubes-vm-recommended:
1616
sd-base-template-install-securedrop-packages:
1717
pkg.installed:
1818
- pkgs:
19-
- securedrop-qubesdb-tools
2019
- securedrop-workstation-config
2120
- securedrop-workstation-grsec
2221
- require:

securedrop_salt/sd-clean-all.sls

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :
33

44
{% import_json "securedrop_salt/config.json" as d %}
5-
{% import "qvm/whonix.jinja" as whonix %}
65

76
set-fedora-as-default-dispvm:
87
cmd.run:
@@ -75,12 +74,6 @@ sd-cleanup-sys-firewall:
7574
- qvm-run sys-firewall 'sudo rm -f /etc/pki/rpm-gpg/RPM-GPG-KEY-securedrop-workstation'
7675
- qvm-run sys-firewall 'sudo rm -f /etc/pki/rpm-gpg/RPM-GPG-KEY-securedrop-workstation-test'
7776

78-
sd-cleanup-whonix-gateway:
79-
cmd.run:
80-
- names:
81-
- qvm-run whonix-gateway-{{ whonix.whonix_version }} 'sudo apt purge --yes securedrop-keyring securedrop-qubesdb-tools securedrop-whonix-config'
82-
- qvm-run whonix-gateway-{{ whonix.whonix_version }} 'sudo rm -f /etc/apt/sources.list.d/apt-test_freedom_press.sources'
83-
8477
# Reset desktop icon size to its original value
8578
dom0-reset-icon-size-xfce:
8679
cmd.script:

securedrop_salt/sd-remove-deprecated-qubes.sls renamed to securedrop_salt/sd-remove-unused-qubes.sls

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
# WARNING: only remove when complete reinstall is assumed (e.g. 1.0.0 release)
66
# This is because the workstation may have been offline for a while
77
# and skipped some salt updates.
8-
{% for untagged_qube in ["sd-retain-logvm"] %}
8+
{% for qube_name in ["sd-retain-logvm", "sd-whonix"] %}
99

10-
poweroff-before-removal-{{ untagged_qube }}:
10+
poweroff-before-removal-{{ qube_name }}:
1111
qvm.shutdown:
12-
- name: {{ untagged_qube }}
12+
- name: {{ qube_name }}
1313
- flags:
1414
- force
1515
- wait
1616
- onlyif:
17-
- qvm-check --quiet {{ untagged_qube }}
17+
- qvm-check --quiet {{ qube_name }}
1818
- order: last
1919

20-
remove-{{ untagged_qube }}:
20+
remove-{{ qube_name }}:
2121
qvm.absent:
22-
- name: {{ untagged_qube }}
22+
- name: {{ qube_name }}
2323
- require:
24-
- qvm: poweroff-before-removal-{{ untagged_qube }}
24+
- qvm: poweroff-before-removal-{{ qube_name }}
2525
- onlyif:
26-
- qvm-check --quiet {{ untagged_qube }}
26+
- qvm-check --quiet {{ qube_name }}
2727
- order: last
2828

2929
{% endfor %}

0 commit comments

Comments
 (0)