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

Implements Debian9-based custom templates for all AppVMs #160

Merged
merged 8 commits into from
Oct 17, 2018

Conversation

conorsch
Copy link
Contributor

Converts all the AppVMs to reference a custom TemplateVM caused sd-workstation-template, which is cloned from the system debian-9 TemplateVM. Summary of changes:

  • All AppVMs are now based on <app_vm_name>-template, with a single exception: sd-gpg has no corresponding sd-gpg-template, because its customizations are simply a keyring that lives in $HOME, and therefore would not be inherited from the TemplateVM.
  • Creates sd-workstation-template as a base TemplateVM for use across the multiple AppVM configurations. Does not include much of the hardening documented in Create securedrop-workstation TemplateVM #156, we can follow up after these changes are merged.
  • Script paths have changed throughout to convert /usr/local/ to /usr/ equivalents. Qubes handles /usr/local/ directories specially, and allows them to be unique per VM.
  • Similarly, use of /home/user/ paths is now discouraged, since AppVMs don't inherit those from TemplateVMs. Wherever possible, appropriate system paths are now used.
  • VM config tests expanded somewhat to confirm new template settings

Testing

The test plan remains the same as usual:

  1. Run make all in dom0 and confirm no errors.
  2. Run make test in dom0 and confirm no errors.
  3. Run Qubes Manager and visually confirm all the sd- VMs are running Debian 9 (or Whonix 14, which is itself based on Debian 9).
  4. Confirm you can download and view a test submission. A plaintext submission should be displayed in gedit in a DisposableVM.

As usual, 4 is the real clincher here. Without any out-of-band modifications, you should be able to view a plaintext submission. Have not tried other file formats yet; we should write up a test plan to account for those.

Closes #131. Related to #156 and #158.

Copy link
Contributor

@emkll emkll left a comment

Choose a reason for hiding this comment

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

Thanks @conorsch this is looking good ! I have successfully ran this and all tests pass.
single messages correctly open in dispvm using gedit. However, I am experiencing some issues in opening (other) files: (see image below).
It seems like a bug in decrypt-sd-submission on sd-svs, I am currently investigating.
We should also note that the VMs are not updated as part of the template building, we should probably invoke whichever script we decide to implement in #24 during the template clone/creation phase
mime-svs-gpg

@conorsch
Copy link
Contributor Author

conorsch commented Oct 16, 2018

Good catch, @emkll! While working on this I discovered that decrypt-sd-submission was not ported to Python3 along with the others in #144. While I made some minor changes to that file for python3 compatibility, clearly the changes weren't sufficient. We should be able to solve that here.

@emkll
Copy link
Contributor

emkll commented Oct 16, 2018

make clean target does not clean all workstation related templates likely due to scripts/list-vms not matching all the templates. After running make clean, the following templates are still available on my machine:

  • sd-whonix-template
  • sd-svs-template
  • sd-svs-disp-template

@conorsch conorsch force-pushed the 131-implements-debian-based-custom-template branch 2 times, most recently from 3c8a925 to b1c5b50 Compare October 17, 2018 00:01
Conor Schaefer added 8 commits October 16, 2018 17:01
All of the `sd-*` VMs for the SecureDrop Workstation now use Debian 9 as
the base template. This will allow us to use deb packages across the
board for all AppVMs, as well as the hardened based image with a custom
kernel in the near future, as well.

Updates the test suites to accommodate for gpg v1/v2 output variance, as
well as removes Fedora 28 as a permitted base for the AppVMs in the
platform tests.

This is a temporary measure: we don't want to reuse the system debian-9
TemplateVM, and should instead ship our own
`securedrop-workstation-template` package to be installed via dom0.
Also caught an oversight where the decrypt-sd-submission script was
never ported to python3; did that now. Removed the Salt logic creating
the ~/Sources dir and placed that in the script; used python3 syntax and
broke the script, so that's how I caught it.

One other small change was required for Python 3 compatibility: updating
a file.write operation to write bytes, not strings.
Revises sd-journalist paths to be system-wide, same as with the other
template migrations.
Updating paths in the config tests, so that e.g. in sd-journalist, the
non-`/usr/local` paths are referenced. Expands the VM config tests
to check templates and a bit more networking info.
Simplifies list-vms script via hardcoding

Tried to avoid hardcoding, but got too clever. We'll wait for when we
have tags for all VMs.
@conorsch
Copy link
Contributor Author

Both concerns are addressed, @emkll, please have another look. There was a single change required for the Python 3 port (file-writing bytes-vs-strings, standard fare for 2 to 3 porting), and I updated the destroy logic to be hardcoded. In #135 we can make that logic dynamic via tags, let's keep it simple for now.

Confirmed opening plaintext files (in gedit) and images (which opened in Firefox; flagged in #158 for follow-up).

Copy link
Contributor

@emkll emkll left a comment

Choose a reason for hiding this comment

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

Thanks @conorsch for the quick fixes! This looks good:
I can confirm that non-text submission case is now resolved, and that all workstation templates are now properly destroyed. All tests in make test are passing.

A note that with these changes, make all took almost 30 minutes in my local testing, which is significantly more than with previous iterations of the provisioning code, and that this doesn't include updates to the templates, which should be implemented per #24.

@conorsch
Copy link
Contributor Author

A note that with these changes, make all took almost 30 minutes in my local testing, which is significantly more than with previous iterations of the provisioning code, and that this doesn't include updates to the templates

Yes, it's taking a long time. Shortly I believe we should omit the "clean" step from make all, and instead treat make all as a provision action. Testing instructions can still use make clean && make all, but treating these machines as a bit more permanent within the dev env will help us make progress as we integrate the packages.

@conorsch conorsch merged commit b7c24b5 into master Oct 17, 2018
emkll added a commit that referenced this pull request Nov 8, 2018
This will ensure we will be able to apply preferences (e.g. qubes-rpc
policies) accross all VMs managed in the Qubes Workstation.

Added configuration tests for templates VMs that were created as part of #160
emkll added a commit that referenced this pull request Nov 8, 2018
This will ensure we will be able to apply preferences (e.g. qubes-rpc
policies) accross all VMs managed in the Qubes Workstation.

Added configuration tests for templates VMs that were created as part of #160
emkll added a commit that referenced this pull request Nov 8, 2018
This will ensure we will be able to apply preferences (e.g. qubes-rpc
policies) accross all VMs managed in the Qubes Workstation.

Added configuration tests for templates VMs that were created as part of #160
@legoktm legoktm deleted the 131-implements-debian-based-custom-template branch May 28, 2024 15:25
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.

2 participants