-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add sd-export VMs and basic export flow #259
Changes from 12 commits
08ec1cd
1c7d174
388351a
7bd80e9
db3ab2f
f1bbcb8
ff41a9c
7f524f3
67cffb8
2e80b32
dd01287
fe1d41a
efc1ede
dbe00eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[flake8] | ||
ignore: W605 | ||
max-line-length = 99 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: set syntax=yaml ts=2 sw=2 sts=2 et : | ||
|
||
## | ||
# sd-export-files | ||
# ======== | ||
# | ||
# Moves files into place on sd-export | ||
# | ||
## | ||
include: | ||
- fpf-apt-test-repo | ||
|
||
sd-export-template-install-cryptsetup: | ||
pkg.installed: | ||
- pkgs: | ||
- cryptsetup | ||
|
||
sd-export-send-to-usb-script: | ||
file.managed: | ||
- name: /usr/bin/send-to-usb | ||
- source: salt://sd/sd-export/send-to-usb | ||
- user: root | ||
- group: root | ||
- mode: 755 | ||
- makedirs: True | ||
|
||
sd-export-desktop-file: | ||
file.managed: | ||
- name: /usr/share/applications/send-to-usb.desktop | ||
- source: salt://sd/sd-export/send-to-usb.desktop | ||
- user: root | ||
- group: root | ||
- mode: 644 | ||
- makedirs: True | ||
cmd.run: | ||
- name: sudo update-desktop-database /usr/share/applications | ||
- require: | ||
- file: sd-export-desktop-file | ||
|
||
sd-export-file-format: | ||
file.managed: | ||
- name: /usr/share/mime/packages/application-x-sd-export.xml | ||
- source: salt://sd/sd-export/application-x-sd-export.xml | ||
- user: root | ||
- group: root | ||
- mode: 644 | ||
- makedirs: True | ||
cmd.run: | ||
- name: sudo update-mime-database /usr/share/mime | ||
- require: | ||
- file: sd-export-file-format | ||
- file: sd-export-desktop-file |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: set syntax=yaml ts=2 sw=2 sts=2 et : | ||
|
||
base: | ||
sd-export-template: | ||
- sd-export-files |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: set syntax=yaml ts=2 sw=2 sts=2 et : | ||
|
||
# | ||
# Installs 'sd-export' AppVM, to persistently store SD data | ||
# This VM has no network configured. | ||
## | ||
include: | ||
- sd-workstation-template | ||
|
||
sd-export-template: | ||
qvm.vm: | ||
- name: sd-export-template | ||
- clone: | ||
- source: securedrop-workstation | ||
- label: red | ||
- tags: | ||
- add: | ||
- sd-workstation | ||
- require: | ||
- sls: sd-workstation-template | ||
|
||
sd-export-usb-dvm: | ||
qvm.vm: | ||
- name: sd-export-usb-dvm | ||
- present: | ||
- template: sd-export-template | ||
- label: red | ||
- prefs: | ||
- netvm: "" | ||
- template_for_dispvms: True | ||
- tags: | ||
- add: | ||
- sd-workstation | ||
- require: | ||
- qvm: sd-export-template | ||
|
||
# Ensure the Qubes menu is populated with relevant app entries, | ||
# so that Nautilus/Files can be started via GUI interactions. | ||
sd-export-template-sync-appmenus: | ||
cmd.run: | ||
- name: > | ||
qvm-start --skip-if-running sd-export-template && | ||
qvm-sync-appmenus sd-export-template | ||
- require: | ||
- qvm: sd-export-template | ||
- onchanges: | ||
- qvm: sd-export-template | ||
|
||
# Here we must create as the salt stack does not appear to allow us to create | ||
# VMs with the class DispVM and attach the usb device specified in the config | ||
# permanently to this VM | ||
sd-export-create-named-dispvm: | ||
cmd.run: | ||
- name: > | ||
qvm-check sd-export-usb || | ||
qvm-create --class DispVM --template sd-export-usb-dvm --label red sd-export-usb | ||
- require: | ||
- qvm: sd-export-usb-dvm | ||
|
||
{% import_json "sd/config.json" as d %} | ||
|
||
sd-export-named-dispvm-permanently-attach-usb: | ||
cmd.run: | ||
- name: > | ||
qvm-usb attach --persistent sd-export-usb {{ d.usb.device }} || true | ||
- require: | ||
- cmd: sd-export-create-named-dispvm | ||
|
||
sd-export-named-dispvm-add-tags: | ||
qvm.vm: | ||
- name: sd-export-usb | ||
- tags: | ||
- add: | ||
- sd-workstation | ||
- require: | ||
- cmd: sd-export-create-named-dispvm |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: set syntax=yaml ts=2 sw=2 sts=2 et : | ||
|
||
base: | ||
dom0: | ||
- sd-export |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ set -u | |
set -o pipefail | ||
|
||
|
||
# When adding new VMs, ensure the template is listed *after* the AppVMs that | ||
# use it. | ||
declare -a sd_workstation_vm_names=( | ||
sd-gpg | ||
sd-proxy | ||
|
@@ -16,6 +18,9 @@ declare -a sd_workstation_vm_names=( | |
sd-whonix | ||
sd-svs-disp | ||
sd-svs-disp-template | ||
sd-export-usb-dvm | ||
sd-export-usb | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's prefer
And the relevant config lines referring to these VMs should be updated, as well. Discussion in the motivating ticket (#84) indicates that we may want to consolidate all export functionality into a single stateless VM. Given the disparate config needs (such as net/no-net) between just USB export and e.g. Onionshare, let's plan to name explicitly from the start, and consolidate if and only if we identify a sound method of doing so. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've renamed sd-export-dvm to sd-export-usb-dvm. I think this makes sense, we want a DispVM template AppVM to not have network access. In an attempt to minimize the total amount of templates, I think it might make sense to use the same template for USB exports and other exports(networked, OnionShare exports), as to reduce the time to upgrade templates (which is already quite long, as each template must be updated independently). Since we will likely be creating a AppVM/DispVM template for network-specific exports, I think it might make sense for them to share templates. I don't feel strongly about sharing the template, happy to break up the template further if you think it's warranted. |
||
sd-export-template | ||
) | ||
|
||
for vm in "${sd_workstation_vm_names[@]}" ; do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> | ||
<mime-type type="application/x-sd-export"> | ||
<comment>Archive for transfering files from the SecureDrop workstation to an external USB device.</comment> | ||
<glob pattern="*.sd-export"/> | ||
</mime-type> | ||
</mime-info> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous iterations of this step would be run after
qvm-usb detach
on thesd-export-usb
domain this is because when runningmake sd-export
using more than once, with different values forusb.device
will result in an error while starting thesd-export-usb
vm (see screenshot below)