feat: usb client

This commit is contained in:
Ben Grande 2023-12-18 15:31:27 +00:00
parent f16bfdd28b
commit bcb65a2f1a
10 changed files with 163 additions and 0 deletions

36
salt/usb/README.md Normal file
View File

@ -0,0 +1,36 @@
# usb
USB client in Qubes OS.
## Table of Contents
* [Description](#description)
* [Installation](#installation)
* [Usage](#usage)
## Description
A Template for DispVMs will be created and named "dvm-usb", from this qube,
you can base disposable qubes, geared towards USB client usage.
## Installation
- Top:
```sh
qubesctl top.enable usb
qubesctl --targets=tpl-usb state.apply
qubesctl top.disable usb
```
- State:
<!-- pkg:begin:post-install -->
```sh
qubesctl state.apply usb.create
qubesctl --skip-dom0 --targets=tpl-usb state.apply usb.install
```
<!-- pkg:end:post-install -->
## Usage
You will use the Template for DispVMs "dvm-usb" to create disposable qubes to
connect USB devices to.

8
salt/usb/clone.sls Normal file
View File

@ -0,0 +1,8 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
{% from 'utils/macros/clone-template.sls' import clone_template -%}
{{ clone_template('debian-minimal', sls_path) }}

10
salt/usb/clone.top Normal file
View File

@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
base:
'dom0':
- match: nodegroup
- usb.clone

View File

@ -0,0 +1,12 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
{% if grains['nodename'] != 'dom0' -%}
include:
- dev.home-cleanup
{% endif -%}

View File

@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
base:
'*':
- match: nodegroup
- usb.configure-dvm

42
salt/usb/create.sls Normal file
View File

@ -0,0 +1,42 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
{%- from "qvm/template.jinja" import load -%}
include:
- .clone
{% load_yaml as defaults -%}
name: dvm-{{ slsdotpath }}
force: True
require:
- sls: {{ slsdotpath }}.clone
present:
- template: tpl-{{ slsdotpath }}
- label: red
prefs:
- template: tpl-{{ slsdotpath }}
- label: red
- netvm: ""
- memory: 300
- maxmem: 500
- vcpus: 1
- autostart: False
- template_for_dispvms: True
- include_in_backups: False
features:
- enable:
- appmenus-dispvm
- disable:
- service.cups
- service.cups-browsed
- service.tinyproxy
{%- endload %}
{{ load(defaults) }}
"{{ slsdotpath }}-extend-private-volume":
cmd.run:
- name: qvm-volume extend dvm-{{ slsdotpath }}:private 15Gi

10
salt/usb/create.top Normal file
View File

@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
base:
'dom0':
- match: nodegroup
- usb.create

14
salt/usb/init.top Normal file
View File

@ -0,0 +1,14 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
base:
'dom0':
- match: nodegroup
- usb.create
'tpl-usb':
- usb.install
'dvm-usb':
- usb.configur-dvm

12
salt/usb/install.sls Normal file
View File

@ -0,0 +1,12 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
{% if grains['nodename'] != 'dom0' -%}
include:
- sys-usb.install-client
{% endif -%}

9
salt/usb/install.top Normal file
View File

@ -0,0 +1,9 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
base:
'tpl-usb':
- usb.install