Skip to content
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

Consolidate SDW templates wherever possible #471

Closed
28 of 30 tasks
conorsch opened this issue Feb 28, 2020 · 18 comments · Fixed by #619
Closed
28 of 30 tasks

Consolidate SDW templates wherever possible #471

conorsch opened this issue Feb 28, 2020 · 18 comments · Fixed by #619

Comments

@conorsch
Copy link
Contributor

conorsch commented Feb 28, 2020

We currently have six (6) TemplateVMs and seven (7) AppVMs as part of the core Workstation components:

[user@dom0 ~]$ qvm-ls --tags sd-workstation | grep TemplateVM | wc -l
6
[user@dom0 ~]$ qvm-ls --tags sd-workstation | grep AppVM  | wc -l
7

For most of the AppVMs, a discrete TemplateVM is not actually required. While there are a few complications with consolidating the templates—multiple SDW packages write to /usr/share/applications/mimeapps.list, for example—the advantages to folding the config into as few templates as possible is significant:

  • no more need to parallelize updates (Perform update checks concurrently #403)
  • qubes-gui-updater would show pending SDW updates (#238)
  • we could trust qvm-features securedrop-workstation-buster updates-available to trigger preflight updates, dramatically reducing Client app start time
  • update-checking requires 1-3 checks, rather than 6-8 (including Whonix, Fedora)

Here's a short list of proposed changes required in order to achieve the consolidation described:

  • prefer /home/user/.config/mimeapps.list to /usr/share/applications/mimeapps.list,
    so AppVMs based on the same TemplateVM can have different mime-handler settings
  • update securedrop-log to infer hostname for localvm (rather than hardcode it)
  • use /rw/config/ / qvm-service where required for per-VM services (e.g. sd-log, sd-proxy)

We're currently approaching the beta/pilot phase, so unless the team feels strongly that we must immediately reduce the number of templates (e.g. to reduce updater complexity, see #459), and closely coordinate the requisite packaging changes, let's revisit this as a potential reduction to complexity post-pilot.

Implementation

Completed

Next up

Later

  • QA and release to production

Edited by @eloquence 2020-09-03 per sprint planning
Edited by @eloquence 2020-09-16 per scoping session
Edited by @eloquence 2020-10-01 per sprint planning

@redshiftzero redshiftzero added this to Near Term - SD Workstation in SecureDrop Team Board Feb 28, 2020
conorsch pushed a commit that referenced this issue Mar 5, 2020
We've been using both Whonix TemplateVMs in the SDW components:

 * whonix-gw-15 -> sd-whonix
 * whonix-ws-15 -> sd-proxy

In order to speed up the time it takes for updates to run (#459),
as well as nudge us toward full template consolidation (#471),
let's use the `securedrop-workstation-buster` Template for `sd-proxy`.
Since `sd-proxy` still has its NetVM set to `sd-whonix`, it's able to
resolve Onion URLs just fine.
@redshiftzero
Copy link
Contributor

I think this makes sense as a major simplification, faster provisioning time, and for the sped up update time. One thought is instead of having a single securedrop-workstation-buster template or template per-VM instead we could have two kinds of templates that are based on securedrop-workstation-buster:

  • Lower security template - We install printer drivers (eventually installing potentially shady drivers will be required for export code as we expand printer support), and potentially an ever expanding suite of programs for opening a broader set of different files. We'd use this for sd-devices and sd-viewer.
  • Higher security - we use this for sd-app, sd-log, sd-proxy (which e.g. has the journalist interface URL currently in /etc in the template (we could also change this but regardless I think we'd want to have two types of templates given the considerations in the above bullet)), and sd-gpg. We are more judicious about what we install here since it will be shared between multiple VMs.

@redshiftzero
Copy link
Contributor

We discussed this today (March 11) and decided that:

  • after the initial pilot-ready release, we'll proceed with consolidating the templates used for sd-devices, sd-viewer, sd-app, sd-log, sd-proxy, and sd-gpg into two templates: one used by sd-devices and sd-viewer (where we'll install libreoffice and other file opening applications), and one used by sd-app, sd-log, sd-proxy, sd-gpg. This will reduce the number of templates by 4, so should be a significant simplification.
  • we'll next investigate our use of the whonix gateway to decide if we should further consolidate sd-whonix and sd-proxy (i.e. installing tor into the shared template used for sd-proxy). To make that determination we'll next:
    1. check in with the threat model to see if we should preserve the split architecture, bearing in mind that we now don't have tor browser installed in sd-proxy so we don't expose the attack surface of the browser,
    2. evaluate the UI widgets used for restarting tor to see which functionality we'd need to support for journalists to use to resolve network issues,
    3. evaluate sdwdate to see if we'd want to use this in the consolidated sd-proxy

Depending on the outcome of these above investigations, we might decide it makes more sense to just keep using our existing sd-whonix, in which case we'll continue to have a separate template for that AppVM.

@redshiftzero redshiftzero moved this from Near Term - SD Workstation to QA Period - 3/17-3/31 (Kanban Mode) in SecureDrop Team Board Mar 24, 2020
@eloquence eloquence moved this from QA Period - 3/17-3/31 (Kanban Mode) to Near Term - SD Workstation in SecureDrop Team Board Mar 24, 2020
@eloquence eloquence moved this from Near Term - SD Workstation to Next sprint candidates in SecureDrop Team Board Jul 1, 2020
@emkll
Copy link
Contributor

emkll commented Jul 6, 2020

Number of Templates:

  • We have the minimal templates listed as a mitigation (MITIG24 for: Vulnerability introduced via Template Dependency and Malicious (backdoored) VM Template: A reduced package list will reduce the likelihood of compromise, but also potentially the impact (if it affects a sensitive VM such as sd-gpg or sd-client, the impact is higher than for the sd-viewer). In this case, we rely on lack of network and Xen to prevent exfiltration.

  • As @redshiftzero notes that some files in /etc/ may be exposed to the disp-vm Consolidate SDW templates wherever possible #471 (comment). If we would want to introduce further config values, this separation is helpful. In some cases, we may need to update the logic to use /rw/ instead.

Having a distinction between trusted and less trusted Templates makes sense to me here, to preserve some mitigations listed above and reducing both likelihood and impact, and allowing further use cases:

  • Install software from maybe less trusted repositories or binaries, like drivers or analysis tools
  • Allowing end-users to customize their templates for analysis or perhaps communication or other tools
  • Minimize the likelohood of Template breakage to the core component of the workstation (the client)

Consolidating sd-proxy and sd-whonix:

I think this makes sense and is supported by some of the previous threat modeling analysis we've done in the past:

  • Both THREAT23 and THREAT24 (the compromise of sd-proxy and sd-whonix, respectively) have the same adjusted risk score, which makes sense since both have access to the same amount of information (other than sd-whonix having access to the ATHS secret).

  • In both cases, should an attacker have execution in either of these VMs can exfiltrate, via Tor. In the case of the consolidated VMs, they would likely be able to exfiltrate over clearnet as well. I don't think this will add any incremental risk.

  • Since we will only be using Tor Hidden Services, there should be no sensitive information transmitted over non-Tor, but we should be mindful of the impact of firewall rules in TemplateVMs vs their associated AppVM(s). For the purposes of ATHS-only communications, I don't see any issues. However, I don't think we should reuse this VM for any browser traffic or as a NetVM more broadly - we should limit via it's use through the Proxy RPC interface.

@eloquence
Copy link
Member

eloquence commented Jul 7, 2020

We had a further discussion about this today; detailed notes can be found here.

Important agreements:

  1. As previously discussed, we'll aim for consolidating towards two templates for now.
  2. We'll need to start by inventorying template-specific configurations, whether done via Salt or packages. One approach we want to investigate is consolidating those configurations into packages that are not template-specific, and then activating the AppVM-specific configurations via /rw/config changes (e.g., startup scripts) that are installed via Salt and that will rarely need to be updated.
  3. This kind of consolidation can be done before reducing the number of templates.
  4. We'll aim to make the entire migration as painless as possible, without requiring a reinstall (but unavoidably requiring a securedrop-admin --apply run).

Unfortunately, we may have to increase the number of templates again if we do want to ship a Signal VM, or offer supported ways to create additional custom VMs that interface with SDW VMs.

We didn't discuss the Whonix deprecation/removal path in detail yet, and will set aside time for that at a future tech mtg.

@eloquence
Copy link
Member

For the 7/8-7/22 sprint, we've agreed to start with a research & planning task, consistent with the above:

We'll need to start by inventorying template-specific configurations, whether done via Salt or packages. One approach we want to investigate is consolidating those configurations into packages that are not template-specific, and then activating the AppVM-specific configurations via /rw/config changes (e.g., startup scripts) that are installed via Salt and that will rarely need to be updated.

@rmol has offered to take point on this, with the goal to draft a first implementation plan.

@eloquence eloquence moved this from Next sprint candidates to SecureDrop Sprint #54 - 7/8-7/22 in SecureDrop Team Board Jul 8, 2020
@eloquence
Copy link
Member

During the last sprint, @creviera and @emkll have done an initial inventory of template configurations, and will summarize their findings on this issue.

Additionally, during the 8/6-8/20 sprint, we have allocated time towards developing a more detailed implementation plan, which will likely comprise multiple smaller spikes (e.g., "how to manage MIME type handling using a single template").

@emkll emkll moved this from SecureDrop Sprint #56 - 8/6-8/20 to In Development in SecureDrop Team Board Aug 20, 2020
@eloquence eloquence added the epic label Aug 20, 2020
@eloquence
Copy link
Member

@creviera and @emkll have prepared a (currently FPF-internal) doc with a comprehensive inventory and a proposed implementation plan. During the 8/20-9/2 sprint, @conorsch will provide additional review, and we've committed to the deliverables that I've tentatively enumerated as a checklist in the top-level issue description. As with other epics, we will likely want to create dedicated issues for each item.

@conorsch
Copy link
Contributor Author

Completed review of the template consolidation plan. Overall the proposal to prefer private volume configs is solid. We'll have to be careful to ensure that the mimetypes are handled well (the existing functional tests will be valuable here), and additionally that there's no race if leverage /rw/config rc.local to adjusting the mimetype handlers.

@conorsch
Copy link
Contributor Author

Regarding the upcoming task

Spike: Provision large/small template via Salt (working branch)

I'm skeptical that'll be very workable without also completing the mime type conversions for the other components, e.g. client, proxy, & export, but with some temporary commits like installing local debs as documented in https://github.com/freedomofpress/securedrop-workstation/wiki/Evaluating-new-deb-package-behavior, we should have plenty to discuss from a WIP branch.

Will ping @zenmonkeykstop tomorrow about whether this task is already underway, otherwise offer to help.

conorsch pushed a commit to freedomofpress/securedrop-proxy that referenced this issue Oct 5, 2020
The Qubes RPC file hardcodes the filepath to the YAML config file,
which contains site-specific information such as the Onion URL for the
Journalist Interface. As part of template consolidation [0], we're
moving the config file out of the system/root partition and into the
private (i.e. /home/) volume, so that the `sd-proxy` AppVM has the
config information it needs while sharing a TemplateVM with other
components.

[0] freedomofpress/securedrop-workstation#471
conorsch pushed a commit to freedomofpress/securedrop-proxy that referenced this issue Oct 5, 2020
The Qubes RPC file hardcodes the filepath to the YAML config file,
which contains site-specific information such as the Onion URL for the
Journalist Interface. As part of template consolidation [0], we're
moving the config file out of the system/root partition and into the
private (i.e. /home/) volume, so that the `sd-proxy` AppVM has the
config information it needs while sharing a TemplateVM with other
components.

[0] freedomofpress/securedrop-workstation#471
@conorsch
Copy link
Contributor Author

conorsch commented Oct 8, 2020

There's still a bit more rebasing to do before a draft PR goes up on this repo, but will do tomorrow. Local testing, while slow, has been quite positive: we have full template consolidation via the GUI updater, and all portions of the Workstation function as expected after the updater run completes. The test plan will be fairly verbose, and reference a lot of draft PRs visible in the cross-repo references above, but I'm optimistic we won't need to ask admins to run CLI actions to accomplish the consolidation.

emkll pushed a commit to freedomofpress/securedrop-proxy that referenced this issue Oct 9, 2020
The Qubes RPC file hardcodes the filepath to the YAML config file,
which contains site-specific information such as the Onion URL for the
Journalist Interface. As part of template consolidation [0], we're
moving the config file out of the system/root partition and into the
private (i.e. /home/) volume, so that the `sd-proxy` AppVM has the
config information it needs while sharing a TemplateVM with other
components.

[0] freedomofpress/securedrop-workstation#471
conorsch pushed a commit to freedomofpress/securedrop-export that referenced this issue Oct 15, 2020
As part of template consolidation [0], we're moving mimetype
associations out of system volumes and into private volumes. Therefore
we no longer need these files in the 'securedrop-export' package, as the
corresponding files have already been ported to
'securedrop-workstation-config'.

[0] freedomofpress/securedrop-workstation#471
conorsch pushed a commit to freedomofpress/securedrop-client that referenced this issue Oct 19, 2020
As part of template consolidation [0], we've moved all mimetype
associations into the "securedrop-workstation-config" package [1].
The "open-in-dvm" desktop file now resides in the same package [2].

[0] freedomofpress/securedrop-workstation#471
[1] freedomofpress/securedrop-builder#190
[2] freedomofpress/securedrop-builder#198
conorsch pushed a commit to freedomofpress/securedrop-export that referenced this issue Oct 22, 2020
As part of template consolidation [0], we're moving mimetype
associations out of system volumes and into private volumes. Therefore
we no longer need these files in the 'securedrop-export' package, as the
corresponding files have already been ported to
'securedrop-workstation-config'.

[0] freedomofpress/securedrop-workstation#471
conorsch pushed a commit to freedomofpress/securedrop-client that referenced this issue Oct 27, 2020
As part of template consolidation [0], we've moved all mimetype
associations into the "securedrop-workstation-config" package [1].
The "open-in-dvm" desktop file now resides in the same package [2].

[0] freedomofpress/securedrop-workstation#471
[1] freedomofpress/securedrop-builder#190
[2] freedomofpress/securedrop-builder#198
SecureDrop Team Board automation moved this from SecureDrop Sprint #61 - 10/15-10/28 to Done Oct 27, 2020
@conorsch
Copy link
Contributor Author

Reopening to track QA period, and ensure we've addressed all the sub-tasks.

@conorsch conorsch reopened this Oct 27, 2020
@eloquence
Copy link
Member

This was completed as part of #624.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants