-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Export named disposable VM creation (sd-export-usb based on sd-export-dvm based on sd-export-template) * Permanently attach a config-specified usb port id to sd-export VM * Qubes will always automount anything connected to that port to sd-export * Use mime handler for to handle transfers to sd-export-usb * sd-export named disposable vm was named to sd-export-usb, so we must change the tests to reflect this change.
- Loading branch information
Showing
13 changed files
with
179 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- 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-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-template-mimetype: | ||
file.blockreplace: | ||
- name: /etc/mailcap | ||
- prepend_if_not_found: False | ||
- marker_start: "# ----- User Section Begins ----- #" | ||
- marker_end: "# ----- User Section Ends ----- #" | ||
- content: | | ||
application/octet-stream; /usr/bin/send-to-usb '%s'; | ||
cmd.run: | ||
- name: sudo update-mime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# -*- 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: sd-workstation-template | ||
- label: yellow | ||
- tags: | ||
- add: | ||
- sd-workstation | ||
- require: | ||
- sls: sd-workstation-template | ||
|
||
sd-export-dvm: | ||
qvm.vm: | ||
- name: sd-export-dvm | ||
- present: | ||
- template: sd-export-template | ||
- label: yellow | ||
- 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 | ||
|
||
{% import_json "sd/config.json" as d %} | ||
|
||
# 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 | ||
create-named-sd-export-dispvm-and-permanently-attach: | ||
cmd.run: | ||
- name: > | ||
qvm-remove --force sd-export-usb || true; | ||
qvm-create --class DispVM --template sd-export-dvm --label red sd-export-usb; | ||
qvm-usb attach --persistent sd-export-usb {{ d.usb.device }} || true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#! /usr/bin/python3 | ||
|
||
import os | ||
import shutil | ||
import subprocess | ||
import sys | ||
|
||
DEVICE = "/dev/sda1" | ||
MOUNTPOINT = "/tmp/usb" | ||
FILE = sys.argv[1] | ||
|
||
if os.path.exists(FILE): | ||
# mount target not created | ||
if not os.path.exists(MOUNTPOINT): | ||
os.makedirs(MOUNTPOINT) | ||
# check if drive already mounted, otherwise mount | ||
rc = subprocess.call(["mountpoint", MOUNTPOINT], | ||
stdout = subprocess.DEVNULL, | ||
stderr = subprocess.DEVNULL) | ||
if rc: | ||
out = subprocess.run(["sudo", | ||
"mount", | ||
"-o", "uid=1000,gid=1000", | ||
DEVICE, | ||
MOUNTPOINT]) | ||
|
||
# move files to drive (overwrites existing files) and unmount drive | ||
shutil.move(FILE, | ||
os.path.join(MOUNTPOINT, os.path.basename(FILE))) | ||
subprocess.run(["sudo", "umount", MOUNTPOINT]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
"sd-svs", | ||
"sd-svs-disp", | ||
"sd-whonix", | ||
"sd-export-usb" | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters