Skip to content

Replace Whonix in favor of arti in sd-proxy#2561

Merged
cfm merged 5 commits intomainfrom
whonix-deprecation
Aug 28, 2025
Merged

Replace Whonix in favor of arti in sd-proxy#2561
cfm merged 5 commits intomainfrom
whonix-deprecation

Conversation

@deeplow
Copy link
Copy Markdown
Contributor

@deeplow deeplow commented Jul 23, 2025

Description

Towards freedomofpress/securedrop-workstation#456

  • sets sd-proxy to connect to sys-firewall instead of sys-vpn
  • installs arti package in sd-proxy's template (out of scope)
  • starts arti in proxy mode in sd-proxy on startup (via systemd)
  • converts arti's ctor onion service auth into an arti format to set up access to journalist interface onion service
  • sets via qubesdb vm-config.SD_PROXY_ORIGIN_KEY value
  • renames whonix-config into proxy-config
  • make tests work again
  • check apparmor situation handling in Build a securedrop-arti package #2644
  • add tests for onion service auth key conversion script
  • what should we do regarding securedrop-qubesdb-tools
    • Kunal said "rm -rf IMO if there's no use for it, we can always restore it later on if we do have another use case."

Test Plan

Preparation:

Test:

  • run client application and ensure connections are working

@deeplow deeplow moved this to In Progress in SecureDrop Jul 23, 2025
@nathandyer nathandyer moved this from In Progress to Next sprint candidates in SecureDrop Aug 5, 2025
@nathandyer nathandyer moved this from Next sprint candidates to Ready to go in SecureDrop Aug 18, 2025
@deeplow deeplow moved this from Ready to go to In Progress in SecureDrop Aug 19, 2025
@deeplow deeplow force-pushed the whonix-deprecation branch from 9a008e1 to e277488 Compare August 19, 2025 16:34
@legoktm
Copy link
Copy Markdown
Member

legoktm commented Aug 20, 2025

Can we do the Python key/conversion part as a one-time systemd service on VM boot (before arti starts) instead of for every proxy request?

@deeplow deeplow force-pushed the whonix-deprecation branch 2 times, most recently from 8c25c9d to 9317ef5 Compare August 20, 2025 18:58
deeplow added a commit to freedomofpress/securedrop-workstation that referenced this pull request Aug 20, 2025
Companion PR for client change [1] with the aim of deprecating whonix,
in favor of delegating the tor connectivity aspect to sd-proxy running
arti.

Changes introduced:

1. sd-proxy connects to 'sys-firewall' directly:

    since sd-proxy is now handling tor connections, it must connect
    directly to the internet.
    It keeps the original goal of preventing the client from being able
    to connect to arbitrary domains. This is also something that
    sd-whonix did not guarantee (it could connect to arbitrary domains,
    albeit via Tor).

2. sd-whonix has access to onion service auth key

   Access done via qubes feature vm-config.SD_PROXY_ORIGIN_KEY

3. sd-whonix removed

4. Install `securedrop-proxy-config` in sd-proxy template

[1]: freedomofpress/securedrop-client#2561

Test in ci: openqa
@deeplow deeplow marked this pull request as ready for review August 20, 2025 20:08
@deeplow deeplow requested a review from a team as a code owner August 20, 2025 20:08
@deeplow deeplow moved this from In Progress to Ready For Review in SecureDrop Aug 20, 2025
@deeplow
Copy link
Copy Markdown
Contributor Author

deeplow commented Aug 20, 2025

Can we do the Python key/conversion part as a one-time systemd service on VM boot (before arti starts) instead of for every proxy request?

As mentioned earlier, this is exactly what I was trying to do after I got the base thing working. Even though we're still missing tests (fixing the old and adding new) and checking in on the apparmor situation, I'd say this is ready for initial review. But under the expectation that there will be further changes, if that sounds good @legoktm.

@deeplow
Copy link
Copy Markdown
Contributor Author

deeplow commented Aug 20, 2025

@cfm and @legoktm, what should we do regarding securedrop-qubesdb-tools? Its only use was for whonix-config and the file template mechanism was not expressive enough for what we needed here.

@legoktm
Copy link
Copy Markdown
Member

legoktm commented Aug 20, 2025

what should we do regarding securedrop-qubesdb-tools

rm -rf IMO if there's no use for it, we can always restore it later on if we do have another use case.

Copy link
Copy Markdown
Member

@legoktm legoktm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a first pass review, I will try to test this tomorrow.

Comment thread debian/control Outdated
Comment thread debian/securedrop-proxy-config.arti-proxy.service Outdated
Comment thread debian/securedrop-proxy-config.arti-proxy.service
Comment thread proxy/src/main.rs Outdated
Comment thread debian/securedrop-proxy-config.arti-proxy.service
Comment thread proxy-config/configure_onion_service.py
Comment thread debian/control Outdated
@cfm
Copy link
Copy Markdown
Member

cfm commented Aug 20, 2025 via email

deeplow added a commit that referenced this pull request Aug 21, 2025
Per suggestion in [1], and following the conclusions in this pull
request [2]

[1]: #2561 (comment)
[2]: freedomofpress/securedrop#7404
@nathandyer nathandyer moved this from Ready For Review to Under Review in SecureDrop Aug 21, 2025
deeplow added a commit to freedomofpress/securedrop-workstation that referenced this pull request Aug 21, 2025
Companion PR for client change [1] with the aim of deprecating whonix,
in favor of delegating the tor connectivity aspect to sd-proxy running
arti.

Changes introduced:

1. sd-proxy connects to 'sys-firewall' directly:

    since sd-proxy is now handling tor connections, it must connect
    directly to the internet.
    It keeps the original goal of preventing the client from being able
    to connect to arbitrary domains. This is also something that
    sd-whonix did not guarantee (it could connect to arbitrary domains,
    albeit via Tor).

2. sd-whonix has access to onion service auth key

   Access done via qubes feature vm-config.SD_PROXY_ORIGIN_KEY

3. sd-whonix removed

4. Install `securedrop-proxy-config` in sd-proxy template

[1]: freedomofpress/securedrop-client#2561

Test in ci: openqa
deeplow added a commit to freedomofpress/securedrop-workstation that referenced this pull request Aug 21, 2025
Companion PR for client change [1] with the aim of deprecating whonix,
in favor of delegating the tor connectivity aspect to sd-proxy running
arti.

Changes introduced:

1. sd-proxy connects to 'sys-firewall' directly:

    since sd-proxy is now handling tor connections, it must connect
    directly to the internet.
    It keeps the original goal of preventing the client from being able
    to connect to arbitrary domains. This is also something that
    sd-whonix did not guarantee (it could connect to arbitrary domains,
    albeit via Tor).

2. sd-whonix has access to onion service auth key

   Access done via qubes feature vm-config.SD_PROXY_ORIGIN_KEY

3. sd-whonix removed

4. Install `securedrop-proxy-config` in sd-proxy template

[1]: freedomofpress/securedrop-client#2561

Test in ci: openqa
deeplow added a commit to freedomofpress/securedrop-workstation that referenced this pull request Aug 21, 2025
Companion PR for client change [1] with the aim of deprecating whonix,
in favor of delegating the tor connectivity aspect to sd-proxy running
arti.

Changes introduced:

1. sd-proxy connects to 'sys-firewall' directly:

    since sd-proxy is now handling tor connections, it must connect
    directly to the internet.
    It keeps the original goal of preventing the client from being able
    to connect to arbitrary domains. This is also something that
    sd-whonix did not guarantee (it could connect to arbitrary domains,
    albeit via Tor).

2. sd-whonix has access to onion service auth key

   Access done via qubes feature vm-config.SD_PROXY_ORIGIN_KEY

3. sd-whonix removed

4. Install `securedrop-proxy-config` in sd-proxy template

[1]: freedomofpress/securedrop-client#2561

Test in ci: openqa
deeplow added a commit to freedomofpress/securedrop-workstation that referenced this pull request Aug 21, 2025
Companion PR for client change [1] with the aim of deprecating whonix,
in favor of delegating the tor connectivity aspect to sd-proxy running
arti.

Changes introduced:

1. sd-proxy connects to 'sys-firewall' directly:

    since sd-proxy is now handling tor connections, it must connect
    directly to the internet.
    It keeps the original goal of preventing the client from being able
    to connect to arbitrary domains. This is also something that
    sd-whonix did not guarantee (it could connect to arbitrary domains,
    albeit via Tor).

2. sd-whonix has access to onion service auth key

   Access done via qubes feature vm-config.SD_PROXY_ORIGIN_KEY

3. sd-whonix removed

4. Install `securedrop-proxy-config` in sd-proxy template

[1]: freedomofpress/securedrop-client#2561

Test in ci: openqa
@deeplow
Copy link
Copy Markdown
Contributor Author

deeplow commented Aug 21, 2025

@legoktm FYI, the complementary workstation PR is not yet fully working. But to test this you can manually set the following:

  • sd-proxy
    • netvm: sys-firewall
    • add service securedrop-proxy-onion-config

@deeplow deeplow force-pushed the whonix-deprecation branch from 129f8ec to 5044df3 Compare August 21, 2025 20:06
@deeplow
Copy link
Copy Markdown
Contributor Author

deeplow commented Aug 21, 2025

On Wed, Aug 20, 2025 at 01:52:36PM -0700, Kunal Mehta wrote: > what should we do regarding securedrop-qubesdb-tools rm -rf IMO if there's no use for it, we can always restore it later on if we do have another use case.
Not only that: #2032 came about entirely to help configure Tor on the Whonix gateway. If we no longer need to do QubesDB configuration at boot, because everything we need to configure from QubesDB can do it at runtime, that's a Good Thing. :-)

Great! I'll remove it, then. I've added it as a TODO item in the first post.

deeplow added a commit to freedomofpress/securedrop-workstation that referenced this pull request Aug 22, 2025
Companion PR for client change [1] with the aim of deprecating whonix,
in favor of delegating the tor connectivity aspect to sd-proxy running
arti.

Changes introduced:

1. sd-proxy connects to 'sys-firewall' directly:

    since sd-proxy is now handling tor connections, it must connect
    directly to the internet.
    It keeps the original goal of preventing the client from being able
    to connect to arbitrary domains. This is also something that
    sd-whonix did not guarantee (it could connect to arbitrary domains,
    albeit via Tor).

2. sd-proxy has access to onion service auth key

   Access done via qubes feature vm-config.SD_PROXY_ORIGIN_KEY

[1]: freedomofpress/securedrop-client#2561

Test in ci: openqa
@legoktm
Copy link
Copy Markdown
Member

legoktm commented Aug 25, 2025

I got all of CI passing today; I meant to rebase it into a cleaner git history but didn't get to that today; will do so tomorrow and mark this as formally ready for review. I'll also test integration with #2644.

@legoktm
Copy link
Copy Markdown
Member

legoktm commented Aug 26, 2025

I got this working today and ran into two things:

  1. Arti is running in all the VMs and template instead of just sd-proxy; I think we need to limit it via qubes-services
  2. We're creating ~/.local/share/arti as world-readable and Arti doesn't like that. We also need to switch it over to use the _arti user, so I can figure out permissions with that.

legoktm pushed a commit to freedomofpress/securedrop-workstation that referenced this pull request Aug 26, 2025
Companion PR for client change [1] with the aim of deprecating whonix,
in favor of delegating the tor connectivity aspect to sd-proxy running
arti.

Changes introduced:

1. sd-proxy connects to 'sys-firewall' directly:

    since sd-proxy is now handling tor connections, it must connect
    directly to the internet.
    It keeps the original goal of preventing the client from being able
    to connect to arbitrary domains. This is also something that
    sd-whonix did not guarantee (it could connect to arbitrary domains,
    albeit via Tor).

2. sd-proxy has access to onion service auth key

   Access done via qubes feature vm-config.SD_PROXY_ORIGIN_KEY

[1]: freedomofpress/securedrop-client#2561

Test in ci: openqa
@legoktm
Copy link
Copy Markdown
Member

legoktm commented Aug 26, 2025

I didn't realize that systemd-sysusers doesn't create the home directory of /var/lib/arti (because of course, that's the responsibility for systemd-homed), but there's actually a simpler solution, which is to set StateDirectory=arti (shout out to https://bbs.archlinux.org/viewtopic.php?pid=2016633#p2016633 for mentioning that), which when combined with StateDirectoryMode=0700 enforces permissions too.

@legoktm legoktm force-pushed the whonix-deprecation branch from c0a3ccc to edce2a0 Compare August 26, 2025 20:45
@legoktm legoktm moved this from In Progress to Ready For Review in SecureDrop Aug 26, 2025
@legoktm
Copy link
Copy Markdown
Member

legoktm commented Aug 26, 2025

I've cleaned up the Git history and verified that it works as expected, should be actually ready for review :)

legoktm added a commit that referenced this pull request Aug 27, 2025
Run `make build-debs-arti` to build a `securedrop-arti` package. We
build it separately since it's pretty slow with high resource
requirements and will be changing at a different schedule than our
current release schedule (like how we handle Tor on the server).

The version is set in arti/debian/changelog, it clones the upstream Git
repo, verifies the PGP signature against arti/upstream-keys (fetched
from keys.openpgp.org), builds the `arti` binary and includes it in a
Debian package.

The package creates an `_arti` user with the same home directory as Arti
upstream intends to use.

No systemd unit is included in this commit, for now it's being shipped
in the securedrop-proxy package (see #2561).
legoktm added a commit that referenced this pull request Aug 27, 2025
Run `make build-debs-arti` to build a `securedrop-arti` package. We
build it separately since it's pretty slow with high resource
requirements and will be changing at a different schedule than our
current release schedule (like how we handle Tor on the server).

The version is set in arti/debian/changelog, it clones the upstream Git
repo, verifies the PGP signature against arti/upstream-keys (fetched
from keys.openpgp.org), builds the `arti` binary and includes it in a
Debian package.

The package creates an `_arti` user with the same home directory as Arti
upstream intends to use.

No systemd unit is included in this commit, for now it's being shipped
in the securedrop-proxy package (see #2561).
@legoktm legoktm force-pushed the whonix-deprecation branch from edce2a0 to 1aa0d25 Compare August 27, 2025 16:08
@cfm cfm moved this from Ready For Review to Under Review in SecureDrop Aug 27, 2025
Copy link
Copy Markdown
Member

@cfm cfm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works great. Just a few questions and suggestions inline.

Comment thread app/src/main/proxy.ts
Comment thread proxy/src/main.rs
Comment thread proxy/configure_onion_service.py Outdated
Comment thread proxy/configure_onion_service.py
Comment thread proxy/configure_onion_service.py
@cfm cfm assigned legoktm and unassigned cfm Aug 28, 2025
deeplow and others added 5 commits August 28, 2025 16:01
Assuming running in a qube connected to sys-firewall (will be a
workstation PR of its own) and with arti running in proxy mode, this
allows the proxy to connect direct to the onion address.

This is coupled with workstation PR that:
  - sets sd-proxy to connect to sys-firewall instead of sys-vpn
  - installs arti package in sd-proxy's template
  - starts arti in proxy mode in sd-proxy on startup
  - sets via qubesdb vm-config.SD_PROXY_ORIGIN value

Setting the onion service authentication key is done in a follow-up.

Developers can set a `DISABLE_TOR` environment variable to
avoid using a SOCKS proxy, and both the client and app do so.

Towards freedomofpress/securedrop-workstation#456
Onion service key passed as "SD_PROXY_ORIGIN_KEY" via qubesdb
(production) or environment variables (testing), following project
standards.

The "get_env()" function was duplicated from securedrop-qubesdb-tools,
since it was not usable directly as a library. On top of that, its only
use-case was securedrop-whonix-config, which is now going to be
removed.

We need to convert the key from the CTor format to Arti, which isn't yet
available from upstream. This is based on @lsd-cat's initial conversion
script[1]. For more context see [2].

Fixes freedomofpress/securedrop-workstation#1382.

[1]: https://gist.github.com/lsd-cat/d3bd05412d83628be7145462081462f9
[2]: freedomofpress/securedrop-workstation#1382 (comment)

Co-authored-by: lsd-cat <giulio@gmx.com>
The previous qubesdb-templated file was replaced with a boilerplate
python script, since a templated file is not good enough for the key
conversions necessary to convert an ctor client key to an arti one.

A securedrop-arti systemd service was added, it's based on upstream's [1],
but systemd mitigations regarding read/read-write directories were not
included due to not working out-of-the box, combined with the fact
that the proxy is expected not to keep any state.

It runs as a separate `_arti` user. For now we're not protecting it with
apparmor, but can take advantage of whatever upstream does later.

[1]: https://gitlab.torproject.org/tpo/core/arti/-/blob/084c2dee/debian/systemd/arti.service
* Remove a postinst edge-case since securedrop-workstation-config is no
  longer installed on any whonix-based VM.
* Remove from mermaid diagrams; this was checked against the proxy v3
  implementation in [1] and adapted from the previous diagrams that had
  added a bit more detail to what was originally proposed.

[1]: #2453
@legoktm legoktm force-pushed the whonix-deprecation branch from 1aa0d25 to d5fdbb4 Compare August 28, 2025 20:03
@legoktm legoktm dismissed their stale review August 28, 2025 20:15

addressed my own feedback

Copy link
Copy Markdown
Member

@cfm cfm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cfm cfm added this pull request to the merge queue Aug 28, 2025
Merged via the queue into main with commit 3495fc8 Aug 28, 2025
61 checks passed
@cfm cfm deleted the whonix-deprecation branch August 28, 2025 21:00
@github-project-automation github-project-automation bot moved this from Under Review to Done in SecureDrop Aug 28, 2025
@nathandyer nathandyer removed this from SecureDrop Sep 2, 2025
@deeplow deeplow added this to the 0.17.0 milestone Sep 2, 2025
@deeplow deeplow mentioned this pull request Sep 5, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants