commit 5eebd789ed646ceb3853bb5a78dda6fe9ff67c38 Author: Ben Grande Date: Mon Nov 13 14:33:28 2023 +0000 refactor: initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..236a12d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +root = true + +[*] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true +charset = utf-8 +end_of_line = lf + +[{.gitmodules,**/git/**/config}] +indent_style = tab +indent_size = 8 + +[*.{md,sh,yaml,yml,toml}] +indent_size = 2 diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 0000000..8b7b9a9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,79 @@ + + +--- +name: Bug report +about: 'Report a problem in existing functionality' +title: '' +labels: 'P: default, T: bug' +assignees: '' +--- + +### Commitment + +I have read the following resources: + +- [ ] [How to ask questions The Smart Way](http://catb.org/esr/faqs/smart-questions.html) + +- [ ] [Writing the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) + +- [ ] [Question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/) + +- [ ] [Could you please make my preference the defafault?](https://www.qubes-os.org/faq/#could-you-please-make-my-preference-the-default) + + + +If you haven't read at least two of the aforementioned resources, there is a +good chance your text will not be well written and therefore considered +invalid. + +### Software version + + + + +### Brief summary + + + + +### Steps to reproduce + + + + +### Expected behavior + + + + +### Actual behavior + + + +. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0fbbcc8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: CC-BY-SA-4.0 + +--- +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feat.md b/.github/ISSUE_TEMPLATE/feat.md new file mode 100644 index 0000000..465302a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feat.md @@ -0,0 +1,62 @@ + + +--- +name: Enhancement request +about: 'Suggest a new feature or an improvement of existing functionality' +title: '' +labels: 'P: default, T: feat' +assignees: '' +--- + +### Commitment + +I confirm that I have read the following resources: + +- [ ] [How to ask questions The Smart Way](http://catb.org/esr/faqs/smart-questions.html) + +- [ ] [Writing the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) + +- [ ] [Question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/) + +- [ ] [Could you please make my preference the defafault?](https://www.qubes-os.org/faq/#could-you-please-make-my-preference-the-default) + + + +If you haven't read at least two of the aforementioned resources, there is a +good chance your text will not be well written and therefore considered +invalid. + +### Current problem (if any) + + + + +### Proposed solution + + + + +### The value to a user, and who that user might be + + + + +. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..470755f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,42 @@ + + +--- +name: Question +about: 'Ask a question or request support' +title: '' +labels: 'T: question' +assignees: '' +--- + +### Commitment + +I have read the following resources: + +- [ ] [How to ask questions The Smart Way](http://catb.org/esr/faqs/smart-questions.html) + +- [ ] [Writing the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) + +- [ ] [Question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/) + +- [ ] [Could you please make my preference the defafault?](https://www.qubes-os.org/faq/#could-you-please-make-my-preference-the-default) + + + +If you haven't read at least two of the aforementioned resources, there is a +good chance your text will not be well written and therefore considered +invalid. + +### Question + + + +. diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..1eb0a65 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,54 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +--- +name: Lint + +# yamllint disable-line rule:truthy +on: + # yamllint disable-line rule:empty-values + push: + branches: + - main + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + +concurrency: + group: ci-${{ github.ref }}-1 + cancel-in-progress: true + +jobs: + lint: + strategy: + fail-fast: false + runs-on: ubuntu-latest + steps: + - name: Update package list + run: sudo apt-get -y update + - name: Install OS packages + # yamllint disable-line rule:line-length + run: sudo apt-get install -y python3-dev python3-pip shellcheck reuse + # gitlint is available on Debian but Ubuntu has an older version. + - name: Install pip packages + run: pip3 install salt-lint gitlint + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 + + - name: Lint commits + # yamllint disable-line rule:line-length + run: | + if test "${{ github.event.before }}" = "${{ github.event.after }}" || test -z "${{ github.event.before }}" + then + gitlint --debug --commit "${{ github.event.after }}" + else + gitlint --debug --commits "${{ github.event.before }}..${{ github.event.after }}" + fi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..28e7413 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: MIT + +rpm_spec/*.spec diff --git a/.gitlint b/.gitlint new file mode 100644 index 0000000..e3a33c3 --- /dev/null +++ b/.gitlint @@ -0,0 +1,41 @@ +# vim: ft=toml +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: MIT + +[general] +verbosity=3 +ignore=body-is-missing +ignore-merge-commits=true +ignore-revert-commits=true +ignore-fixup-commits=false +ignore-fixup-amend-commits=false +ignore-squash-commits=false +fail-without-commits=true +regex-style-search=true +debug=false +contrib=contrib-title-conventional-commits + +[title-max-length] +line-length=50 + +[title-min-length] +min-length=10 + +[title-must-not-contain-word] +words=wip + +[body-max-line-length] +line-length=72 + +[body-min-length] +min-length=20 + +[body-is-missing] +ignore-merge-commits=false + +[ignore-body-lines] +regex=(^Co-Authored-By)|(^Reported-by)|(^Signed-off-by) + +[contrib-title-conventional-commits] +types = fix,feat,build,chore,ci,doc,style,refactor,perf,test diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..05e2444 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: MIT + +[submodule "salt/dotfiles"] + path = salt/dotfiles + url = ../dotfiles/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..511c8b6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,34 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +--- +repos: + - repo: local + hooks: + - id: reuse + name: reuse + entry: reuse + args: [lint] + language: python + pass_filenames: false + description: Lint files to comply with the REUSE Specification + - id: salt-lint + name: salt-lint + entry: scripts/salt-lint.sh + language: script + pass_filenames: true + description: Lint Salt files + - id: shellcheck + name: shellcheck + entry: scripts/shell-lint.sh + language: script + pass_filenames: true + description: Lint Shellscripts + - id: gitlint + name: gitlint + language: python + entry: gitlint + args: [--staged, --msg-filename] + stages: [commit-msg] + description: Lint Git commits diff --git a/.reuse/dep5 b/.reuse/dep5 new file mode 100644 index 0000000..6aa940f --- /dev/null +++ b/.reuse/dep5 @@ -0,0 +1,56 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: qusal +Upstream-Contact: Benjamin Grande M. S. +Source: https://github.com/ben-grande/qusal + +Files: CONTRIBUTING.md README.md */README.md +Copyright: 2023 Benjamin Grande M. S. +License: CC-BY-SA-4.0 + +Files: */rc.local +Copyright: 2023 Benjamin Grande M. S. +License: GPL-3.0-or-later + +Files: salt/sys-mirage-firewall/files/admin/mirage-firewall.tar.bz2 + salt/sys-mirage-firewall/files/admin/mirage-firewall.sha256 + salt/sys-mirage-firewall/files/admin/version.txt +Copyright: 2019 Thomas Leonard +License: BSD-2-Clause + +Files: salt/sys-pihole/files/server/keys/* + salt/mirage-builder/files/client/keys/* +Copyright: 2017 Github, Inc. +License: CC0-1.0 + +Files: salt/qubes-builder/files/client/keys/* +Copyright: The Qubes OS Project + Frédéric Pierret + Marek Marczykowski-Górecki + Simon Gaiser +License: CC0-1.0 + +Files: salt/ansible/files/repo/* +Copyright: 2014 Ansible, Inc. +License: CC0-1.0 + +Files: salt/browser/files/repo/* +Copyright: 2007 Google Inc. +License: CC0-1.0 + +Files: salt/docker/files/repo/* +Copyright: 2017 Docker Inc. +License: CC0-1.0 + +Files: salt/signal/files/repo/* +Copyright: 2017 Open Whisper Systems +License: CC0-1.0 + +Files: salt/sys-syncthing/files/repo/* +Copyright: 2014 The Syncthing Project +License: CC0-1.0 + +Files: salt/terraform/files/repo/* +Copyright: 2023 HashiCorp Inc. +License: CC0-1.0 + +# vim: ft=debcopyright diff --git a/.salt-lint b/.salt-lint new file mode 100644 index 0000000..076cce7 --- /dev/null +++ b/.salt-lint @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +--- +skip_list: + - 205 # use '.sls' as a Salt State file extension +severity: true diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..76e4f96 --- /dev/null +++ b/.yamllint @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: GPL-3.0-or-later +--- + +extends: 'default' + +ignore: | + .git/ + +yaml-files: + - '*.yaml' + - '*.yml' + - .salt-lint + - .yamllint + +rules: + empty-values: + forbid-in-block-mappings: true + forbid-in-flow-mappings: true + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true + +# vim: ft=yaml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5d6ea83 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,189 @@ +# Contributing + +## Table of Contents + +* [Respect](#respect) +* [Environment](#environment) + * [Requirements](#requirements) + * [RPM Spec](#rpm-spec) + * [Lint](#lint) +* [Format](#format) + * [File naming](#file-naming) + * [State ID](#state-id) + * [Readme](#readme) + * [Qube preferences](#qube-preferences) + * [Qube naming](#qube-naming) + * [Qube label](#qube-label) + * [Qrexec](#qrexec) +* [Where to start](#where-to-start) + +## Respect + +Be respectful towards peers. + +## Environment + +You will need to setup you development environment before you start +contributing. You will need Qubes OS R4 or higher. + +### Requirements + +The following are the packages you need to install: + +General: +- git + +For writing: +- editorconfig +- editorconfig plugin for your editor +- vim, [vim-jinja](https://github.com/ben-grande/vim-jinja), + [vim-salt](https://github.com/ben-grande/vim-salt) (recommended) + +For linting: +- pre-commit +- gitlint +- salt-lint +- shellcheck +- reuse + +For building RPMs: +- sed (GNU sed) +- dnf +- dnf-plugins-core (dnf builddep) +- rpm +- rpmlint +- rpmautospec (only available in Fedora) + +### RPM Spec + +Reference material: + +- [docs.fedoraproject.org/en-US/packaging-guidelines/](https://docs.fedoraproject.org/en-US/packaging-guidelines/) +- [rpm-software-management.github.io](https://rpm-software-management.github.io/rpm/manual/spec.html) +- [rpm-packaging-guide.github.io](https://rpm-packaging-guide.github.io/) +- [rpm-guide.readthedocs.io](https://rpm-guide.readthedocs.io/en/latest/rpm-guide.html) +- [ftp.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html](http://ftp.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html) + +### Lint + +Lint before you commit, please... else you will have to fix after the PR has +already been sent. + +Install the local hooks: +```sh +pre-commit install +gitlint install-hook +``` + +To run pre-commit linters: +```sh +pre-commit run +``` + +## Format + +### File naming + +1. Every State file `.sls` must have a Top file `.top`. This ensures that + every state can be applied with top. +2. Every project must have a `init.top`, it facilitates applying every state + by enabling a single top file. +3. State file naming must be common between the projects, it helps + understand the project as if it was any other. +4. File name must use `-` as separator, not `_`. + +### State ID + +1. State IDs must use `-` as separator, not `_`. The underline is allowed in + case the features it is changing has underline, such as `default_netvm`. +2. State IDs must always have the project ID, thus allowing to target multiple + states to the same minion from different projects without having + conflicting IDs. + +### Readme + +1. Every project should have a README.md with at least the following sections: + Table of Contents, Description, Installation, Access Control (if changed + Qrexec policy), Usage. + +### Qube preferences + +#### Qube naming + +We differ from upstream especially by placing the `dvm` part as the prefix of +DispVM Templates. This is to easy parsing when the qube type is the first +part of its name and no exceptions. + +- **TemplateVM**: `tpl-NAME` +- **StandaloneVM**: `NAME` +- **AppVM**: `NAME` +- **DispVM**: `disp-NAME` +- **DispVM Template (AppVM)**: `dvm-NAME` +- **Service qubes (not a class)**: `sys-NAME` + +We recommend that for user created qubes, use the domain in the prefix of the +qube. An AppVM for personal banking will be named `personal-banking`, an AppVM +for personal e-mail will be named `personal-email`. + +#### Qube label + +We differ from upstream in many senses. We are not labeling qubes based on +them sharing a common security domain, this is very limited if you have many +security domains in use and they do not share the same level of trust. You +don't (or shouldn't) trust your networked browsing qube for personal usage the +same as you trust your vault. The following method tries to fix this problem, +domain name is in the prefix of the qube, the label is solely related to +trustworthiness of the data it is dealing with. + +- **Black**: + - **Trust**: Ultimate. + - **Description**: You must trust Dom0, Templates, Vaults, Management qubes, + these qubes control your system and hold valuable information. + - **Examples**: dom0, tpl-ssh, vault, dvm-mgmt. +- **Gray**: + - **Trust**: Fully. + - **Description**: Trusted storage with extra RPC services that allow certain + operations to be made by the client and executed on the server or may + build components for other qubes. + - **Examples**: sys-cacher, sys-git, sys-pgp, sys-ssh-agent, qubes-builder. +- **Purple**: + - **Trust**: Very much. + - **Description**: Has the ability to manager remote servers via encrypted + connections and depend on authorization provided by another qube. + Examples: ansible, dev, ssh, terraform. +- **Blue**: + - **Trust**: Much. + - **Description**: TODO + - **Examples**: TODO +- **Green**: + - **Trust**: Trusted. + - **Description**: TODO + - **Examples**: TODO +- **Yellow**: + - **Trust**: Relatively trusted. + - **Description**: TODO + - **Examples**: TODO +- **Orange**: + - **Trust**: Slight. + - **Description**: Controls the network flow of data to the client, normally a + firewall. + - **Examples**: sys-firewall, sys-vpn, sys-pihole. +- **Red**: + - **Trust**: Untrusted. + - **Description**: Holds untrusted data (PCI devices, untrusted programs, + disposables for opening untrusted files or web pages). + - **Examples**: sys-net, sys-usb, dvm-browser. + +### Qrexec + +1. Don't use `*` for source and destination, use `@anyvm` instead +2. Target qube for policies must be `@default`. It allows for the real target + to be set by Dom0 via the `target=` redirection parameter, instead of + having to modify the client to target a different server via + `qrexec-client-vm`. +3. Target qube for client script must default to `@default`, but other targets + must be allowed via parameters. + +## Where to start + +See open issues and search for the word `TODO` in the repository files. diff --git a/LICENSES/AGPL-3.0-or-later.txt b/LICENSES/AGPL-3.0-or-later.txt new file mode 100644 index 0000000..0c97efd --- /dev/null +++ b/LICENSES/AGPL-3.0-or-later.txt @@ -0,0 +1,235 @@ +GNU AFFERO GENERAL PUBLIC LICENSE +Version 3, 19 November 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + + Preamble + +The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. + +A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. + +The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. + +An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. + +The precise terms and conditions for copying, distribution and modification follow. + + TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU Affero General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based on the Program. + +To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. +The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. + +A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". + + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. + +6. Conveying Non-Source Forms. +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. + +7. Additional Terms. +"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. + +13. Remote Network Interaction; Use with the GNU General Public License. + +Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. + +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . diff --git a/LICENSES/BSD-2-Clause.txt b/LICENSES/BSD-2-Clause.txt new file mode 100644 index 0000000..5f662b3 --- /dev/null +++ b/LICENSES/BSD-2-Clause.txt @@ -0,0 +1,9 @@ +Copyright (c) + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSES/CC-BY-SA-4.0.txt b/LICENSES/CC-BY-SA-4.0.txt new file mode 100644 index 0000000..835a683 --- /dev/null +++ b/LICENSES/CC-BY-SA-4.0.txt @@ -0,0 +1,170 @@ +Creative Commons Attribution-ShareAlike 4.0 International + + Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. + +Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors. + +Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. + +Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public. + +Creative Commons Attribution-ShareAlike 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + + e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + + i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights under this Public License. + + k. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + + A. reproduce and Share the Licensed Material, in whole or in part; and + + B. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + + 3. Term. The term of this Public License is specified in Section 6(a). + + 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + + 5. Downstream recipients. + + A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + + B. Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply. + + C. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + + 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this Public License. + + 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified form), You must: + + A. retain the following if it is supplied by the Licensor with the Licensed Material: + + i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of warranties; + + v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + + B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + + C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + + 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + + b. ShareAlike.In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. + + 1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + + b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + + b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + + 2. upon express reinstatement by the Licensor. + + c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + + d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + + e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + + c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + + d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. + +Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/LICENSES/CC0-1.0.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/LICENSES/GPL-2.0-only.txt b/LICENSES/GPL-2.0-only.txt new file mode 100644 index 0000000..17cb286 --- /dev/null +++ b/LICENSES/GPL-2.0-only.txt @@ -0,0 +1,117 @@ +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. + +signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice diff --git a/LICENSES/GPL-3.0-or-later.txt b/LICENSES/GPL-3.0-or-later.txt new file mode 100644 index 0000000..5862f1a --- /dev/null +++ b/LICENSES/GPL-3.0-or-later.txt @@ -0,0 +1,613 @@ +GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for software and +other kinds of works. + +The licenses for most software and other practical works are designed to take +away your freedom to share and change the works. By contrast, the GNU General +Public License is intended to guarantee your freedom to share and change all +versions of a program--to make sure it remains free software for all its +users. We, the Free Software Foundation, use the GNU General Public License +for most of our software; it applies also to any other work released this way + by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for them if you wish), that you +receive source code or can get it if you want it, that you can change the +software or use pieces of it in new free programs, and that you know you can +do these things. + +To protect your rights, we need to prevent others from denying you these +rights or asking you to surrender the rights. Therefore, you have certain +responsibilities if you distribute copies of the software, or if you modify +it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for +a fee, you must pass on to the recipients the same freedoms that you received. +You must make sure that they, too, receive or can get the source code. And you +must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert +copyright on the software, and (2) offer you this License giving you legal +permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that +there is no warranty for this free software. For both users' and authors' +sake, the GPL requires that modified versions be marked as changed, so that +their problems will not be attributed erroneously to authors of previous +versions. + +Some devices are designed to deny users access to install or run modified +versions of the software inside them, although the manufacturer can do so. +This is fundamentally incompatible with the aim of protecting users' freedom +to change the software. The systematic pattern of such abuse occurs in the +area of products for individuals to use, which is precisely where it is most +unacceptable. Therefore, we have designed this version of the GPL to prohibit +the practice for those products. If such problems arise substantially in other +domains, we stand ready to extend this provision to those domains in future +versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States +should not allow patents to restrict development and use of software on +general-purpose computers, but in those that do, we wish to avoid the special +danger that patents applied to a free program could make it effectively +proprietary. To prevent this, the GPL assures that patents cannot be used to +render the program non-free. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, +such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. +Each licensee is addressed as “you”. “Licensees” and “recipients” may be +individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a +fashion requiring copyright permission, other than the making of an exact +copy. The resulting work is called a “modified version” of the earlier work or +a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the +Program. + +To “propagate” a work means to do anything with it that, without permission, +would make you directly or secondarily liable for infringement under +applicable copyright law, except executing it on a computer or modifying a +private copy. Propagation includes copying, distribution (with or without +modification), making available to the public, and in some countries other +activities as well. + +To “convey” a work means any kind of propagation that enables other parties to +make or receive copies. Mere interaction with a user through a computer +network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the +extent that it includes a convenient and prominently visible feature that (1) +displays an appropriate copyright notice, and (2) tells the user that there is +no warranty for the work (except to the extent that warranties are provided), +that licensees may convey the work under this License, and how to view a copy +of this License. If the interface presents a list of user commands or options, +such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. The “source code” for a work means the preferred form of the +work for making modifications to it. “Object code” means any non-source form +of a work. + +A “Standard Interface” means an interface that either is an official standard +defined by a recognized standards body, or, in the case of interfaces +specified for a particular programming language, one that is widely used among +developers working in that language. + +The “System Libraries” of an executable work include anything, other than the +work as a whole, that (a) is included in the normal form of packaging a Major +Component, but which is not part of that Major Component, and (b) serves only +to enable use of the work with that Major Component, or to implement a +Standard Interface for which an implementation is available to the public in +source code form. A “Major Component”, in this context, means a major +essential component (kernel, window system, and so on) of the specific +operating system (if any) on which the executable work runs, or a compiler +used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source +code needed to generate, install, and (for an executable work) run the object +code and to modify the work, including scripts to control those activities. +However, it does not include the work's System Libraries, or general-purpose +tools or generally available free programs which are used unmodified in +performing those activities but which are not part of the work. For example, +Corresponding Source includes interface definition files associated with +source files for the work, and the source code for shared libraries and +dynamically linked subprograms that the work is specifically designed to +require, such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate +automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. All rights granted under this License are granted for +the term of copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited permission +to run the unmodified Program. The output from running a covered work is +covered by this License only if the output, given its content, constitutes a +covered work. This License acknowledges your rights of fair use or other +equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without +conditions so long as your license otherwise remains in force. You may convey +covered works to others for the sole purpose of having them make modifications +exclusively for you, or provide you with facilities for running those works, +provided that you comply with the terms of this License in conveying all +material for which you do not control copyright. Those thus making or running +the covered works for you must do so exclusively on your behalf, under your +direction and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 makes it +unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered +work shall be deemed part of an effective technological measure under any +applicable law fulfilling obligations under article 11 of the WIPO copyright +treaty adopted on 20 December 1996, or similar laws prohibiting or restricting +circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention is +effected by exercising rights under this License with respect to the covered +work, and you disclaim any intention to limit operation or modification of the +work as a means of enforcing, against the work's users, your or third parties' +legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's +source code as you receive it, in any medium, provided that you conspicuously +and appropriately publish on each copy an appropriate copyright notice; keep +intact all notices stating that this License and any non-permissive terms +added in accord with section 7 apply to the code; keep intact all notices of +the absence of any warranty; and give all recipients a copy of this License +along with the Program. + +You may charge any price or no price for each copy that you convey, and you +may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. You may convey a work based on the +Program, or the modifications to produce it from the Program, in the form of +source code under the terms of section 4, provided that you also meet all of +these conditions: + + a) The work must carry prominent notices stating that you modified it, + and giving a relevant date. + + b) The work must carry prominent notices stating that it is released + under this License and any conditions added under section 7. This + requirement modifies the requirement in section 4 to “keep intact all + notices”. + + c) You must license the entire work, as a whole, under this License to + anyone who comes into possession of a copy. This License will therefore + apply, along with any applicable section 7 additional terms, to the whole + of the work, and all its parts, regardless of how they are packaged. This + License gives no permission to license the work in any other way, but it + does not invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your work need + not make them do so. + +A compilation of a covered work with other separate and independent works, +which are not by their nature extensions of the covered work, and which are +not combined with it such as to form a larger program, in or on a volume of a +storage or distribution medium, is called an “aggregate” if the compilation +and its resulting copyright are not used to limit the access or legal rights +of the compilation's users beyond what the individual works permit. Inclusion +of a covered work in an aggregate does not cause this License to apply to the +other parts of the aggregate. + +6. Conveying Non-Source Forms. You may convey a covered work in object code +form under the terms of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, in one +of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium customarily used + for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a written + offer, valid for at least three years and valid for as long as you offer + spare parts or customer support for that product model, to give anyone + who possesses the object code either (1) a copy of the Corresponding + Source for all the software in the product that is covered by this + License, on a durable physical medium customarily used for software + interchange, for a price no more than your reasonable cost of physically + performing this conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the written + offer to provide the Corresponding Source. This alternative is allowed + only occasionally and noncommercially, and only if you received the + object code with such an offer, in accord with subsection 6b. + + d) Convey the object code by offering access from a designated place + (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no further + charge. You need not require recipients to copy the Corresponding Source + along with the object code. If the place to copy the object code is a + network server, the Corresponding Source may be on a different server + (operated by you or a third party) that supports equivalent copying + facilities, provided you maintain clear directions next to the object + code saying where to find the Corresponding Source. Regardless of what + server hosts the Corresponding Source, you remain obligated to ensure + that it is available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided you + inform other peers where the object code and Corresponding Source of the + work are being offered to the general public at no charge under + subsection 6d. + +A separable portion of the object code, whose source code is excluded from the +Corresponding Source as a System Library, need not be included in conveying +the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible +personal property which is normally used for personal, family, or household +purposes, or (2) anything designed or sold for incorporation into a dwelling. +In determining whether a product is a consumer product, doubtful cases shall +be resolved in favor of coverage. For a particular product received by a +particular user, “normally used” refers to a typical or common use of that +class of product, regardless of the status of the particular user or of the +way in which the particular user actually uses, or expects or is expected to +use, the product. A product is a consumer product regardless of whether the +product has substantial commercial, industrial or non-consumer uses, unless +such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, +authorization keys, or other information required to install and execute +modified versions of a covered work in that User Product from a modified +version of its Corresponding Source. The information must suffice to ensure +that the continued functioning of the modified object code is in no case +prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as part of a +transaction in which the right of possession and use of the User Product is +transferred to the recipient in perpetuity or for a fixed term (regardless of +how the transaction is characterized), the Corresponding Source conveyed under +this section must be accompanied by the Installation Information. But this +requirement does not apply if neither you nor any third party retains the +ability to install modified object code on the User Product (for example, the +work has been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates for a +work that has been modified or installed by the recipient, or for the User +Product in which it has been modified or installed. Access to a network may be +denied when the modification itself materially and adversely affects the +operation of the network or violates the rules and protocols for communication +across the network. + +Corresponding Source conveyed, and Installation Information provided, in +accord with this section must be in a format that is publicly documented (and +with an implementation available to the public in source code form), and must +require no special password or key for unpacking, reading or copying. + +7. Additional Terms. “Additional permissions” are terms that supplement the +terms of this License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall be +treated as though they were included in this License, to the extent that they +are valid under applicable law. If additional permissions apply only to part +of the Program, that part may be used separately under those permissions, but +the entire Program remains governed by this License without regard to the +additional permissions. + +When you convey a copy of a covered work, you may at your option remove any +additional permissions from that copy, or from any part of it. (Additional +permissions may be written to require their own removal in certain cases when +you modify the work.) You may place additional permissions on material, added +by you to a covered work, for which you have or can give appropriate copyright +permission. + +Notwithstanding any other provision of this License, for material you add to a +covered work, you may (if authorized by the copyright holders of that +material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms + of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or author + attributions in that material or in the Appropriate Legal Notices + displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in reasonable + ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some trade + names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that material by + anyone who conveys the material (or modified versions of it) with + contractual assumptions of liability to the recipient, for any liability + that these contractual assumptions directly impose on those licensors and + authors. + +All other non-permissive additional terms are considered “further +restrictions” within the meaning of section 10. If the Program as you received +it, or any part of it, contains a notice stating that it is governed by this +License along with a term that is a further restriction, you may remove that +term. If a license document contains a further restriction but permits +relicensing or conveying under this License, you may add to a covered work +material governed by the terms of that license document, provided that the +further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must +place, in the relevant source files, a statement of the additional terms that +apply to those files, or a notice indicating where to find the applicable +terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a +separately written license, or stated as exceptions; the above requirements +apply either way. + +8. Termination. You may not propagate or modify a covered work except as +expressly provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under this +License (including any patent licenses granted under the third paragraph of +section 11). + +However, if you cease all violation of this License, then your license from a +particular copyright holder is reinstated (a) provisionally, unless and until +the copyright holder explicitly and finally terminates your license, and (b) +permanently, if the copyright holder fails to notify you of the violation by +some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated +permanently if the copyright holder notifies you of the violation by some +reasonable means, this is the first time you have received notice of violation +of this License (for any work) from that copyright holder, and you cure the +violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses +of parties who have received copies or rights from you under this License. If +your rights have been terminated and not permanently reinstated, you do not +qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. You are not required to accept +this License in order to receive or run a copy of the Program. Ancillary +propagation of a covered work occurring solely as a consequence of using +peer-to-peer transmission to receive a copy likewise does not require +acceptance. However, nothing other than this License grants you permission to +propagate or modify any covered work. These actions infringe copyright if you +do not accept this License. Therefore, by modifying or propagating a covered + work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. Each time you convey a +covered work, the recipient automatically receives a license from the original +licensors, to run, modify and propagate that work, subject to this License. +You are not responsible for enforcing compliance by third parties with this +License. + +An “entity transaction” is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered work +results from an entity transaction, each party to that transaction who +receives a copy of the work also receives whatever licenses to the work the +party's predecessor in interest had or could give under the previous +paragraph, plus a right to possession of the Corresponding Source of the work +from the predecessor in interest, if the predecessor has it or can get it with +reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights +granted or affirmed under this License. For example, you may not impose a +license fee, royalty, or other charge for exercise of rights granted under +this License, and you may not initiate litigation (including a cross-claim or +counterclaim in a lawsuit) alleging that any patent claim is infringed by +making, using, selling, offering for sale, or importing the Program or any +portion of it. + +11. Patents. A “contributor” is a copyright holder who authorizes use under +this License of the Program or a work on which the Program is based. The work +thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or +controlled by the contributor, whether already acquired or hereafter acquired, +that would be infringed by some manner, permitted by this License, of making, +using, or selling its contributor version, but do not include claims that +would be infringed only as a consequence of further modification of the +contributor version. For purposes of this definition, “control” includes the +right to grant patent sublicenses in a manner consistent with the requirements +of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent +license under the contributor's essential patent claims, to make, use, sell, +offer for sale, import and otherwise run, modify and propagate the contents of +its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement +or commitment, however denominated, not to enforce a patent (such as an +express permission to practice a patent or covenant not to sue for patent +infringement). To “grant” such a patent license to a party means to make such +an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the +Corresponding Source of the work is not available for anyone to copy, free of +charge and under the terms of this License, through a publicly available +network server or other readily accessible means, then you must either (1) +cause the Corresponding Source to be so available, or (2) arrange to deprive +yourself of the benefit of the patent license for this particular work, or (3) +arrange, in a manner consistent with the requirements of this License, to +extend the patent license to downstream recipients. “Knowingly relying” means +you have actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work in a +country, would infringe one or more identifiable patents in that country that +you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you +convey, or propagate by procuring conveyance of, a covered work, and grant a +patent license to some of the parties receiving the covered work authorizing +them to use, propagate, modify or convey a specific copy of the covered work, +then the patent license you grant is automatically extended to all recipients +of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope +of its coverage, prohibits the exercise of, or is conditioned on the +non-exercise of one or more of the rights that are specifically granted under +this License. You may not convey a covered work if you are a party to an +arrangement with a third party that is in the business of distributing +software, under which you make payment to the third party based on the extent +of your activity of conveying the work, and under which the third party +grants, to any of the parties who would receive the covered work from you, a +discriminatory patent license (a) in connection with copies of the covered +work conveyed by you (or copies made from those copies), or (b) primarily for +and in connection with specific products or compilations that contain the +covered work, unless you entered into that arrangement, or that patent license +was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any +implied license or other defenses to infringement that may otherwise be +available to you under applicable patent law. + +12. No Surrender of Others' Freedom. If conditions are imposed on you +(whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of this +License. If you cannot convey a covered work so as to satisfy simultaneously +your obligations under this License and any other pertinent obligations, then +as a consequence you may not convey it at all. For example, if you agree to +terms that obligate you to collect a royalty for further conveying from those +to whom you convey the Program, the only way you could satisfy both those +terms and this License would be to refrain entirely from conveying the +Program. + +13. Use with the GNU Affero General Public License. Notwithstanding any other +provision of this License, you have permission to link or combine any covered +work with a work licensed under version 3 of the GNU Affero General Public +License into a single combined work, and to convey the resulting work. The +terms of this License will continue to apply to the part which is the covered +work, but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. The Free Software Foundation may +publish revised and/or new versions of the GNU General Public License from +time to time. Such new versions will be similar in spirit to the present +version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies that a certain numbered version of the GNU General Public License +“or any later version” applies to it, you have the option of following the +terms and conditions either of that numbered version or of any later version +published by the Free Software Foundation. If the Program does not specify a +version number of the GNU General Public License, you may choose any version +ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the +GNU General Public License can be used, that proxy's public statement of +acceptance of a version permanently authorizes you to choose that version for +the Program. + +Later license versions may give you additional or different permissions. +However, no additional obligations are imposed on any author or copyright +holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE +EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING +THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS +WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL +NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR +AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO +MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR +DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT +LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED +BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and +limitation of liability provided above cannot be given local legal effect +according to their terms, reviewing courts shall apply local law that most +closely approximates an absolute waiver of all civil liability in connection +with the Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible +use to the public, the best way to achieve this is to make it free software +which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively state the exclusion +of warranty; and each file should have at least the “copyright” line and a +pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like +this when it starts in an interactive mode: + + Copyright (C) This program comes with + ABSOLUTELY NO WARRANTY; for details type `show w'. This is free + software, and you are welcome to redistribute it under certain + conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands might +be different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if +any, to sign a “copyright disclaimer” for the program, if necessary. For more +information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General Public +License instead of this License. But first, please read +. diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000..2071b23 --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e6f0d32 --- /dev/null +++ b/README.md @@ -0,0 +1,200 @@ +# qusal + +Salt Formulas for Qubes OS. + +## Warning + +**Warning**: Not ready for production, development only. Breaking changes can +and will be introduced in the meantime. You've been warned. + +The following projects are incomplete (not a complete list): + +- sys-net: can't be provisioned automatically due to the minimal template +- sys-firewall: can't be provisioned automatically due to the minimal template +- sys-audio: not working on R4.1, waiting for R4.2 +- sys-wireguard: unfinished firewall port to nft, waiting for R4.2 +- sys-syncthing: broken firewall script functionality with disposable netvm + +Other projects might also have drastic changes, the above are simply not ready +at all. + +## Table of Contents + +* [Description](#description) +* [Design](#design) +* [Prerequisites](#prerequisites) +* [Installation](#installation) + * [DomU](#domu) + * [Dom0](#dom0) +* [Usage](#usage) +* [Contribute](#contribute) +* [Donate](#donate) +* [Support](#support) + * [Free Support](#free-support) + * [Paid Support](#paid-support) +* [Contact](#contact) +* [Credits](#credits) +* [Legal](#legal) + +## Description + +Qusal providers a Free and Open Source solution to customizing various tasks +in Qubes OS, from switching PCI handlers to be disposables or app qubes, +installing different pieces of software on dedicated minimal templates for +split agent operations for separating the key store from the client. + +Each project is in a separate directory, but they may interact with other +projects. + +If you want to edit the access control for any service, such as resolution to +allow, ask, deny or the intended target, you should always use the Qrexec +policy at `/etc/qubes/policy.d/30-user.policy`, as this file will take +precedence over the packaged policy. + +## Design + +Every project creates its own template, client and server (when necessary) +with only the required packages and configuration. You don't need to use a +separate template for everything, but if you want to do that, you will have +adjust the target of the qubesctl call or write Salt Top files. + +Qubes global settings (qubes-prefs) that will be managed: + +- **clockvm**: disp-sys-net, sys-net +- **default_dispvm**: reader +- **default_netvm**: sys-pihole, sys-firewall or disp-sys-firewall +- **management_dispvm**: dvm-mgmt +- **updatevm**: sys-pihole, sys-firewall or disp-sys-firewall + +To be implemented: +- **default_audiovm**: sys-audio +- **default_guivm**: sys-gui + +## Prerequisites + +You current setup needs to fulfill the following requisites: + +- Qubes OS R4.1 +- Internet connection + +## Installation + +### DomU + +1. Install `git` in the downloader qube, if it is an AppVM, install it in the +TemplateVM. + +2. Clone this repository in an app qube: +```sh +git clone --recurse-submodules https://github.com/ben-grande/qusal.git +``` +If you made a fork, before cloning it, fork the submodule(s). Clone your own +project instead of this one, the submodules will be from your fork also. + +3. Verify the [commit or tag signature](https://www.qubes-os.org/security/verifying-signatures/#how-to-verify-signatures-on-git-repository-tags-and-commits). + +### Dom0 + +Before copying anything to Dom0, read [Qubes OS warning about consequences of +this procedure](https://www.qubes-os.org/doc/how-to-copy-from-dom0/#copying-to-dom0). + +1. Copy this repository from some qube to Dom0 from Dom0: +```sh +mkdir -p ~/QubesIncoming/ +qvm-run -p tar -cC qusal | tar -xvC ~/QubesIncoming/ qusal +## Example: mkdir -p ~/QubesIncoming/dev +## Example: qvm-run -p dev tar -cC /home/user qusal | tar -xvC ~/QubesIncoming/dev qusal +``` + +2. Copy the project to the Salt directories: +```sh +cd ~/QubesIncoming//qusal +./scripts/setup.sh +``` + +## Usage + +Qusal is now installed. Please read the README.md of each project for further +information on how to install the desired package. + +The intended behavior is to enforce the state of qubes and their services. If +you modify the qubes and their services and apply the state again, there is a +good chance your choices will be overwritten. To enforce your state, write a +SaltFile to specify the desired state, do not do it manually, we are past +that. + +The only Qrexec policy file you should change is +`/etc/qubes/policy.d/30-user.policy` as this file will take precedence over +the ones provided by this project. If you modify the policies provided by +Qusal, your changes will be overwritten next time you install/upgrade the +packages. + +Please note that when you allow more Qrexec calls than the default shipped by +Qubes OS, you are increasing the attack surface of the target, normally +valuable qube that can hold secrets or pristine data. A compromise of the +client qube can extend to the server, therefore configure the installation +according to your threat model. + +## Contribute + +There are several ways to contribute to this project. Spread the word, help on +user support, review opened issues, fix typos, implement new features, +donations. + +Please take a look at [contribution guidelines](CONTRIBUTING.md) before +contributing code or to the documentation, it holds important information on +how the project is structured, why some design decisions were made and what +can be improved. + +## Donate + +This project can only survive through donations. If you like what we have +done, please consider donating. [Contact us](#contact) for donation address. + +This project depends on Qubes OS, consider donating to +[upstream](https://qubes-os.org/donate/). + +## Support + +### Free Support + +Free support will be provided on a best effort basis. If you want something, +open an issue and patiently wait for a reply, the project is best developed in +the open so anyone can search for past issues. + +### Paid Support + +Paid consultation services can be provided. +Request a quote [from us](#contact). + +## Contact + +You must not contact for [free support](#free-support). + +- [E-mail](https://github.com/ben-grande/ben-grande) + +## Credits + +I stand on the shoulders of giants. This would not be possible without people +contributing to Qubes OS SaltStack formulas. Honorable mention(s): +[unman](https://github.com/unman). + +## Legal + +This project is [REUSE-compliant](https://reuse.software). It is difficult to +list all licenses and copyrights and keep them up-to-date here. + +The easiest way to get the copyright and license of the project with the reuse +tool: +```sh +reuse spdx +``` + +You can also check these information manually by looking in the file header, +a companion `.license` file or in `.reuse/dep5`. + +All licenses are present in the LICENSES directory. + +Note that submodules have their own licenses and copyrights statements, please +check each one individually using the same methods described above for a full +statement. diff --git a/minion.d/qusal.conf b/minion.d/qusal.conf new file mode 100644 index 0000000..a4ff942 --- /dev/null +++ b/minion.d/qusal.conf @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: MIT + +--- +file_roots: + base: + - /srv/salt/qusal +# vim:ft=yaml diff --git a/rpm_spec/template/template.spec b/rpm_spec/template/template.spec new file mode 100644 index 0000000..8a807a9 --- /dev/null +++ b/rpm_spec/template/template.spec @@ -0,0 +1,82 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +%define file_roots %(./scripts/spec-get.sh @PROJECT@ file_roots) +%define my_name %(./scripts/spec-get.sh @PROJECT@ name) +%define branch %(./scripts/spec-get.sh @PROJECT@ branch) +%define project %(./scripts/spec-get.sh @PROJECT@ project) +%define release %(./scripts/spec-get.sh @PROJECT@ release) +%define summary %(./scripts/spec-get.sh @PROJECT@ summary) +%define group %(./scripts/spec-get.sh @PROJECT@ group) +%define vendor %(./scripts/spec-get.sh @PROJECT@ vendor) +%define license_csv %(./scripts/spec-get.sh @PROJECT@ license_csv) +%define license %(./scripts/spec-get.sh @PROJECT@ license) +%define url %(./scripts/spec-get.sh @PROJECT@ url) +%define my_description %(./scripts/spec-get.sh @PROJECT@ description) + +Name: %{project} +Version: @VERSION@ +Release: %autorelease +Summary: %{summary} + +Group: %{group} +Vendor: %{vendor} +License: %{license} +URL: %{url} +Source0: %{project} + +@REQUIRES@ + +%description +%{my_description} + +%prep + +%build + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}%{file_roots} +cp -rv %{project} %{buildroot}%{file_roots}/%{my_name} + +%check + +%pre + +%post +if test "$1" = "1"; then + ## Install + @POST_INSTALL@ +elif test "$1" = "2"; then + ## Upgrade + @POST_UPGRADE@ +fi + +%preun +if test "$1" = "0"; then + ## Uninstall + @PREUN_UNINSTALL@ +elif test "$1" = "1"; then + ## Upgrade + @PREUN_UPGRADE@ +fi + +%postun +if test "$1" = "0"; then + ## Uninstall + @POSTUN_UNINSTALL@ +elif test "$1" = "1"; then + ## Upgrade + @POSTUN_UPGRADE@ +fi + +%files +%defattr(-,root,root,-) +%license %{file_roots}/%{my_name}/LICENSES/%{license_csv} +%doc %{file_roots}/%{my_name}/README.md +%dir %{file_roots}/%{my_name}/* +%dnl %{file_roots}/%{my_name}/* + +%changelog +%dnl %autochangelog diff --git a/salt/ansible/README.md b/salt/ansible/README.md new file mode 100644 index 0000000..de91a23 --- /dev/null +++ b/salt/ansible/README.md @@ -0,0 +1,53 @@ +# ansible + +Ansible environment in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Install Ansible and use it on the "ansible" app qube. + +## Installation + +- Top +```sh +qubesctl top.enable ansible +qubesctl --targets=tpl-ansible,ansible,ansible-minion state.apply +qubesctl top.disable ansible +``` + +- State + +```sh +qubesctl state.apply ansible.create +qubesctl --skip-dom0 --targets=tpl-ansible state.apply ansible.install +qubesctl --skip-dom0 --targets=ansible state.apply ansible.configure,zsh.touch-zshrc +qubesctl --skip-dom0 --targets=ansible-minion state.apply ansible.configure-minion,zsh.touch-zshrc +``` + + +## Usage + +Configure the control node `ansible`: +```sh +ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ansible +qvm-copy ~/.ssh/id_ansible.pub +``` +Select `ansible-minion` as the target qube for the copy operation. + +Configure the minion `ansible-minion`: +```sh +mkdir -m 0700 ~/.ssh +cat ~/QubesIncoming/ansible/id_ansible.pub >> ~/.ssh/authorized_keys +``` + +From the control node `ansible`, test connection to the minion +`ansible-minion`: +```sh +ssh minion +``` diff --git a/salt/ansible/clone.sls b/salt/ansible/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/ansible/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/ansible/clone.top b/salt/ansible/clone.top new file mode 100644 index 0000000..eea4dfb --- /dev/null +++ b/salt/ansible/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - ansible.clone diff --git a/salt/ansible/configure-minion.sls b/salt/ansible/configure-minion.sls new file mode 100644 index 0000000..2c09af9 --- /dev/null +++ b/salt/ansible/configure-minion.sls @@ -0,0 +1,26 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-minion-start-sshd": + file.managed: + - name: /rw/config/rc.local + - source: salt://{{ slsdotpath }}/files/client/rc.local + - mode: '0755' + - user: root + - group: root + +"{{ slsdotpath }}-minion-ssh-authorized_keys": + file.touch: + - name: /home/user/.ssh/authorized_keys + - dir_mode: '0700' + - file_mode: '0600' + - user: user + - group: user + - makedirs: True + +{% endif -%} diff --git a/salt/ansible/configure-minion.top b/salt/ansible/configure-minion.top new file mode 100644 index 0000000..67e89d5 --- /dev/null +++ b/salt/ansible/configure-minion.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'ansible': + - ansible.configure-minion diff --git a/salt/ansible/configure.sls b/salt/ansible/configure.sls new file mode 100644 index 0000000..3e83280 --- /dev/null +++ b/salt/ansible/configure.sls @@ -0,0 +1,27 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-autostart-ssh-over-qrexec": + file.managed: + - name: /rw/config/rc.local + - source: salt://{{ slsdotpath }}/files/server/rc.local + - mode: '0755' + - user: root + - group: root + +"{{ slsdotpath }}-ssh-config": + file.managed: + - name: /home/user/.ssh/config + - source: salt://{{ slsdotpath }}/files/server/ssh-config + - file_mode: '0600' + - dir_mode: '0700' + - user: root + - group: root + - makedirs: True + +{% endif -%} diff --git a/salt/ansible/configure.top b/salt/ansible/configure.top new file mode 100644 index 0000000..b413a8e --- /dev/null +++ b/salt/ansible/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'ansible': + - ansible.configure diff --git a/salt/ansible/create.sls b/salt/ansible/create.sls new file mode 100644 index 0000000..725be2a --- /dev/null +++ b/salt/ansible/create.sls @@ -0,0 +1,79 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: tpl-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +prefs: +- memory: 300 +- maxmem: 400 +features: +- set: + - default-menu-items: "qubes-run-terminal.desktop qubes-start.desktop" + - menu-items: "qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: purple +prefs: +- template: tpl-{{ slsdotpath }} +- label: purple +- netvm: "" +- vcpus: 1 +- memory: 400 +- maxmem: 500 +- autostart: False +- include_in_backups: True +features: +- set: + - menu-items: "qubes-run-terminal.desktop qubes-start.desktop" +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }}-minion +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: purple +prefs: +- template: tpl-{{ slsdotpath }} +- label: purple +- netvm: "" +- vcpus: 1 +- memory: 400 +- maxmem: 500 +- autostart: False +- include_in_backups: True +features: +- set: + - menu-items: "qubes-run-terminal.desktop qubes-start.desktop" +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/ansible/create.top b/salt/ansible/create.top new file mode 100644 index 0000000..df7ca35 --- /dev/null +++ b/salt/ansible/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - ansible.create diff --git a/salt/ansible/files/admin/policy/default.policy b/salt/ansible/files/admin/policy/default.policy new file mode 100644 index 0000000..ff63687 --- /dev/null +++ b/salt/ansible/files/admin/policy/default.policy @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +qubes.ConnectTCP +22 {{ sls_path }} @default allow target={{ sls_path }}-minion +## vim:ft=qrexecpolicy diff --git a/salt/ansible/files/client/99-sshd-ansible.conf b/salt/ansible/files/client/99-sshd-ansible.conf new file mode 100644 index 0000000..529ee4f --- /dev/null +++ b/salt/ansible/files/client/99-sshd-ansible.conf @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +PubkeyAuthentication yes + +# vim: ft=sshdconfig diff --git a/salt/ansible/files/client/rc.local b/salt/ansible/files/client/rc.local new file mode 100755 index 0000000..37ff103 --- /dev/null +++ b/salt/ansible/files/client/rc.local @@ -0,0 +1,2 @@ +systemctl unmask ssh +systemctl --no-block start ssh diff --git a/salt/ansible/files/repo/ansible.asc b/salt/ansible/files/repo/ansible.asc new file mode 100644 index 0000000..ab2304c --- /dev/null +++ b/salt/ansible/files/repo/ansible.asc @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Comment: Hostname: +Version: Hockeypuck 2.1.0-222-g25248d4 + +xsFNBFOXbTABEADKLcY3MYZyHIiCEu8cQ+0UzxZolTYZf8xZ06/d8xzUW/UBPTLV +x/40IzWJEZU87GCYVXUhdYXECrFQKQOOEWQswBxOt26/g0nIrU0edZ9cCZ9o9+ZO +sKDcScWNxWeclLr2+YHdmX9eph+2p+zIPmhNJaaWV6/bSo1fBi7ganZFRAc13zO8 +jtQsYyIeoAFwjt1vbk9CifdFhEchRVbwvZYhZDWfBZjhZ15UOunjo47gEkpK0PsW +HY5N3/c75pGMwMTCjHMKno6KFzhdKLaz/QgbNnpy1aMkA/LITeU6Pgg6iqofrSY3 +Fx73MCAb8EEytvSV/65wztKzexHjGYxhm5ygoET5tPyXciX0+XzojkZAHzUEeT5z +4kgL6OLyn+JQAyRDNnOJEkYmvwQveZuUjsYUkgc5DJdg6w7lTgQHWObOENpXls3B +DnphA4DJyc0PQODCxdSZo4ZXMLn5lE/0qvAJ6g/wntY/ee/vRKwy9iDMOWQvihTI +Y/L70/TnE4qZdaNbOJEvW59LT6GBTrcU1MX2fS5hU/mQa2CNixSVZG98rba3tfNa +LDDNqivkcxtWryEWd0giBzzUS+MhtxhHm77YgxNVyyFn8bXb25/W+Jq+VvWWx2KD +3ZwVD37X8wIBRLVozoH0jHVW7jKTnf2z+D6FCM+pVlm8zV1upXbHbdaRqwARAQAB +zR9MYXVuY2hwYWQgUFBBIGZvciBBbnNpYmxlLCBJbmMuwsF4BBMBAgAiBQJTl20w +AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCTxKP9e7nDZwzdD/9yFq+3 +ptLyWP1JN3RXsvTIJLhhjOqMMJCOocV0G3slHeUtdIDmvd2RaS8PeFNSd9QFbUzk +a7pBXec3a7kgEVorty2/+cZSpEVHT26oAbJnoH7E1YGii8bbnk9LqOCF/nLpasEq +PKqtVzXz+vGB7G0ox8qmRm6JynrMeLBftYemxJ8e4fii6APJxE6FPz/AvgcN3BtB +guseFwcga6lGcmp0JLofGhTbejfS9dW9bnCFJBtRfzUVd+Cb8aYuzV5zgCJgqOBJ +Hf0L6xDwn8UuzRfi0MWzEskuC/KxUJqVHMuTaLdrSeP1/czompetbsSHTfDklf/p +4EbSM9VqZFiKr17we0LdigAEv2JnL2Qj0oN3eRNU0sDJ3kZvh5qhnteNgSRM/el0 +Sly+34CRZzX25vd+pOTgwK6VFx3wvWfqn3pVNT9ASNalhogFXuBY2ukYJaiUTPsS +R4+KHiD3eIhWyayBGP+GRvGb5dVC29k4CjLvQM9lISmZrrxGmMGoV9S1dh7siZYE +CaVW0nKI95d6bBHaKH1g5HJ7NEsVTwf8LRY/FFpLsEPVw4HNVqqqwhuJnSW70WQ3 +blh0RIX/+z9hAla+M0kix7r0lS89ZBdTgwPuiCrkPRpoxi06ah/Q62uP3ZN4+dew +1sBZdaC9kaKdOOWTqArVnaPObQgUUJFhY9wUsA== +=uKv4 +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/ansible/files/repo/ansible.list b/salt/ansible/files/repo/ansible.list new file mode 100644 index 0000000..9f52a4e --- /dev/null +++ b/salt/ansible/files/repo/ansible.list @@ -0,0 +1,2 @@ +deb [signed-by=/usr/share/keyrings/ansible.asc] http://ppa.launchpad.net/ansible/ansible/ubuntu focal main +# vim: ft=debsources diff --git a/salt/ansible/files/repo/ansible.sources b/salt/ansible/files/repo/ansible.sources new file mode 100644 index 0000000..b46570d --- /dev/null +++ b/salt/ansible/files/repo/ansible.sources @@ -0,0 +1,6 @@ +Types: deb +URIs: http://ppa.launchpad.net/ansible/ansible/ubuntu +Suites: jammy +Components: main +Signed-by: /usr/share/keyrings/ansible.asc +# vim: ft=debsources diff --git a/salt/ansible/files/server/99-ssh-ansible.conf b/salt/ansible/files/server/99-ssh-ansible.conf new file mode 100644 index 0000000..f15b137 --- /dev/null +++ b/salt/ansible/files/server/99-ssh-ansible.conf @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +Host minion ansible-minion + Hostname 127.0.0.1 + Port 22000 + User user + IdentityFile ~/.ssh/id_ansible.pub + PreferredAuthentications publickey + +# vim: ft=sshconfig diff --git a/salt/ansible/files/server/rc.local b/salt/ansible/files/server/rc.local new file mode 100755 index 0000000..b60d619 --- /dev/null +++ b/salt/ansible/files/server/rc.local @@ -0,0 +1 @@ +qvm-connect-tcp 22000:@default:22 diff --git a/salt/ansible/init.top b/salt/ansible/init.top new file mode 100644 index 0000000..d04f631 --- /dev/null +++ b/salt/ansible/init.top @@ -0,0 +1,17 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - ansible.create + 'tpl-ansible': + - ansible.install + 'ansible': + - zsh.touch-zshrc + - ansible.configure + 'ansible-minion': + - ansible.configure-minion diff --git a/salt/ansible/install.sls b/salt/ansible/install.sls new file mode 100644 index 0000000..9abc1de --- /dev/null +++ b/salt/ansible/install.sls @@ -0,0 +1,63 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - utils.tools.zsh + - ssh.install + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - ansible + - python3-argcomplete + - python3-jmespath + - openssh-server + - qubes-core-agent-passwordless-root + - bash-completion + - man-db + +{% set pkg = { + 'Debian': { + 'pkg': ['vim-nox', 'python3-selinux'], + }, + 'RedHat': { + 'pkg': ['vim-enhanced', 'vim-ansible'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-installed-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +"{{ slsdotpath }}-ssh-config": + file.managed: + - name: /etc/ssh/ssh_config.d/99-ssh-ansible.conf + - source: salt://{{ slsdotpath }}/files/server/99-ssh-ansible.conf + - mode: '0644' + - user: root + - group: root + +"{{ slsdotpath }}-sshd-config": + file.managed: + - name: /etc/ssh/sshd_config.d/99-sshd-ansible.conf + - source: salt://{{ slsdotpath }}/files/client/99-sshd-ansible.conf + - mode: '0644' + - user: root + - group: root + +{% endif -%} diff --git a/salt/ansible/install.top b/salt/ansible/install.top new file mode 100644 index 0000000..9b50e4c --- /dev/null +++ b/salt/ansible/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-ansible': + - ansible.install diff --git a/salt/browser/README.md b/salt/browser/README.md new file mode 100644 index 0000000..e7a603a --- /dev/null +++ b/salt/browser/README.md @@ -0,0 +1,85 @@ +# browser + +Browser environment in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) + * [Choose you browser](#choose-you-browser) +* [Usage](#usage) + +## Description + +Create environment for browsing. By default it creates a disposable template +called "dvm-browser", so when clicking the icon/launcher, it opens a +disposable qube. If you want to save your session, you can also clone the +template and create app qubes. + +Default browser to install is Chromium, but you can choose to install Chrome, +Firefox-ESR, W3M or Lynx. + +## Installation + +- Top +```sh +qubesctl top.enable browser +qubesctl --targets=tpl-browser state.apply +qubesctl top.disable browser +qubesctl state.apply browser.appmenus +``` + +- State + +```sh +qubesctl state.apply browser.create +qubesctl --skip-dom0 --targets=tpl-browser state.apply browser.install +qubesctl state.apply browser.appmenus +``` + + +### Choose you browser + +Instead of running the state `browser.install`, you can select which browser +to install: + +- Chromium: +```sh +qubesctl --skip-dom0 --targets=tpl-browser state.apply browser.install-chromium +``` +- Chrome: +```sh +qubesctl --skip-dom0 --targets=tpl-browser state.apply browser.install-chrome +``` +- Firefox-ESR: +```sh +qubesctl --skip-dom0 --targets=tpl-browser state.apply browser.install-firefox +``` +- W3M: +```sh +qubesctl --skip-dom0 --targets=tpl-browser state.apply browser.install-w3m +``` +- Lynx: +```sh +qubesctl --skip-dom0 --targets=tpl-browser state.apply browser.install-lynx +``` + +Do not forget to sync the `appmenus`: +```sh +qubesctl state.apply browser.appmenus +``` + +## Usage + +Open a disposable qube simply by clicking on the desktop application +`dvm-browser (dvm): Browser`. + +If you want to use a permanent browser session, create an app qube based on +`tpl-browser`. + +If you are forwarding URLs from other qubes via `qvm-open-in-(d)vm`, you might +want to set your preferred browser as the default browser in `tpl-browser` +targeting the desired desktop file: +```sh +xdg-settings set default-web-browser firefox-esr.desktop +``` diff --git a/salt/browser/appmenus.sls b/salt/browser/appmenus.sls new file mode 100644 index 0000000..a84a247 --- /dev/null +++ b/salt/browser/appmenus.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus('tpl-' ~ sls_path) }} diff --git a/salt/browser/appmenus.top b/salt/browser/appmenus.top new file mode 100644 index 0000000..26f07e7 --- /dev/null +++ b/salt/browser/appmenus.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - browser.appmenus diff --git a/salt/browser/clone.sls b/salt/browser/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/browser/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/browser/clone.top b/salt/browser/clone.top new file mode 100644 index 0000000..8734082 --- /dev/null +++ b/salt/browser/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - browser.clone diff --git a/salt/browser/create.sls b/salt/browser/create.sls new file mode 100644 index 0000000..3f2b2f7 --- /dev/null +++ b/salt/browser/create.sls @@ -0,0 +1,51 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: tpl-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +prefs: +- memory: 300 +- maxmem: 2000 +features: +- set: + - default-menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop" + - menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: dvm-{{ slsdotpath }} +force: True +require: +- qvm: tpl-{{ slsdotpath }} +present: +- template: tpl-{{ slsdotpath }} +- label: red +prefs: +- label: red +- memory: 300 +- maxmem: 2000 +- vcpus: 1 +- template_for_dispvms: True +- include_in_backups: False +features: +- disable: + - service.tracker + - service.evolution-data-server +- enable: + - appmenus-dispvm +- set: + - menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} diff --git a/salt/browser/create.top b/salt/browser/create.top new file mode 100644 index 0000000..a8ff1ea --- /dev/null +++ b/salt/browser/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - browser.create diff --git a/salt/browser/files/repo/chrome.asc b/salt/browser/files/repo/chrome.asc new file mode 100644 index 0000000..e1e0a48 --- /dev/null +++ b/salt/browser/files/repo/chrome.asc @@ -0,0 +1,226 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGiBEXwb0YRBADQva2NLpYXxgjNkbuP0LnPoEXruGmvi3XMIxjEUFuGNCP4Rj/a +kv2E5VixBP1vcQFDRJ+p1puh8NU0XERlhpyZrVMzzS/RdWdyXf7E5S8oqNXsoD1z +fvmI+i9b2EhHAA19Kgw7ifV8vMa4tkwslEmcTiwiw8lyUl28Wh4Et8SxzwCggDcA +feGqtn3PP5YAdD0km4S4XeMEAJjlrqPoPv2Gf//tfznY2UyS9PUqFCPLHgFLe80u +QhI2U5jt6jUKN4fHauvR6z3seSAsh1YyzyZCKxJFEKXCCqnrFSoh4WSJsbFNc4PN +b0V0SqiTCkWADZyLT5wll8sWuQ5ylTf3z1ENoHf+G3um3/wk/+xmEHvj9HCTBEXP +78X0A/0Tqlhc2RBnEf+AqxWvM8sk8LzJI/XGjwBvKfXe+l3rnSR2kEAvGzj5Sg0X +4XmfTg4Jl8BNjWyvm2Wmjfet41LPmYJKsux3g0b8yzQxeOA4pQKKAU3Z4+rgzGmf +HdwCG5MNT2A5XxD/eDd+L4fRx0HbFkIQoAi1J3YWQSiTk15fw7RMR29vZ2xlLCBJ +bmMuIExpbnV4IFBhY2thZ2UgU2lnbmluZyBLZXkgPGxpbnV4LXBhY2thZ2VzLWtl +eW1hc3RlckBnb29nbGUuY29tPohjBBMRAgAjAhsDBgsJCAcDAgQVAggDBBYCAwEC +HgECF4AFAkYVdn8CGQEACgkQoECDD3+sWZHKSgCfdq3HtNYJLv+XZleb6HN4zOcF +AJEAniSFbuv8V5FSHxeRimHx25671az+uQINBEXwb0sQCACuA8HT2nr+FM5y/kzI +A51ZcC46KFtIDgjQJ31Q3OrkYP8LbxOpKMRIzvOZrsjOlFmDVqitiVc7qj3lYp6U +rgNVaFv6Qu4bo2/ctjNHDDBdv6nufmusJUWq/9TwieepM/cwnXd+HMxu1XBKRVk9 +XyAZ9SvfcW4EtxVgysI+XlptKFa5JCqFM3qJllVohMmr7lMwO8+sxTWTXqxsptJo +pZeKz+UBEEqPyw7CUIVYGC9ENEtIMFvAvPqnhj1GS96REMpry+5s9WKuLEaclWpd +K3krttbDlY1NaeQUCRvBYZ8iAG9YSLHUHMTuI2oea07Rh4dtIAqPwAX8xn36JAYG +2vgLAAMFB/wKqaycjWAZwIe98Yt0qHsdkpmIbarD9fGiA6kfkK/UxjL/k7tmS4Vm +CljrrDZkPSQ/19mpdRcGXtb0NI9+nyM5trweTvtPw+HPkDiJlTaiCcx+izg79Fj9 +KcofuNb3lPdXZb9tzf5oDnmm/B+4vkeTuEZJ//IFty8cmvCpzvY+DAz1Vo9rA+Zn +cpWY1n6z6oSS9AsyT/IFlWWBZZ17SpMHu+h4Bxy62+AbPHKGSujEGQhWq8ZRoJAT +G0KSObnmZ7FwFWu1e9XFoUCt0bSjiJWTIyaObMrWu/LvJ3e9I87HseSJStfw6fki +5og9qFEkMrIrBCp3QGuQWBq/rTdMuwNFiEkEGBECAAkFAkXwb0sCGwwACgkQoECD +D3+sWZF/WACfeNAu1/1hwZtUo1bR+MWiCjpvHtwAnA1R3IHqFLQ2X3xJ40XPuAyY +/FJGmQINBFcMjNMBEAC6Wr5QuLIFgz1V1EFPlg8ty2TsjQEl4VWftUAqWlMevJFW +vYExBOsOZ6kNFfBfjAxgJNWTkxZrHzDl74R7KW/nUx6X57bpFjUyRaB8F3/NpWKS +eIGSpJT+0m2SgUNhLAn1WY/iNJGNaMl7lgUnaP+/ZsSNT9hyTBiH3Ev5VvAtMGhV +I/u8P0EtTjXp4o2U+VqFTBGmZ6PJVhCFjZUeRByloHw8dGOshfXKgriebpioHvU8 +iQ2UGV3WNIirB2Rq1wkKxXJ/9Iw+4l5m4GmXMs7n3XaYQoBj28H86YA1cYWSm5LR +5iU2TneI1fJ3vwF2vpSXVBUUDk67PZhg6ZwGRT7GFWskC0z8PsWd5jwK20mA8EVK +q0vNBFmMK6i4fJU+ux17Rgvnc9tDSCzFZ1/4f43EZ41uTmmNXIDsaPCqwjvSS5IC +adt2xeqTWDlzONUpOs5yBjF1cfJSdVxsfshvln2JXUwgIdKl4DLbZybuNFXnPffN +Lb2vPtRJHO48O2UbeXS8n27PcuMoLRd7+r7TsqG2vBH4t/cB/1vsvWMbqnQlaJ5V +sjeWTp8Gv9FJiKuU8PKiWsF4EGR/kAFyCB8QbJeQ6HrOT0CXLOaYHRu2TvJ4taY9 +doXn98TgU03XTLcYoSp49cdkkis4K+9hd2dUqARVCG7UVd9PY60VVCKi47BVKQAR +AQABtFRHb29nbGUgSW5jLiAoTGludXggUGFja2FnZXMgU2lnbmluZyBBdXRob3Jp +dHkpIDxsaW51eC1wYWNrYWdlcy1rZXltYXN0ZXJAZ29vZ2xlLmNvbT6JAjgEEwEC +ACIFAlcMjNMCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEHch9jvTi0eW +5CAP/RELE/OAoA4o1cMBxJsljWgCgDig2Ge91bFCN0vExLcP0iByra7qPWJowXDJ +5sCjUBnCkrxGo5D15U7cW5FC0+qWU73q0AuG3OjKDQ49ecdRkYHwcvwWQvT5Lz3D +wOGW4armfEuzWXcUDeShR7AgfcTq+Pfoo3dHqdB8TmtNySu/AdJFmVH/xTiWYWrO +SibhyLuaSW/0cTkHW0GDk06MlDkcdkTzhO5GMDO7PUxBgCysTXFR0T9TVWDo9Vwv +uMww2pE5foleA0X6PD/6GQpy3aX2xry8rhFvYplEa5zwXhqsscdKXlp1ZPZ4PMvv +we495mY9n/1Rx1TmMvIcLHKP61sURMOve97Gipk/iD6oaeeT8I0khexHCQy7JMRO +oPMrz5onVOt2rAGZScIZsm5FYGSt9eDKBWI6qpJ/5QoVhkRWjOXOchZlJHo+kLdg +6jq2vOnIlFnXo0p6Rqf/IEq5PMh70vVZpk4tNYNy4zRx03ZTA9qXRLW+ftxSQIYM +Y5eCZ31lqSH4EjqgtUG+zn2A6juKayb1nkt2O3F1wWOm6oTzNsAP5LdReJRlw151 +Jp4U4ftGtw7ygq+nvokXL7YLuu8sbFqfFXcTPrAZa5M9gnC7GCnIQyF/WvqUnrca +C1jpqBc+pkSJhROhN12QY8Po8AT8/UaUh/dPIiW5A4o8pOPEiEYEEBECAAYFAlcN +tn8ACgkQoECDD3+sWZGy3wCfWTMZWsipX+yG/VB4Q1FunIfEVHYAnimEXCjZ3IVy +y5F1yU36PihDCjWqiEYEEBECAAYFAlcNtvEACgkQMUcsOzG36APnRwCeJ/bfGf8F +Ba4q5TMw8p1GS1jWT5EAn2sc02481HHdTmZiW/CGWXmgE+OPuQINBFcMjcgBEACr +L9gHhdr6gQX4ZMA5slp628xOrHCsdLO54WNdPRKeFHXJqSSJi3fs8FxBWI4Fneje +KUGbF+MrOlFpKqELxaMje7bwZyap3izztZHszP3YmOoTBJvREGKdCkL82cLsChYD +/PrgE8crvkhSnq9evcsKAnziMxg/wDCChUL3Evqo29BeoB81f+E9wkrUTMCT/kVx +t3pGRalKX0UhrtKrpm8yRfjufJfwjkdwgvinkRGZ2GrWHj4LzMbi9/udYaJZ66Yw +0hEU4USxUB9vNtmSFrb4EB91T2rhc68dgQ4jYBI7K4Ebb8XaWAxb+IAq31l1UkiE +A32F4qUMoL6rChB4y6nHxOnTvs+XEb5TBwXVogjLRKTQs5U/HV9l7j+HAchk5y3i +m2N2UKmMxHqotvPZZUZPdaCRxUedQf9gR0yLZV+U9BcDuwjzL/zjrthNZYlEGJ6H +Z/TLSTp4dDH+uXuLqMVWy5iquKtnbrnNTQtv5twD+Ajpgy60YLOJ9YaiJ4GjifOp +zSk83e1rJ3p/pX6B5NWQinVLZJzxyeOoh3iMjdmCDSnEXLrCmYv5g6jyV/Wbd4GY +FuMK8TT7+PQdWLcbZ/Lxc5w0s+c7+f5OfmKXO5KPHnnUsrF5DBaKRPjScpwePQit +xeIglUgEMDkNruBhu1PzCxd3BtXgu++K3WdoH3VcgwARAQABiQREBBgBAgAPBQJX +DI3IAhsCBQkFo5qAAikJEHch9jvTi0eWwV0gBBkBAgAGBQJXDI3IAAoJEBOXvFNk +DbVRQSYP/0Ewr3T7e0soTz8g4QJLLVqZDZdX8Iez04idNHuvAu0AwdZ2wl0C+tMk +D7l4R2aI6BKe/9wPndk/NJe+ZYcD/uzyiKIJQD48PrifNnwvHu9A80rE4BppQnpl +ENehibbWaGNJQONGFJx7QTYlFjS5LNlG1AX6mQjxvb423zOWSOmEamYXYBmYyMG6 +vkr/XTPzsldky8XFuPrJUZslL/Wlx31XQ1IrtkHHOYqWwr0hTc50/2O8H0ewl/dB +ZLq3EminZZ+tsTugof0j4SbxYhplw99nGwbN1uXy4L8/dWOUXnY5OgaTKZPF15zR +MxXN9FeylBVYpp5kzre/rRI6mQ2lafYHdbjvd7ryHF5JvYToSDXd0mzF2nLzm6jw +sO847ZNd5GdTD6/vcef1IJta1nSwA/hhLtgtlz6/tNncp3lEdCjAMx29jYPDX+Lq +s9JAxcJHufr82o6wM9TF24Q8ra8NbvB63odVidCfiHoOsIFDUrazH8XuaQzyZkI0 +bbzLmgMAvMO6u1zPfe/TK6LdJg7AeAKScOJS38D5mmwaD1bABr67ebA/X5HdaomS +DKVdUYaewfTGBIsrWmCmKpdb+WfX4odFpNzXW/qskiBp5WSesKvN1QUkLJZDZD1k +z2++Xul5B97s5LxLTLRwvgLoNaUFr3lnejzNLgdBpf6FnkA59syRUuIP/jiAZ2uJ +zXVKPeRJqMGL+Ue2HiVEe8ima3SQIceqW8jKS7c7Nic6dMWxgnDpk5tJmVjrgfc0 +a9c1FY4GomUBbZFj+j73+WRk3EaVKIsty+xz48+rlJjdYFVCJo0Jp67jjjXOt6EO +HTniOA/ANtzRIzDMnWrwJZ7AxCGJ4YjLShkcRM9S30X0iuAkxNILX++SNOd8aqc2 +bFofyTCkcbk6CIc1W00vffv1QGTNjstNpVSl9+bRmlJDqJWnDGk5Nl4Ncqd8X51V +0tYEg6WEK4OM83wx5Ew/TdTRq5jJkbCu2GYNaNNNgXW7bXSvT5VINbuP6dmbi1/8 +s0jKJQOEBI3RxxoB+01Dgx9YdNfjsCM3hvQvykaWMALeZIpzbXxV118Y9QQUIRe2 +L+4XZACEAhWjj2K1wP7ODGTQrrM4q4sIw1l3l7yO9aXXN7likAAddT4WEpGV0Cio +rReOJ1y/sKJRJSI/npN1UK7wMazZ+yzhxN0qzG8sqREKJQnNuuGQQ/qIGb/oe4dP +O0FihAUGkWoa0bgtGVijN5fQSbMbV50kZYqaa9GnNQRnchmZb+pK2xLcK85hD1np +37/Am5o2ggoONj3qI3JaRHsZaOs1qPQcyd46OyIFUpHJIfk4nezDCoQYd93bWUGq +DwxI/n/CsdO0365yqDO/ADscehlVqdAupVv2uQINBFiGv8wBEACtrmK7c12DfxkP +AJSD12VanxLLvvjYW0KEWKxN6TMRQCawLhGwFf7FLNpab829DFMhBcNVgJ8aU0YI +Iu9fHroIaGi+bkBkDkSWEhSTlYa6ISfBn6Zk9AGBWB/SIelOncuAcI/Ik6BdDzIX +nDN7cXsMgV1ql7jIbdbsdX63wZEFwqbaiL1GWd4BUKhj0H46ZTEVBLl0MfHNlYl+ +X3ib9WpRS6iBAGOWs8Kqw5xVE7oJm9DDXXWOdPUE8/FVti+bmOz+ICwQETY9I2Em +yNXyUG3iaKs07VAf7SPHhgyBEkMngt5ZGcH4gs1m2l/HFQ0StNFNhXuzlHvQhDzd +9M1nqpstEe+f8AZMgyNnM+uGHJq9VVtaNnwtMDastvNkUOs+auMXbNwsl5y/O6ZP +X5I5IvJmUhbSh0UOguGPJKUu/bl65theahz4HGBA0Q5nzgNLXVmU6aic143iixxM +k+/qA59I6KelgWGj9QBPAHU68//J4dPFtlsRKZ7vI0vD14wnMvaJFv6tyTSgNdWs +QOCWi+n16rGfMx1LNZTO1bO6TE6+ZLuvOchGJTYP4LbCeWLL8qDbdfz3oSKHUpya +lELJljzin6r3qoA3TqvoGK5OWrFozuhWrWt3tIto53oJ34vJCsRZ0qvKDn9PQX9r +3o56hKhn8G9z/X5tNlfrzeSYikWQcQARAQABiQREBBgBAgAPBQJYhr/MAhsCBQkF +o5qAAikJEHch9jvTi0eWwV0gBBkBAgAGBQJYhr/MAAoJEGSUxtaZfCFeW4kP/iZq ++blRDzgRzOw16x80vyBjfPOUKd++dSUkcr4Khi5vjBygNdVSWcKZaBKVkdBmCvf+ +p9bYwzfL+RdxvGEv8WKNTNjdaWcJ2chU2O4H5Am3QsduQ/sSf+jTzlnMe7NpfF9n +3uo34o+xEFOOcnyF3cHrhxWOCde9rX6kbnUQriIMXZteJY8e9Rs+Iv46DoL1eOla +vAgDUJbIf/iLt219OdtWI7ZqopA0d+tcn7FL3fwuvyvn5WZRYHIerB4EYgBI6bCw +l5JQejORlhuYx1oknyPjnzPJ9Los74chrf7OHOJ06iIQf1zlC9V/niA2xiM9NweP +tTQOCTEJVB6IEoEtH6rozpAdriprH9fRnZkJxINNnCoYk1op9wVh3xfUHbOCvGQb +B54cqN+amp9dEquCAe6Yt1WodTspL1zPXJ5Mv43Dud76TNEwQDywuebg4NFQnBTP +XZGpLQYbUVhXSuMlVZXNEUx8xSz7vECm0S4x2h12RBKbK2RfI4oCq/wpD1dQRsZa +KSYLFbZw5j2yk6nBBrtfahd7sWVX1F+YdisbTeT5iUhESAWqW9bCyCnNRFy6V34I +gW9Pe9yLu8WbVSJAFvnALxsc6hGyvs5dbXbruWKmi5mvk6tCFWdFlBVrrhx1QgqM +tcS3jv3S7GHyCA3CS1lEgsifYkeOARAgJ1hZ5BvUurUP+wb66lIhDB0U9NuFdJUT +c6nO/1cy3i9mGCVoqwmTcB1BJ9E1hncMUP1/MvrAgkBBrAWJiD2Xj9QV/uBozA7n +LxrV7cf1de9OLgH4eNEfX25xj8BBPYnyVyHsyk5ZHDhjj9SaurfvlFWYi13i5ieM +pyLVJV4+r2Wi1x1UgKVAlB78sHYnbDzSoHPLBcIxtIKp30LJ0PEkat8SG7G2wgtv +1RdhmcZEBV05vMnrGGO991e+pKzRNPYH8rD3VQKJlvaFwsJuBTW42gZ3KfpUNKI2 +ugCcnRNpoHFWNCrzlJ0CFI48LMlmUSs+7i/l+QGleaLKQxRTNNpAmevLrS7ga4Iq +0IEqxey6VW6RSk/Z1Z37J8B7PISSR0rZn6TeyQgFWf/FOLw6OtwOquGmMeGSqj2U +zxybygtsvUZz0BxYymoWFd4F8sp43oL2TXU6Wp7QIpBaFgkSf/UQxfR6wcQ3ivaf +eS1lg8vUFuMfuMLto6T0JiZw8uKSuDWltSReF+FXVnhawz72BZMy8RIoshGdpWHn +/YbN6L+JOuxZnvkMAZvSLT3c0H4XCDYtEfK2mJMqD2ynX5tGR8Fy3GAaEjhx36Tv +zTjCXRmJ+FnlSW1p77x+UjFUFcpY8skv+f0Gip30iynAb1hoAdibIDab612OWi/4 +vX0DaM6t68Uq8rsabeJYsZG4uQINBF01/K4BEACskZL08crrKfX2aD2w8OUS3jVG +SW7K10Jr/dgl6ZB7Xx/y3c9lhBim7oRIsl6tpR/DBP50UnTIgBbvynbJ6tbWGptt +64AznI7el9pH0k63DOKcfqRUgJKTM4OUZSkcuqQ2qnkvn+g0oiJ3VhaVYOJdJfJF +/pLj5Oi3UEL2afoEd048/lZEaATRvEqLj+h2pSfETEl5wCWyRnuMSu6ay9NmVzRx +iJhPDGW2ppQTxJuaKj+6Vqw5WISu9nsRxTPE1DW8f7LYyPBwgultuSYKZoCdfoYE +8ff471oZIuCKcGSSBHQbR6MBTD6KJtqzBzpfJ8zZJmVO4lg0CJgp9xX2QZ8hPkpa +Bbnq2JCMS1zriCMN8iGhW6ZHYmZQJtWuubuZt51VL9QmEUUhCF1t+3ld11SaowY4 +NFKILUdYbC2zAOQIEEJkWRIHKleuc2zYSNSoXl06oGgwCKQb5l+LlcYHx4+/F3+K +zyAq0NqBC1rMnhbn3tcckdZyhLEpnx9/y33ypo6ZZ0s6dLGrmSpJpedEz6zr8siB +a4uT3IvVF4xjfpzSt3cMD/Lzhbnk5onUfkmoCmQ/pkuKpMr35hHtdDxshLcLPFkT +ncMjEVAOBToHDbKDSplueyJm48ELPi9ZmuyNu7WsB8TWVEAkUShxdeHALVpY1D+M +jXK+Z5ap6/tppj+fmwARAQABiQREBBgBCAAPBQJdNfyuAhsCBQkFo5qAAikJEHch +9jvTi0eWwV0gBBkBCAAGBQJdNfyuAAoJEHi9ZUc8s70TzUAP/1Qq69M1CMd302TM +np1Yh1O06wkCPFGnMFMVwYRXH5ggoYUb3IoCOmIAHOEn6v9fho0rYImS+oRDFeE0 +8dOxeI+Co0xVisVHJ1JJvdnu216BaXEsztZ0KGyUlFidXROrwndlpE3qlz4t1wh/ +EEaUH2TaQjRJ+O1mXJtF6vLB1+YvMTMz3+/3aeX/elDz9aatHSpjBVS2NzbHurb9 +g7mqD45nB80yTBsPYT7439O9m70OqsxjoDqe0bL/XlIXsM9w3ei/Us7rSfSY5zgI +Kf7/iu+aJcMAQC9Zir7XASUVsbBZywfpo2v4/ACWCHJ63lFST2Qrlf4Rjj1PhF0i +fvB2XMR6SewNkDgVlQV+YRPO1XwTOmloFU8qepkt8nm0QM1lhdOQdKVe0QyNn6bt +yUCKI7p4pKc8/yfZm5j6EboXiGAb3XCcSFhR6pFrad12YMcKBhFYvLCaCN6g1q5s +SDxvxqfRETvEFVwqOzlfiUH9KVY3WJcOZ3Cpbeu3QCpPkTiVZgbnR+WU9JSGQFEi +7iZTrT8tct4hIg1Pa35B1lGZIlpYmzvdN5YoV9ohJoa1Bxj7qialTT/Su1Eb/toO +OkOlqQ7B+1NBXzv9FmiBntC4afykHIeEIESNX9LdmvB+kQMW7d1d7Bs0aW2okPDt +02vgwH2VEtQTtfq5B98jbwNW9mbXTvMQAKKCKl+H8T72WdueqgPKHEkXDZtJmTn6 +nyneYlETvdmHGEIb1ejxuJ5URlAYnciY+kvSQ/boKjVHNGmf6+JBexd+HqPhkeex +tV6Jcnmi47HDvIU/TSynhuqZeK/3SZAV7ESqQl42q7wm7Pqw0dkv4jjFCRxDA+Qq +2aH6szJ7DZxTRWqfR3Zbe78NyFVXKxhFQO72zHzC3pFu/Ak59hmTU23yoXVo5t+5 +O+Q21kX2dbuLd6Px1bnT+EmyneoPP1Emea5jgsw2/ECqHnvNt6cbp+42XYldGh+P +BHBmucC3Mn7sALajHe5k2XkNlfbjSNlmutxQFH1qq9rh/JVyxJNHeGzV5G0timAw +fdJFUzE1vNU5P0w4O8HrCsX5Ecfgcw2BQ9vPCE3OfG+11xp6oiNMRVsR5pTu7RiI +1BQAyICWUW/wXuhhHkkwNTiwfciJfVA8ckOiRubik8geEH5boOxgeAaBu6yusQVH +nRRyG4wjQ+qsWo+wDI9WMdtpNG1toJrSUL4OYa4oX3YogSv5hGrbYIaP4HwO6O2o +TMnS0lRIGJOqbEQcmKUa/nWT/3NipTnYzyMjMlEQe89YKjd+32tjMfOSdIOvwCGa +TizdWnKPF77qB9D0v8C/7AdHmEFqf2ZX8vK31aaY+ZpPWG5IHlf6f/buIMBalJOx +IBeveBqxcHwQuQINBGF4DJ8BEACk2Gwau+s/pKmOTnGLMnB3ybQsiVGLRhsw2SqS +TvSyBthAyW1UAqdRqNA8/FdMlvVuppG8+vCLXPmpP63C+9M2tyQeOR2aVQp+u1EI +wN4lPu4wrh6vdtgSRim8uxBdLIHG16z0xxVhE2rM/Ot/gucfkpoEw289VaR7sPmI +xfVTm1QcqCGiFQl3rZnma6Bz8UOXJoE8wO+LK5WkcdmFz6+Z3BLSb5IL9lhsArFT +oNq5dN2SSTbCTdHRzrRuoCdefYHdxoLCM4kJfggRRgWhKoEJro+ZipESq1T5yHV/ +iAJy+3DuC8LbYLvsjt9VZYARw8xIGb90Vj3ThWuMoVr/IVmKT7foC5Whe0PTI/b2 +frNaWCxxC4cRVxMusiBX66mclQ4Mvzwj50G1WKygULYcvPQ81Tg0pvgTKqgxwL9l +uN9MiDVtkn9CZx7NFlszVr+ic7nVJjANnJebFHCEZfJbQo4uIwKfYbhopUkCa41i +XpesbVzAKqNwePgyNTAMFyYnjAUE8FVUmx7ZJVb15iEbMs38gJKJ/Wb8wtJRflAf +khrEzh1M/43WUAU3RfPmXTrGeyDCYKTHiXTnj748uH6U40sB9q+qeEhZdTj0Kufj +gtWaFWsZTkVrtGOaI6xfX6py/k3hjU3es+7ddElxhPBcqNE3pkPRqb9wz+exSdM7 +hiUzNwARAQABiQREBBgBCAAPBQJheAyfAhsCBQkFo5qAAikJEHch9jvTi0eWwV0g +BBkBCAAGBQJheAyfAAoJEE6yfbKjuIuLggkP/1INRyRToLmY1ms9DTWMQ0lwbBL8 +J3xu/neKIOKVGOdw9zcWlGugUoOthSbT8bjvuybH1Vjx4wFM+cnuMVfjD58Xu6Zp +gCHN1wXYMuzYweBFKaMg4oSwTKuAJBJ2IhfEm/cAryVvKY2zY+uyzgizx3vAg3sj +kAPDcrSCJP2nkuHcJ3nzUbKNAjmdMsnWDrqqZVwP99nuyMk8bAtueZ0SKvIpCv2w +IeYO7zkj61vuQOFOGhl98OBui5wUhtgQw//esTWYiGNKSmD3derd2JHVA01tBmCW +V4KMLDbg3CcMMQ1x3V1me6EG3giwBL1I9xTsBUbEa6eEN9U0zdKvoMbSogON5wCu +xAzO/CXGMreJtBUupHEc69oTuwe426Ihi3AbRrPAg3tnGGFCt11HoQFNnRPWb3un +F8UlA2rSytvwFyQi3pzBYt5VsTIA7NEHGuJs+/Oor6AOInzht1cp7AfmDGfGy2N5 +ow+4GI6FPe2UqIg2+nFiGr9hRZOvXRgLQL8dlDnFChymldxm/J/UFdJGSWRldEDs +PrzHQESKvsV9EjnJQR5p5zkQK6jx0zqSlDgiNG2GT3/CSvwIdCih6Cl9HThHtYNm +3ZYN0bU9W2jeoLh3AINNTcrp0tAHZuQLFxukbj56O5eB+nfk67/X2iNii46ZdJQN +wbT9YN6CstQz+Cnqg7YP/3G6Y6NHIQggXnlYIi3iwN72hEgEqz6vIRK87lBGW2r3 +eQ0cDZuE3+5Q4FYciw+B2RKeDhjdmPHypA5o+RiAyI7JOZwJalqHO3nwJG5sr0rR +zcJsbGvpbzso2JuTyTURv4tBNq45b9y0Qdzt5PpNrPJbQADJWn+HWsbVJB5gWBTd +oQYgpyTr84nQyscWAUFTRbmHvtjCCfLdvU8wM7ubAQ5Dwi1pABRttRAMuPA94Hza +BF5yXkghxHpnW0IcXGiwgch9LQyaO9VSRhiPH6r5Zuk7KvGhHph7SC5JgUn9vJmm +p1zcd0mXQ2Zh8M81J3Ri3iGPHM2CqplAxXNbIrnztbEJhN2I+77m73Z4d+K1ivg6 +xQhteSZhwhx7/Z3Tl+U2jYOEFIn/UFmV3UxRSJa/jQRcjvMKprSp4tAZ2yJI3bab +jRbixgUEtlK105/JepxcAdw9vosxO/rR7VqCzu0copdxC0GAH8og+A9/3LPhlRGy +3Qhfzjy9JHWHj4EIsol02BS8+dWvAoYerkve9O9+h6/B5wM/Yng9BjT+OrNvkfmq +K2cspBXwYedOrC4uWcUmueEVrv5P4FF36wJ+ejvPS6vdTxVTdLXjouUHwTQQZVlN +jWY3cIyj03nZ19c+b30+2FzG/uSnb/ePWsRLY7Iyz4ygr8etweBPnEIvjwpAZxOu +uQINBGPs+VgBEADKbgLL+vAabKV2rGSDgY+IttTAtg9w9Uor1+Q/CIWGxi/JQy7l +7XTKjmS0wvdwU+9f/eGsjxigbvAcSsV1szyKfVQQFT2m9KhDrBqNCAvQ5Tg6ZQdN +e51oHwjiIQ1i7z8QoT22VucdTYqcMLAHe+g0aNqLLSSWLAiW4z+nerclinjiTRCw +/aWZJR1ozQd2eKwAw6rk19bHcihXo2E0K1EDmdHcNA8ytypxwWWXBftCYRWXi5J0 +2GeZazxmx/DULnFgy2J4G0ULTqGWsbf/tCt22jqgyX+vFj/sJPn+l3IJqpyNY5yB +G6GcejeP9vRoQrapGqHkcx+37f2vjwmpj5548JI52KEC1yZeFwp8HjGLp+zGajpn +okrKd4XJHniW9+bPLq7Yp7PNn65MaYvZUjv5enKd45fFK6vJ3Ys/fx6PBXKKBs9f +lRIgdXOKSvtV+bGIG0I/p/JEZ/wPxRgxHPDK5jbcI6KBVm3Uk+CHFC4IBAtzdSh6 +H4Zfw1EH3dQZMLVBB/Sj34UQhlwAOlAXtZH3vks/KpclWK8gnqz3i8HN0ezvcnQl +RiRO8IqlN9/PmFqZeNTerklT7Tt0jXqiopLHL0FXR2LsndeORfxDE1rhVOUxloeu +IsY8x6gO8h2bGg41YapROjYxZZEcakg9Nch4XAlxeqB4ISttfbiVxeL2DQARAQAB +iQREBBgBCAAPBQJj7PlYAhsCBQkFo5qAAikJEHch9jvTi0eWwV0gBBkBCAAGBQJj +7PlYAAoJEOiJefubMKzyRuUP/jzITdamLoLDxEHOra7Mt2S6peHr3XMbpWEdRlA1 +vzl7AaMYO78Pbm7YkWuEByaXM6vGCC8vhrxZq09dBo+oNlpKHjV6UzVhrQLtw1Cr +vE1UDSlw3ltD4pddky5BoDz0EKVNJchPPqPg7im+EAbzLxDYT0y/tRhqzQ6EODNU +ivLazWjY+aXWqOVv2Ny071ytFSIXq/1G71pCSAYdi3i7I/cfMoN+g27Nf9Zfc7QW +bw02mcmTqpmwsrCDu6RR0k4gQhsss0tT1libKzfA20Mox+bhPv1ptI3A0ifh13mF +qkf0EC4MmeThacU5qn0BBk+AlfZZcoLYNdBl5JfVVekjeuvsVJtJ5zx3luK3Duzb +RdbJAHb5mh61HE2BHXTgYiH8tqO1q0soVz02c/1KaF7LyevFVkXHoe5eycY4+RuO +yIVgyzG09Vic7vacENMM/hl6Ms5prLYq0JvykmQIfxTSC6q4MZV35LTZfH3jt6/K +8eoa3lXTJUU8Pu4C7sDlAFhe+1y3Or3dLWNkMigw/3c57xWlStcEF+LPMdXE/pVS +bEz3sgT6CNVGo30+4yunYP3IQFQaTjh9BbnPK66iZhpzsynHZ+daAYD8CX26Da69 +LigjNTIsQnGlzozxFiW5pxIiMWAKKC5xGy9MHLqWhsbUUy+dDLN7r58B4ptusrzk +64DUpbcQAJ+wzIvCe2qf5C7yveT/ohGfSL1dX9uFK0TbLqIdSaqzmx3t1+SZUjtu +ymg64MoUgSt1N6mEfT0TSG9AMkRGcyb6uHxOVm05L/BjLDH7ZqFKHkm3d0jkvjyj +NH5YlsTGJerxmpOemf8RAZDwygz5LZ1L5zNfzlkv6beKD60ofBppd28ZxgjeHxbB +CdfcgFQUK6vxZJ19ygbKJDhylNdwjXUaAaCTKnEzzDHGgtUJO22kIFEKk9/z88so +wIrT+Te7hBKG2nVYMNBWEWb8Tqh8b1NIYgpwmawcdBjuu6QSnqVIi+YvRmMHJFqH +icrnOhzaPz2w2nK56ZnCv1f5X0s6MXu9BM7/zLdwEE0K3RHmWvF4G9HN7XmTQPNK +G4fI+GDY8Gp885LtGdSIXYV4j7NDvEWcuqgPpyQjvpFEB/vDSyqe8yUNGmNVT5wP +K6lHk10Hv2g9cmkeW0qDiRpDg7nHoFcdUSkAyElzxs++Z8CJMVpzl/TJyJt/ZHm0 +2XNsowP8HFWvNcyCGwnk9aYCJRuo+/UgjmQvDnVvoHO+XwrMkjSH7JKJQZvzrJ5x +8cZsXvM9FyHYq3n7u3R+ASMBVwxF9yAex9CfwRg/3OhzOnkbDsu9HwEEOrV2xMQQ +Q9MOt74fIbGkM3hzws0asNoIV1ec52U1X/NP1W8GT9GRX5OX8uTi +=RoSw +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/browser/files/repo/chrome.list b/salt/browser/files/repo/chrome.list new file mode 100644 index 0000000..416e029 --- /dev/null +++ b/salt/browser/files/repo/chrome.list @@ -0,0 +1,2 @@ +deb [signed-by=/usr/share/keyrings/chrome.asc] http://dl.google.com/linux/chrome/deb/ stable main +# vim:ft=debsources diff --git a/salt/browser/files/repo/chrome.sources b/salt/browser/files/repo/chrome.sources new file mode 100644 index 0000000..48e50ea --- /dev/null +++ b/salt/browser/files/repo/chrome.sources @@ -0,0 +1,6 @@ +Types: deb +URIs: http://dl.google.com/linux/chrome/deb/ +Suites: stable +Components: main +Signed-by: /usr/share/keyrings/chrome.asc +# vim:ft=debsources diff --git a/salt/browser/init.top b/salt/browser/init.top new file mode 100644 index 0000000..6c8951e --- /dev/null +++ b/salt/browser/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - browser.create + 'tpl-browser': + - browser.install diff --git a/salt/browser/install-chrome.sls b/salt/browser/install-chrome.sls new file mode 100644 index 0000000..1939c59 --- /dev/null +++ b/salt/browser/install-chrome.sls @@ -0,0 +1,31 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-common + +{% from 'utils/macros/install-repo.sls' import install_repo -%} +{{ install_repo(sls_path, 'chrome') }} + +"{{ slsdotpath }}-avoid-chrome-installing-own-repo": + file.touch: + - name: /etc/default/google-chrome + +"{{ slsdotpath }}-updated-chrome": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-chrome": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - google-chrome-stable + +{% endif -%} diff --git a/salt/browser/install-chrome.top b/salt/browser/install-chrome.top new file mode 100644 index 0000000..5da3ee8 --- /dev/null +++ b/salt/browser/install-chrome.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-browser': + - browser.install-chrome diff --git a/salt/browser/install-chromium.sls b/salt/browser/install-chromium.sls new file mode 100644 index 0000000..ede42d4 --- /dev/null +++ b/salt/browser/install-chromium.sls @@ -0,0 +1,24 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-common + +"{{ slsdotpath }}-updated-chromium": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-chromium": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - chromium + +{% endif -%} diff --git a/salt/browser/install-chromium.top b/salt/browser/install-chromium.top new file mode 100644 index 0000000..985473c --- /dev/null +++ b/salt/browser/install-chromium.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-browser': + - browser.install-chromium diff --git a/salt/browser/install-common.sls b/salt/browser/install-common.sls new file mode 100644 index 0000000..b3e39e8 --- /dev/null +++ b/salt/browser/install-common.sls @@ -0,0 +1,31 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - sys-usb.install-client-fido + +"{{ slsdotpath }}-updated-common": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-common": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - ca-certificates + - curl + - qubes-core-agent-thunar + - thunar + - zenity + - libgdk-pixbuf2.0-bin + - pulseaudio-qubes + +{% endif -%} diff --git a/salt/browser/install-common.top b/salt/browser/install-common.top new file mode 100644 index 0000000..529fb40 --- /dev/null +++ b/salt/browser/install-common.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-browser': + - browser.install-common diff --git a/salt/browser/install-firefox.sls b/salt/browser/install-firefox.sls new file mode 100644 index 0000000..ec93cbc --- /dev/null +++ b/salt/browser/install-firefox.sls @@ -0,0 +1,24 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-common + +"{{ slsdotpath }}-updated-firefox": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-firefox": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - firefox-esr + +{% endif -%} diff --git a/salt/browser/install-firefox.top b/salt/browser/install-firefox.top new file mode 100644 index 0000000..4aa5167 --- /dev/null +++ b/salt/browser/install-firefox.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-browser': + - browser.install-firefox diff --git a/salt/browser/install-lynx.sls b/salt/browser/install-lynx.sls new file mode 100644 index 0000000..6f2a5f7 --- /dev/null +++ b/salt/browser/install-lynx.sls @@ -0,0 +1,24 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-common + +"{{ slsdotpath }}-updated-lynx": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-lynx": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - lynx + +{% endif -%} diff --git a/salt/browser/install-lynx.top b/salt/browser/install-lynx.top new file mode 100644 index 0000000..a4cf8df --- /dev/null +++ b/salt/browser/install-lynx.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-browser': + - browser.install-lynx diff --git a/salt/browser/install-w3m.sls b/salt/browser/install-w3m.sls new file mode 100644 index 0000000..3bd12b7 --- /dev/null +++ b/salt/browser/install-w3m.sls @@ -0,0 +1,25 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-common + - dotfiles.copy-net + +"{{ slsdotpath }}-updated-w3m": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-w3m": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - w3m + +{% endif -%} diff --git a/salt/browser/install-w3m.top b/salt/browser/install-w3m.top new file mode 100644 index 0000000..61b4f7d --- /dev/null +++ b/salt/browser/install-w3m.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-browser': + - browser.install-w3m diff --git a/salt/browser/install.sls b/salt/browser/install.sls new file mode 100644 index 0000000..1b73445 --- /dev/null +++ b/salt/browser/install.sls @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-chromium + +{% endif -%} diff --git a/salt/browser/install.top b/salt/browser/install.top new file mode 100644 index 0000000..8a8234d --- /dev/null +++ b/salt/browser/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-browser': + - browser.install diff --git a/salt/debian-minimal/README.md b/salt/debian-minimal/README.md new file mode 100644 index 0000000..dbdf314 --- /dev/null +++ b/salt/debian-minimal/README.md @@ -0,0 +1,35 @@ +# debian-minimal + +Debian Minimal Template in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Creates the Debian Minimal template as well as a Disposable Template based on +it. + +## Installation + +- Top: +```sh +qubesctl top.enable debian-minimal +qubesctl --targets=debian-12-minimal state.apply +qubesctl top.disable debian-minimal +``` + +- State: + +```sh +qubesctl state.apply debian-minimal.create +qubesctl --skip-dom0 --targets=debian-12-minimal state.apply debian-minimal.install +``` + + +## Usage + +AppVMs and StandaloneVMs can be based on this minimal template. diff --git a/salt/debian-minimal/clone.sls b/salt/debian-minimal/clone.sls new file mode 100644 index 0000000..5ffbb27 --- /dev/null +++ b/salt/debian-minimal/clone.sls @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- import slsdotpath ~ "/template.jinja" as template -%} + +"{{ template.template }}-template-installed": + qvm.template_installed: + - name: {{ template.template }} + - fromrepo: {{ template.repo }} diff --git a/salt/debian-minimal/clone.top b/salt/debian-minimal/clone.top new file mode 100644 index 0000000..d4cee70 --- /dev/null +++ b/salt/debian-minimal/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - debian-minimal.clone diff --git a/salt/debian-minimal/create.sls b/salt/debian-minimal/create.sls new file mode 100644 index 0000000..c7524ee --- /dev/null +++ b/salt/debian-minimal/create.sls @@ -0,0 +1,67 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +{%- import slsdotpath ~ "/template.jinja" as template -%} + +include: + - .clone + +"dvm-{{ template.template }}-absent": + qvm.absent: + - names: + - dvm-{{ template.template_clean }} + - {{ template.template_clean }}-dvm + - {{ template.template }}-dvm + +{% load_yaml as defaults -%} +name: dvm-{{ template.template_clean }} +force: True +require: +- sls: {{ template.template_clean }}.clone +present: +- template: {{ template.template }} +- label: red +prefs: +- template: {{ template.template }} +- label: red +- memory: 300 +- maxmem: 400 +- vcpus: 1 +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- set: + - menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ template.template_clean }} +force: True +require: +- sls: {{ template.template_clean }}.clone +present: +- label: black +prefs: +- label: black +- memory: 300 +- maxmem: 600 +- vcpus: 1 +- include_in_backups: False +features: +- set: + - menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" + - default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-set-default_template": + cmd.run: + - name: qubes-prefs default_template {{ template.template }} diff --git a/salt/debian-minimal/create.top b/salt/debian-minimal/create.top new file mode 100644 index 0000000..647a3b9 --- /dev/null +++ b/salt/debian-minimal/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - debian-minimal.create diff --git a/salt/debian-minimal/init.top b/salt/debian-minimal/init.top new file mode 100644 index 0000000..d3848d9 --- /dev/null +++ b/salt/debian-minimal/init.top @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - debian-minimal.create + 'I@qubes:type:template and E@^debian-[0-9][0-9]-minimal$': + - match: compound + - debian-minimal.install diff --git a/salt/debian-minimal/install.sls b/salt/debian-minimal/install.sls new file mode 100644 index 0000000..d9a2f13 --- /dev/null +++ b/salt/debian-minimal/install.sls @@ -0,0 +1,28 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' and grains['os_family']|lower == 'debian' -%} + +include: + - dotfiles.copy-x11 + - dev.home-cleanup + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-configure-locale": + file.replace: + - name: /etc/locale.gen + - pattern: '# en_US.UTF-8 UTF-8' + - repl: 'en_US.UTF-8 UTF-8' + +"{{ slsdotpath }}-generate-locale": + cmd.run: + - name: /usr/sbin/locale-gen + - runas: root + +{% endif -%} diff --git a/salt/debian-minimal/install.top b/salt/debian-minimal/install.top new file mode 100644 index 0000000..56e2091 --- /dev/null +++ b/salt/debian-minimal/install.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'I@qubes:type:template and E@^debian-[0-9][0-9]-minimal$': + - match: compound + - debian-minimal.install diff --git a/salt/debian-minimal/template.jinja b/salt/debian-minimal/template.jinja new file mode 100644 index 0000000..e2f6503 --- /dev/null +++ b/salt/debian-minimal/template.jinja @@ -0,0 +1,11 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- import "debian/template.jinja" as template_base -%} +{% set version = template_base.version -%} +{% set repo = template_base.repo -%} +{% set template = template_base.template ~ '-minimal' -%} +{% set template_clean = template_base.template_clean ~ '-minimal' -%} diff --git a/salt/debian/README.md b/salt/debian/README.md new file mode 100644 index 0000000..272905b --- /dev/null +++ b/salt/debian/README.md @@ -0,0 +1,34 @@ +# debian + +Debian Template in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Creates the Debian template as well as a Disposable Template based on it. + +## Installation + +- Top: +```sh +qubesctl top.enable debian +qubesctl --targets=debian-12 state.apply +qubesctl top.disable debian +``` + +- State: + +```sh +qubesctl state.apply debian.create +qubesctl --skip-dom0 --targets=debian-12 state.apply debian.install +``` + + +## Usage + +AppVMs and StandaloneVMs can be based on this template. diff --git a/salt/debian/clone.sls b/salt/debian/clone.sls new file mode 100644 index 0000000..5ffbb27 --- /dev/null +++ b/salt/debian/clone.sls @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- import slsdotpath ~ "/template.jinja" as template -%} + +"{{ template.template }}-template-installed": + qvm.template_installed: + - name: {{ template.template }} + - fromrepo: {{ template.repo }} diff --git a/salt/debian/clone.top b/salt/debian/clone.top new file mode 100644 index 0000000..8c1fe59 --- /dev/null +++ b/salt/debian/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - debian.clone diff --git a/salt/debian/create.sls b/salt/debian/create.sls new file mode 100644 index 0000000..f03fee2 --- /dev/null +++ b/salt/debian/create.sls @@ -0,0 +1,63 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +{%- import slsdotpath ~ "/template.jinja" as template -%} + +include: + - .clone + +"dvm-{{ template.template }}-absent": + qvm.absent: + - names: + - dvm-{{ template.template_clean }} + - {{ template.template_clean }}-dvm + - {{ template.template }}-dvm + +{% load_yaml as defaults -%} +name: dvm-{{ template.template_clean }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: {{ template.template }} +- label: red +prefs: +- template: {{ template.template }} +- label: red +- memory: 300 +- maxmem: 800 +- vcpus: 1 +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- set: + - menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ template.template_clean }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- label: black +prefs: +- label: black +- memory: 300 +- maxmem: 600 +- vcpus: 1 +- include_in_backups: False +features: +- set: + - menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" + - default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} diff --git a/salt/debian/create.top b/salt/debian/create.top new file mode 100644 index 0000000..4e83fec --- /dev/null +++ b/salt/debian/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - debian.create diff --git a/salt/debian/init.top b/salt/debian/init.top new file mode 100644 index 0000000..3269e39 --- /dev/null +++ b/salt/debian/init.top @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - debian.create + 'I@qubes:type:template and E@^debian-[0-9][0-9]$': + - match: compound + - debian.install diff --git a/salt/debian/install.sls b/salt/debian/install.sls new file mode 100644 index 0000000..41e3943 --- /dev/null +++ b/salt/debian/install.sls @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +{% endif %} diff --git a/salt/debian/install.top b/salt/debian/install.top new file mode 100644 index 0000000..99ad0a4 --- /dev/null +++ b/salt/debian/install.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'I@qubes:type:template and E@^debian-[0-9][0-9]$': + - match: compound + - debian.install diff --git a/salt/debian/template.jinja b/salt/debian/template.jinja new file mode 100644 index 0000000..cf8da9a --- /dev/null +++ b/salt/debian/template.jinja @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% set version = salt['pillar.get']('qvm:debian:version', '12') -%} +{% set repo = salt['pillar.get']('qvm:debian:repo', 'qubes-templates-itl') -%} +{% set template = 'debian-' ~ version -%} +{% set template_clean = 'debian' -%} diff --git a/salt/dev/README.md b/salt/dev/README.md new file mode 100644 index 0000000..2d161f9 --- /dev/null +++ b/salt/dev/README.md @@ -0,0 +1,44 @@ +# dev + +Development environment in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Setup a development qube named "dev". Defines the user interactive shell, +installing goodies, applying dotfiles, being client of sys-pgp, sys-git and +sys-ssh-agent. + +## Installation + +- Top +```sh +qubesctl top.enable dev +qubesctl --targets=tpl-dev,dvm-dev,dev state.apply +qubesctl top.disable dev +``` + +- State + +```sh +qubesctl state.apply dev.create +qubesctl --skip-dom0 --targets=tpl-dev state.apply dev.install +qubesctl --skip-dom0 --targets=dvm-dev state.apply dev.configure-dvm +qubesctl --skip-dom0 --targets=dev state.apply dev.configure +``` + + +## Usage + +The development qube `dev` can be used for: + +- code development; +- building programs; +- signing commits, tags, pushes and verifying with split-gpg; +- fetching and pushing to and from local qube repository with split-git; and +- fetching and pushing to and from remote repository with split-ssh-agent. diff --git a/salt/dev/clone.sls b/salt/dev/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/dev/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/dev/clone.top b/salt/dev/clone.top new file mode 100644 index 0000000..5e79b1a --- /dev/null +++ b/salt/dev/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dev.clone diff --git a/salt/dev/configure-dvm.sls b/salt/dev/configure-dvm.sls new file mode 100644 index 0000000..0cec18c --- /dev/null +++ b/salt/dev/configure-dvm.sls @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - utils.tools.zsh.touch-zshrc + +{% endif -%} diff --git a/salt/dev/configure-dvm.top b/salt/dev/configure-dvm.top new file mode 100644 index 0000000..346fbed --- /dev/null +++ b/salt/dev/configure-dvm.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - match: nodegroup + - dev.configure-dvm diff --git a/salt/dev/configure.sls b/salt/dev/configure.sls new file mode 100644 index 0000000..b5c74af --- /dev/null +++ b/salt/dev/configure.sls @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .home-cleanup + - dotfiles.copy-all + +{% endif -%} diff --git a/salt/dev/configure.top b/salt/dev/configure.top new file mode 100644 index 0000000..0ea3036 --- /dev/null +++ b/salt/dev/configure.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - match: nodegroup + - dev.configure diff --git a/salt/dev/create.sls b/salt/dev/create.sls new file mode 100644 index 0000000..3fdecc7 --- /dev/null +++ b/salt/dev/create.sls @@ -0,0 +1,87 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: purple +prefs: +- template: tpl-{{ slsdotpath }} +- label: purple +- vcpus: 1 +- memory: 400 +- maxmem: 600 +- autostart: False +- include_in_backups: True +features: +- enable: + - service.split-gpg2-client + - service.crond +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% 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 +- vcpus: 1 +- memory: 400 +- maxmem: 600 +- autostart: False +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: disp-{{ slsdotpath }} +force: True +require: +- qvm: dvm-{{ slsdotpath }} +present: +- template: dvm-{{ slsdotpath }} +- label: red +- class: DispVM +prefs: +- template: dvm-{{ slsdotpath }} +- label: red +- vcpus: 1 +- memory: 400 +- maxmem: 600 +- autostart: False +- include_in_backups: False +features: +- disable: + - appmenus-dispvm + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} diff --git a/salt/dev/create.top b/salt/dev/create.top new file mode 100644 index 0000000..632492f --- /dev/null +++ b/salt/dev/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dev.create diff --git a/salt/dev/home-cleanup.sls b/salt/dev/home-cleanup.sls new file mode 100644 index 0000000..50f44c3 --- /dev/null +++ b/salt/dev/home-cleanup.sls @@ -0,0 +1,17 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} +{% for unused_dir in ['Desktop','Documents','Downloads','Music','Pictures','Public','Templates','Videos'] -%} + + {% set full_unused_dir = '/home/user/' ~ unused_dir -%} + "remove-{{ full_unused_dir }}": + file.absent: + - name: {{ full_unused_dir }} + - onlyif: test -z "$(ls -A {{ full_unused_dir }})" + +{% endfor -%} +{% endif -%} diff --git a/salt/dev/home-cleanup.top b/salt/dev/home-cleanup.top new file mode 100644 index 0000000..7b02534 --- /dev/null +++ b/salt/dev/home-cleanup.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dev': + - dev.home-cleanup diff --git a/salt/dev/init.sls b/salt/dev/init.sls new file mode 100644 index 0000000..71e1082 --- /dev/null +++ b/salt/dev/init.sls @@ -0,0 +1,22 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +## TODO: Should we allow minions to decide which states they should run? +## This is a hack substitute for top files without the need to specify each +## state file, but it looks bad. +## Example: qubesctl --targets=dom0,tpl-dev,disp-dev,dev state.apply dev +{# +include: +{% if grains['id'] == 'dom0' -%} + - .create +{% elif grains['id'] == 'tpl-' ~ slsdotpath -%} + - .install +{% elif grains['id'] == 'disp-' ~ slsdotpath -%} + - utils.tools.zsh.touch-zshrc +{% elif grains['id'] == slsdotpath -%} + - .configure +{% endif -%} +#} diff --git a/salt/dev/init.top b/salt/dev/init.top new file mode 100644 index 0000000..79c4e7e --- /dev/null +++ b/salt/dev/init.top @@ -0,0 +1,16 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dev.create + 'tpl-dev': + - dev.install + 'dvm-dev': + - dev.configure-dvm + 'dev': + - dev.configure diff --git a/salt/dev/install-python-tools.sls b/salt/dev/install-python-tools.sls new file mode 100644 index 0000000..c4439d1 --- /dev/null +++ b/salt/dev/install-python-tools.sls @@ -0,0 +1,25 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated-python-tools": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-python-tools": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - python3-dev + - python3-venv + - python3-setuptools + - python3-pytest + - python3-pip + +{% endif %} diff --git a/salt/dev/install-python-tools.top b/salt/dev/install-python-tools.top new file mode 100644 index 0000000..0612218 --- /dev/null +++ b/salt/dev/install-python-tools.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-dev': + - dev.install-python-tools diff --git a/salt/dev/install-salt-tools.sls b/salt/dev/install-salt-tools.sls new file mode 100644 index 0000000..37ab7bb --- /dev/null +++ b/salt/dev/install-salt-tools.sls @@ -0,0 +1,47 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated-salt-tools": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-salt-tools": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - python3-pip + - ansible-lint + +{% set pkg = { + 'Debian': { + 'pkg': [], + }, + 'RedHat': { + 'pkg': ['salt-lint'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-installed-salt-tools-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +# Fails because of cacher +{# +{% if grains['os_family']|lower != 'redhat' -%} +pip-installed-salt-tools: + cmd.run: + - name: python3 -m pip install --break-system-packages salt-lint +{% endif -%} +#} + +{% endif %} diff --git a/salt/dev/install-salt-tools.top b/salt/dev/install-salt-tools.top new file mode 100644 index 0000000..5251f0e --- /dev/null +++ b/salt/dev/install-salt-tools.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-dev': + - dev.install-salt-tools diff --git a/salt/dev/install.sls b/salt/dev/install.sls new file mode 100644 index 0000000..05e8f19 --- /dev/null +++ b/salt/dev/install.sls @@ -0,0 +1,72 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + {%- if salt['qvm.exists']('sys-cacher') %} + - sys-cacher.install-client + {% endif %} + - .home-cleanup + - .install-python-tools + - .install-salt-tools + - dotfiles.copy-all + - utils.tools.zsh + - sys-pgp.install-client + - sys-git.install-client + - sys-ssh-agent.install-client + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + ## Necessary + - qubes-core-agent-passwordless-root + - qubes-core-agent-networking + - ca-certificates + - git + - gnupg2 + ## Usability + - tmux + - xclip + - bash-completion + - man-db + - texinfo + - file + - tree + - ripgrep + - fzf + ## Lint + - pre-commit + - precious + - reuse + - gitlint + - pylint + - yamllint + +{% set pkg = { + 'Debian': { + 'pkg': ['shellcheck', 'vim-nox', 'fd-find'], + }, + 'RedHat': { + 'pkg': ['passwd', 'fd-find', 'ShellCheck', 'vim-enhanced'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-installed-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +{% endif -%} diff --git a/salt/dev/install.top b/salt/dev/install.top new file mode 100644 index 0000000..8d34698 --- /dev/null +++ b/salt/dev/install.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-dev': + - match: list + - dev.install diff --git a/salt/docker/README.md b/salt/docker/README.md new file mode 100644 index 0000000..cc7ebad --- /dev/null +++ b/salt/docker/README.md @@ -0,0 +1,38 @@ +# docker + +Docker installation in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Setup docker in Qubes OS with the Docker repository. + +## Installation + +- Top +```sh +qubesctl top.enable docker +qubesctl --targets=tpl-qubes-builder,qubes-builder state.apply +qubesctl top.disable docker +``` + +- State + +```sh +qubesctl --skip-dom0 --targets=tpl-qubes-builder state.apply docker.install +qubesctl --skip-dom0 --targets=qubes-builder state.apply docker.configure +``` + + +## Usage + +The only qubes specific configuration to docker is changing its [root +directory](https://docs.docker.com/config/daemon/#daemon-data-directory) to +the private volume or using [qubes +bind-dirs](https://www.qubes-os.org/doc/bind-dirs/) for persistence of the +docker root directory in the root volume. diff --git a/salt/docker/configure.sls b/salt/docker/configure.sls new file mode 100644 index 0000000..66fc3c9 --- /dev/null +++ b/salt/docker/configure.sls @@ -0,0 +1,17 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-rc.local": + file.append: + - name: /rw/config/rc.local + - text: | + usermod -aG docker user + systemctl unmask docker + systemctl --no-block restart docker + +{% endif -%} diff --git a/salt/docker/configure.top b/salt/docker/configure.top new file mode 100644 index 0000000..a3737de --- /dev/null +++ b/salt/docker/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'qubes-builder': + - docker.configure diff --git a/salt/docker/files/repo/docker.asc b/salt/docker/files/repo/docker.asc new file mode 100644 index 0000000..ee7872e --- /dev/null +++ b/salt/docker/files/repo/docker.asc @@ -0,0 +1,62 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFit2ioBEADhWpZ8/wvZ6hUTiXOwQHXMAlaFHcPH9hAtr4F1y2+OYdbtMuth +lqqwp028AqyY+PRfVMtSYMbjuQuu5byyKR01BbqYhuS3jtqQmljZ/bJvXqnmiVXh +38UuLa+z077PxyxQhu5BbqntTPQMfiyqEiU+BKbq2WmANUKQf+1AmZY/IruOXbnq +L4C1+gJ8vfmXQt99npCaxEjaNRVYfOS8QcixNzHUYnb6emjlANyEVlZzeqo7XKl7 +UrwV5inawTSzWNvtjEjj4nJL8NsLwscpLPQUhTQ+7BbQXAwAmeHCUTQIvvWXqw0N +cmhh4HgeQscQHYgOJjjDVfoY5MucvglbIgCqfzAHW9jxmRL4qbMZj+b1XoePEtht +ku4bIQN1X5P07fNWzlgaRL5Z4POXDDZTlIQ/El58j9kp4bnWRCJW0lya+f8ocodo +vZZ+Doi+fy4D5ZGrL4XEcIQP/Lv5uFyf+kQtl/94VFYVJOleAv8W92KdgDkhTcTD +G7c0tIkVEKNUq48b3aQ64NOZQW7fVjfoKwEZdOqPE72Pa45jrZzvUFxSpdiNk2tZ +XYukHjlxxEgBdC/J3cMMNRE1F4NCA3ApfV1Y7/hTeOnmDuDYwr9/obA8t016Yljj +q5rdkywPf4JF8mXUW5eCN1vAFHxeg9ZWemhBtQmGxXnw9M+z6hWwc6ahmwARAQAB +tCtEb2NrZXIgUmVsZWFzZSAoQ0UgZGViKSA8ZG9ja2VyQGRvY2tlci5jb20+iQI3 +BBMBCgAhBQJYrefAAhsvBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEI2BgDwO +v82IsskP/iQZo68flDQmNvn8X5XTd6RRaUH33kXYXquT6NkHJciS7E2gTJmqvMqd +tI4mNYHCSEYxI5qrcYV5YqX9P6+Ko+vozo4nseUQLPH/ATQ4qL0Zok+1jkag3Lgk +jonyUf9bwtWxFp05HC3GMHPhhcUSexCxQLQvnFWXD2sWLKivHp2fT8QbRGeZ+d3m +6fqcd5Fu7pxsqm0EUDK5NL+nPIgYhN+auTrhgzhK1CShfGccM/wfRlei9Utz6p9P +XRKIlWnXtT4qNGZNTN0tR+NLG/6Bqd8OYBaFAUcue/w1VW6JQ2VGYZHnZu9S8LMc +FYBa5Ig9PxwGQOgq6RDKDbV+PqTQT5EFMeR1mrjckk4DQJjbxeMZbiNMG5kGECA8 +g383P3elhn03WGbEEa4MNc3Z4+7c236QI3xWJfNPdUbXRaAwhy/6rTSFbzwKB0Jm +ebwzQfwjQY6f55MiI/RqDCyuPj3r3jyVRkK86pQKBAJwFHyqj9KaKXMZjfVnowLh +9svIGfNbGHpucATqREvUHuQbNnqkCx8VVhtYkhDb9fEP2xBu5VvHbR+3nfVhMut5 +G34Ct5RS7Jt6LIfFdtcn8CaSas/l1HbiGeRgc70X/9aYx/V/CEJv0lIe8gP6uDoW +FPIZ7d6vH+Vro6xuWEGiuMaiznap2KhZmpkgfupyFmplh0s6knymuQINBFit2ioB +EADneL9S9m4vhU3blaRjVUUyJ7b/qTjcSylvCH5XUE6R2k+ckEZjfAMZPLpO+/tF +M2JIJMD4SifKuS3xck9KtZGCufGmcwiLQRzeHF7vJUKrLD5RTkNi23ydvWZgPjtx +Q+DTT1Zcn7BrQFY6FgnRoUVIxwtdw1bMY/89rsFgS5wwuMESd3Q2RYgb7EOFOpnu +w6da7WakWf4IhnF5nsNYGDVaIHzpiqCl+uTbf1epCjrOlIzkZ3Z3Yk5CM/TiFzPk +z2lLz89cpD8U+NtCsfagWWfjd2U3jDapgH+7nQnCEWpROtzaKHG6lA3pXdix5zG8 +eRc6/0IbUSWvfjKxLLPfNeCS2pCL3IeEI5nothEEYdQH6szpLog79xB9dVnJyKJb +VfxXnseoYqVrRz2VVbUI5Blwm6B40E3eGVfUQWiux54DspyVMMk41Mx7QJ3iynIa +1N4ZAqVMAEruyXTRTxc9XW0tYhDMA/1GYvz0EmFpm8LzTHA6sFVtPm/ZlNCX6P1X +zJwrv7DSQKD6GGlBQUX+OeEJ8tTkkf8QTJSPUdh8P8YxDFS5EOGAvhhpMBYD42kQ +pqXjEC+XcycTvGI7impgv9PDY1RCC1zkBjKPa120rNhv/hkVk/YhuGoajoHyy4h7 +ZQopdcMtpN2dgmhEegny9JCSwxfQmQ0zK0g7m6SHiKMwjwARAQABiQQ+BBgBCAAJ +BQJYrdoqAhsCAikJEI2BgDwOv82IwV0gBBkBCAAGBQJYrdoqAAoJEH6gqcPyc/zY +1WAP/2wJ+R0gE6qsce3rjaIz58PJmc8goKrir5hnElWhPgbq7cYIsW5qiFyLhkdp +YcMmhD9mRiPpQn6Ya2w3e3B8zfIVKipbMBnke/ytZ9M7qHmDCcjoiSmwEXN3wKYI +mD9VHONsl/CG1rU9Isw1jtB5g1YxuBA7M/m36XN6x2u+NtNMDB9P56yc4gfsZVES +KA9v+yY2/l45L8d/WUkUi0YXomn6hyBGI7JrBLq0CX37GEYP6O9rrKipfz73XfO7 +JIGzOKZlljb/D9RX/g7nRbCn+3EtH7xnk+TK/50euEKw8SMUg147sJTcpQmv6UzZ +cM4JgL0HbHVCojV4C/plELwMddALOFeYQzTif6sMRPf+3DSj8frbInjChC3yOLy0 +6br92KFom17EIj2CAcoeq7UPhi2oouYBwPxh5ytdehJkoo+sN7RIWua6P2WSmon5 +U888cSylXC0+ADFdgLX9K2zrDVYUG1vo8CX0vzxFBaHwN6Px26fhIT1/hYUHQR1z +VfNDcyQmXqkOnZvvoMfz/Q0s9BhFJ/zU6AgQbIZE/hm1spsfgvtsD1frZfygXJ9f +irP+MSAI80xHSf91qSRZOj4Pl3ZJNbq4yYxv0b1pkMqeGdjdCYhLU+LZ4wbQmpCk +SVe2prlLureigXtmZfkqevRz7FrIZiu9ky8wnCAPwC7/zmS18rgP/17bOtL4/iIz +QhxAAoAMWVrGyJivSkjhSGx1uCojsWfsTAm11P7jsruIL61ZzMUVE2aM3Pmj5G+W +9AcZ58Em+1WsVnAXdUR//bMmhyr8wL/G1YO1V3JEJTRdxsSxdYa4deGBBY/Adpsw +24jxhOJR+lsJpqIUeb999+R8euDhRHG9eFO7DRu6weatUJ6suupoDTRWtr/4yGqe +dKxV3qQhNLSnaAzqW/1nA3iUB4k7kCaKZxhdhDbClf9P37qaRW467BLCVO/coL3y +Vm50dwdrNtKpMBh3ZpbB1uJvgi9mXtyBOMJ3v8RZeDzFiG8HdCtg9RvIt/AIFoHR +H3S+U79NT6i0KPzLImDfs8T7RlpyuMc4Ufs8ggyg9v3Ae6cN3eQyxcK3w0cbBwsh +/nQNfsA6uu+9H7NhbehBMhYnpNZyrHzCmzyXkauwRAqoCbGCNykTRwsur9gS41TQ +M8ssD1jFheOJf3hODnkKU+HKjvMROl1DK7zdmLdNzA1cvtZH/nCC9KPj1z8QC47S +xx+dTZSx4ONAhwbS/LN3PoKtn8LPjY9NP9uDWI+TWYquS2U+KHDrBDlsgozDbs/O +jCxcpDzNmXpWQHEtHU7649OXHP7UeNST1mCUCH5qdank0V1iejF6/CfTFU4MfcrG +YT90qFF93M3v01BbxP+EIY2/9tiIPbrd +=0YYh +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/docker/files/repo/docker.list b/salt/docker/files/repo/docker.list new file mode 100644 index 0000000..b951047 --- /dev/null +++ b/salt/docker/files/repo/docker.list @@ -0,0 +1,2 @@ +deb [arch=amd64 signed-by=/usr/share/keyrings/docker.asc] http://download.docker.com/linux/debian bookworm stable +# vim: ft=debsources diff --git a/salt/docker/files/repo/docker.sources b/salt/docker/files/repo/docker.sources new file mode 100644 index 0000000..57c08b7 --- /dev/null +++ b/salt/docker/files/repo/docker.sources @@ -0,0 +1,6 @@ +Types: deb +URIs: http://download.docker.com/linux/debian +Suites: bookworm +Components: stable +Signed-by: /usr/share/keyrings/docker.asc +# vim: ft=debsources diff --git a/salt/docker/files/repo/docker.yum.asc b/salt/docker/files/repo/docker.yum.asc new file mode 100644 index 0000000..1967cbf --- /dev/null +++ b/salt/docker/files/repo/docker.yum.asc @@ -0,0 +1,28 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFit5IEBEADDt86QpYKz5flnCsOyZ/fk3WwBKxfDjwHf/GIflo+4GWAXS7wJ +1PSzPsvSDATV10J44i5WQzh99q+lZvFCVRFiNhRmlmcXG+rk1QmDh3fsCCj9Q/yP +w8jn3Hx0zDtz8PIB/18ReftYJzUo34COLiHn8WiY20uGCF2pjdPgfxE+K454c4G7 +gKFqVUFYgPug2CS0quaBB5b0rpFUdzTeI5RCStd27nHCpuSDCvRYAfdv+4Y1yiVh +KKdoe3Smj+RnXeVMgDxtH9FJibZ3DK7WnMN2yeob6VqXox+FvKYJCCLkbQgQmE50 +uVK0uN71A1mQDcTRKQ2q3fFGlMTqJbbzr3LwnCBE6hV0a36t+DABtZTmz5O69xdJ +WGdBeePCnWVqtDb/BdEYz7hPKskcZBarygCCe2Xi7sZieoFZuq6ltPoCsdfEdfbO ++VBVKJnExqNZCcFUTEnbH4CldWROOzMS8BGUlkGpa59Sl1t0QcmWlw1EbkeMQNrN +spdR8lobcdNS9bpAJQqSHRZh3cAM9mA3Yq/bssUS/P2quRXLjJ9mIv3dky9C3udM ++q2unvnbNpPtIUly76FJ3s8g8sHeOnmYcKqNGqHq2Q3kMdA2eIbI0MqfOIo2+Xk0 +rNt3ctq3g+cQiorcN3rdHPsTRSAcp+NCz1QF9TwXYtH1XV24A6QMO0+CZwARAQAB +tCtEb2NrZXIgUmVsZWFzZSAoQ0UgcnBtKSA8ZG9ja2VyQGRvY2tlci5jb20+iQI3 +BBMBCgAhBQJYrep4AhsvBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEMUv62ti +Hp816C0P/iP+1uhSa6Qq3TIc5sIFE5JHxOO6y0R97cUdAmCbEqBiJHUPNQDQaaRG +VYBm0K013Q1gcJeUJvS32gthmIvhkstw7KTodwOM8Kl11CCqZ07NPFef1b2SaJ7l +TYpyUsT9+e343ph+O4C1oUQw6flaAJe+8ATCmI/4KxfhIjD2a/Q1voR5tUIxfexC +/LZTx05gyf2mAgEWlRm/cGTStNfqDN1uoKMlV+WFuB1j2oTUuO1/dr8mL+FgZAM3 +ntWFo9gQCllNV9ahYOON2gkoZoNuPUnHsf4Bj6BQJnIXbAhMk9H2sZzwUi9bgObZ +XO8+OrP4D4B9kCAKqqaQqA+O46LzO2vhN74lm/Fy6PumHuviqDBdN+HgtRPMUuao +xnuVJSvBu9sPdgT/pR1N9u/KnfAnnLtR6g+fx4mWz+ts/riB/KRHzXd+44jGKZra +IhTMfniguMJNsyEOO0AN8Tqcl0eRBxcOArcri7xu8HFvvl+e+ILymu4buusbYEVL +GBkYP5YMmScfKn+jnDVN4mWoN1Bq2yMhMGx6PA3hOvzPNsUoYy2BwDxNZyflzuAi +g59mgJm2NXtzNbSRJbMamKpQ69mzLWGdFNsRd4aH7PT7uPAURaf7B5BVp3UyjERW +5alSGnBqsZmvlRnVH5BDUhYsWZMPRQS9rRr4iGW0l+TH+O2VJ8aQ +=0Zqq +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/docker/files/repo/docker.yum.repo b/salt/docker/files/repo/docker.yum.repo new file mode 100644 index 0000000..6e5918a --- /dev/null +++ b/salt/docker/files/repo/docker.yum.repo @@ -0,0 +1,15 @@ +[docker-ce-stable] +name=Docker CE Stable - $basearch +baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/stable +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-docker + +[docker-ce-stable-source] +name=Docker CE Stable - Sources +baseurl=https://download.docker.com/linux/fedora/$releasever/source/stable +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-docker + +# vim: ft=toml diff --git a/salt/docker/init.top b/salt/docker/init.top new file mode 100644 index 0000000..1d59ac6 --- /dev/null +++ b/salt/docker/init.top @@ -0,0 +1,11 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-qubes-builder': + - docker.install + 'qubes-builder': + - docker.configure diff --git a/salt/docker/install-repo.sls b/salt/docker/install-repo.sls new file mode 100644 index 0000000..984ddad --- /dev/null +++ b/salt/docker/install-repo.sls @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +{% from 'utils/macros/install-repo.sls' import install_repo -%} +{{ install_repo(sls_path, 'docker') }} + +{% endif -%} diff --git a/salt/docker/install-repo.top b/salt/docker/install-repo.top new file mode 100644 index 0000000..b82923f --- /dev/null +++ b/salt/docker/install-repo.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-qubes-builder': + - docker.install-repo diff --git a/salt/docker/install.sls b/salt/docker/install.sls new file mode 100644 index 0000000..f642206 --- /dev/null +++ b/salt/docker/install.sls @@ -0,0 +1,58 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - docker.install-repo + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +{% set pkg = { + 'Debian': { + 'pkg_removed': ['docker.io', 'docker-doc', 'docker-compose', + 'podman-docker', 'containerd', 'runc'], + }, + 'RedHat': { + 'pkg_removed': ['docker', 'docker-client', 'docker-client-latest', + 'docker-common', 'docker-latest', + 'docker-latest-logrotate', 'docker-logrotate', + 'docker-selinux', 'docker-engine-selinux', + 'docker-engine'], + }, +}.get(grains.os_family) -%} + +{# +"{{ slsdotpath }}-removed-os-specific": + pkg.removed: + - pkgs: {{ pkg.pkg_removed|sequence|yaml }} +#} + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - man-db + - docker-ce + - docker-ce-cli + - containerd.io + - docker-buildx-plugin + - docker-compose-plugin + +"{{ slsdotpath }}-user-in-docker-group": + user.present: + - name: user + - groups: + - user + - qubes + - docker + +{% endif -%} diff --git a/salt/docker/install.top b/salt/docker/install.top new file mode 100644 index 0000000..ed1d15e --- /dev/null +++ b/salt/docker/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-qubes-builder': + - docker.install diff --git a/salt/dom0/README.md b/salt/dom0/README.md new file mode 100644 index 0000000..9b66b5b --- /dev/null +++ b/salt/dom0/README.md @@ -0,0 +1,42 @@ +# dom0 + +Dom0 environment in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Configure Dom0 window manager, install packages, backup scripts and profile +etc. + +## Installation + +- Top +```sh +qubesctl top.enable dom0 +qubesctl state.apply +qubesctl top.disable dom0 +``` + +- State + +```sh +qubesctl state.apply dom0 +``` + + +## Usage + +You may have noticed the desktop experience in Dom0 has enhanced. You are +using KDE now. You can enforce domains to appear in certain activity with KWin +rules, a tool `qubes-kde-win-rules` is provided to assist you. + +Qubes backup has also improved, you may use `qvm-backup --profile qusal`, +the profile provided is an example. Use the tool `qvm-backup-find-last` to +find the last Qubes Backup made locally to a qube or a remote system, this +facilitates verifying the last backup made with `qvm-backup-restore +--verify-only`. An example is provided in /etc/qubes/backup/qusal.conf. diff --git a/salt/dom0/backup.sls b/salt/dom0/backup.sls new file mode 100644 index 0000000..521377e --- /dev/null +++ b/salt/dom0/backup.sls @@ -0,0 +1,22 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +"{{ slsdotpath }}-backup-find-script": + file.managed: + - name: /usr/local/bin/qvm-backup-find-last + - source: salt://{{ slsdotpath }}/files/bin/qvm-backup-find-last + - mode: '0755' + - user: root + - group: root + +"{{ slsdotpath }}-backup-profile": + file.managed: + - name: /etc/qubes/backup/qusal.conf + - source: salt://{{ slsdotpath }}/files/backup/qusal.conf + - mode: '0755' + - user: root + - group: root + - replace: False diff --git a/salt/dom0/backup.top b/salt/dom0/backup.top new file mode 100644 index 0000000..20a7d31 --- /dev/null +++ b/salt/dom0/backup.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dom0.backup diff --git a/salt/dom0/dotfiles.sls b/salt/dom0/dotfiles.sls new file mode 100644 index 0000000..4141690 --- /dev/null +++ b/salt/dom0/dotfiles.sls @@ -0,0 +1,21 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] == 'dom0' -%} + +include: + - dotfiles.copy-all + +"{{ slsdotpath }}-xprofile-sourcer": + file.managed: + - name: /home/user/.config/autostart/xprofile.desktop + - source: salt://{{ slsdotpath }}/files/autostart/xprofile.desktop + - user: user + - group: user + - mode: '0644' + - makedirs: True + +{% endif -%} diff --git a/salt/dom0/dotfiles.top b/salt/dom0/dotfiles.top new file mode 100644 index 0000000..6a008bf --- /dev/null +++ b/salt/dom0/dotfiles.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dom0.dotfiles diff --git a/salt/dom0/files/autostart-scripts/kde-activity-changed-notifier b/salt/dom0/files/autostart-scripts/kde-activity-changed-notifier new file mode 100755 index 0000000..98021a8 --- /dev/null +++ b/salt/dom0/files/autostart-scripts/kde-activity-changed-notifier @@ -0,0 +1,39 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2018 Oded Arbel +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: MIT + +## Credits: https://geek.co.il/2018/07/30/script-day-different-default-browser-per-kde-activity + +set -eu + +if ! command -v notify-send >/dev/null && + ! command -v kdialog >/dev/null; then + exit 1 +fi +command -v qdbus >/dev/null || exit 1 + +case "${XDG_SESSION_DESKTOP:-}" in + KDE|plasma) ;; + *) exit 1;; +esac + +service="org.kde.ActivityManager" +interface="$service.Activities" +path="/ActivityManager/Activities" +signal="CurrentActivityChanged" + +dbus-monitor --profile \ + "type=signal,path=$path,interface=$interface,member=$signal" | \ +while read -r _ _ _ _ _ path interface member; do + test "$member" = "$signal" || continue + id="$(qdbus "$service" "$path" "$interface.CurrentActivity")" + name="$(qdbus "$service" "$path" "$interface.ActivityName" "$id")" + if command -v kdialog >/dev/null; then + kdialog --title "Activity: $name" --passivepopup "Switched Activities" 3 + elif command -v notify-send >/dev/null; then + notify-send -u normal -t 3000 "Activity: $name" "Switched activities" + fi +done diff --git a/salt/dom0/files/autostart/xprofile.desktop b/salt/dom0/files/autostart/xprofile.desktop new file mode 100644 index 0000000..a9eebba --- /dev/null +++ b/salt/dom0/files/autostart/xprofile.desktop @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Xprofile sourcer +Comment=Source User's Xprofile +Type=Application +Exec=/home/user/.config/x11/xprofile +Terminal=false +StartupNotify=false +Categories=System; diff --git a/salt/dom0/files/backup/qusal.conf b/salt/dom0/files/backup/qusal.conf new file mode 100644 index 0000000..c6ef3dc --- /dev/null +++ b/salt/dom0/files/backup/qusal.conf @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Sample backup profile +--- +include: + - dev + - vault + - sys-git + - sys-ssh-agent +exclude: + - "@tag:skip-backup" + - "@type:TemplateVM" + +compression: true +passphrase_text: my-password + +destination_vm: backup-ssh +destination_path: ssh backup 'cat | tee /dir/qubes-backup-$(data +%Y-%m-%d-%H-%M-%S) >/dev/null' + +# vim: ft=yaml diff --git a/salt/dom0/files/bin/qubes-kde-win-rules b/salt/dom0/files/bin/qubes-kde-win-rules new file mode 100755 index 0000000..ea09dd7 --- /dev/null +++ b/salt/dom0/files/bin/qubes-kde-win-rules @@ -0,0 +1,72 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Write KWin rules for window of specific domain to be in specific activity. +# shellcheck disable=SC1090,SC2317 +set -eu + +file="${XDG_CONFIG_HOME:=$HOME/.config}/kwinrulesrc" + +usage(){ + echo "Usage: ${0##*/} +Example: ${0##*/} personal personal +Example: ${0##*/} fun personal +Example: ${0##*/} work work +If domain is work, dvm-work, disp-work and work-something will all be present +in the work activity" >&2 + exit 1 +} + +writeconf(){ + group="$1" + key="$2" + value="$3" + + group_id="$(grep -B1 -- "^Description=$group$" "$file" | head -1 | tr -d "[" | tr -d "]")" + if test -z "${group_id}"; then + highest_id="$(grep -- "\[[0-9]\+\]" "$file" | tr -d "[" | tr -d "]" | sort | tail -1)" + if test -n "${highest_id}"; then + group_id="$((highest_id+1))" + else + group_id="0" + fi + fi + + kwriteconfig --file "$file" --group "$group_id" --key "$key" "$value" +} + +writeconf_group(){ + chosen_group="$1" + chosen_activity="$2" + writeconf "$chosen_group" Description "$chosen_group" + if test -n "$chosen_activity"; then + chosen_activity_id="$(kactivities-cli --list-activities | + awk -v activity="$chosen_activity" '$3 ~ activity {print $2}')" + if test -z "$chosen_activity_id"; then + printf '%s\n' "Invalid activity name: $chosen_activity" + exit 1 + fi + writeconf "$chosen_group" activity "$chosen_activity_id" + writeconf "$chosen_group" activityrule 2 + fi + + ## Regex: https://doc.qt.io/qt-6/qregularexpression.html + writeconf "$chosen_group" title "^\\[(disp-|dvm-)?$chosen_group(-\\S+)?\\] .*" + writeconf "$chosen_group" titlematch 3 + writeconf "$chosen_group" wmclass "$chosen_group" + writeconf "$chosen_group" wmclasscomplete false + writeconf "$chosen_group" wmclassmatch 2 +} + +case "${1-}" in + ""|-h|--?help) usage +esac +case "${2-}" in + "") usage +esac + +writeconf_group "${1}" "${2}" +dbus-send --type=signal /KWin org.kde.KWin.reloadConfig diff --git a/salt/dom0/files/bin/qubes-update b/salt/dom0/files/bin/qubes-update new file mode 100755 index 0000000..13d2938 --- /dev/null +++ b/salt/dom0/files/bin/qubes-update @@ -0,0 +1,149 @@ +#!/usr/bin/python3 + +# SPDX-FileCopyrightText: 2015 Jason Mehring +# SPDX-FileCopyrightText: 2016 Bahtiar Gadimov +# SPDX-FileCopyrightText: 2016 - 2019 Marek Marczykowsk-Gorecki +# +# SPDX-FileCopyrightText: 2017 unman +# SPDX-FileCopyrightText: 2020 Frederic Pierret +# SPDX-FileCopyrightText: 2021 ctrlaltf24 +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. 1 and sys.argv[1] == '--dom0-only': + try: + import qubes.mgmt.patches + except ImportError: + pass + from salt.scripts import salt_call + + sys.argv[1] = '--local' + salt_call() + else: + sys.exit(main()) diff --git a/salt/dom0/files/bin/qvm-backup-find-last b/salt/dom0/files/bin/qvm-backup-find-last new file mode 100755 index 0000000..7f3d00c --- /dev/null +++ b/salt/dom0/files/bin/qvm-backup-find-last @@ -0,0 +1,27 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +usage(){ + printf '%s\n' "usage: ${0##*/} QUBE DIR [CMD]" + printf '%s\n' "example: ${0##*/} usb-qube /local/dir/backups" + printf '%s\n' "example: ${0##*/} ssh-qube /remote/dir/backups 'ssh user@server'" + printf '%s\n' "note: when using a remote login command (ssh), the DIR is the remote directory" + printf '%s\n' "note: the directory specified must be the parent of where the backups are saved" + exit 1 +} + +if test -z "${2-}"; then + usage +fi + +qube="$1" +path="$2" +cmd="${3-}" + +# shellcheck disable=SC2086 +qvm-run -p "$qube" $cmd find "$path" -maxdepth 1 -type f -name "qubes-backup-*" 2>/dev/null | tail -1 diff --git a/salt/dom0/files/bin/qvm-pci-regain b/salt/dom0/files/bin/qvm-pci-regain new file mode 100755 index 0000000..4274590 --- /dev/null +++ b/salt/dom0/files/bin/qvm-pci-regain @@ -0,0 +1,41 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. " + echo "Example: ${0##*/} --i-like-danger 0000:00:1b.0" + echo "Warning: It is strongly discouraged to reattach PCI devices to dom0, especially if they don’t support resetting!" + exit 1 +} + +case "${1-}" in + --i-like-danger) ;; + *) usage;; +esac +case "${2-}" in + "") usage;; + *) device="$2" +esac + +test "$(id -u)" = "0" || exec sudo "${0}" + +echo "$device" | tee /sys/bus/pci/drivers/pciback/unbind +modalias="$(cat "/sys/bus/pci/devices/$device/modalias")" +mod="$(modprobe -R "$modalias | head -n 1)" +echo "$device" | tee "/sys/bus/pci/drivers/$mod/bind")" diff --git a/salt/dom0/files/sddm.conf.d/qubes.conf b/salt/dom0/files/sddm.conf.d/qubes.conf new file mode 100644 index 0000000..f0ca3b2 --- /dev/null +++ b/salt/dom0/files/sddm.conf.d/qubes.conf @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: 2019 The Qubes OS Project +# +# SPDX-License-Identifier: GPL-2.0-only + +[XDisplay] +ServerArguments=-nolisten tcp -background none + +# vim: ft=systemd diff --git a/salt/dom0/files/xinitrc.d/55xfce-qubes.sh b/salt/dom0/files/xinitrc.d/55xfce-qubes.sh new file mode 100755 index 0000000..33e1a96 --- /dev/null +++ b/salt/dom0/files/xinitrc.d/55xfce-qubes.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2020 The Qubes OS Project +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: GPL-2.0-only + +## Use Qubes provided menu instead of the default one. +case "${XDG_SESSION_DESKTOP-}" in + KDE|plasma) XDG_MENU_PREFIX="kf5-";; + *) XDG_MENU_PREFIX="qubes-";; +esac + +export XDG_MENU_PREFIX diff --git a/salt/dom0/files/xorg.conf.d/30-touchpad.conf b/salt/dom0/files/xorg.conf.d/30-touchpad.conf new file mode 100644 index 0000000..91f532b --- /dev/null +++ b/salt/dom0/files/xorg.conf.d/30-touchpad.conf @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: 2019 The Qubes OS Project +# +# SPDX-License-Identifier: GPL-2.0-only + +Section "InputClass" + Identifier "touchpad catchall" + Driver "libinput" + Option "Tapping" "on" +EndSection diff --git a/salt/dom0/init.sls b/salt/dom0/init.sls new file mode 100644 index 0000000..9043ff9 --- /dev/null +++ b/salt/dom0/init.sls @@ -0,0 +1,16 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] == 'dom0' -%} + +include: + - .install + - .backup + - .xorg + - .kde + - .dotfiles + +{% endif -%} diff --git a/salt/dom0/init.top b/salt/dom0/init.top new file mode 100644 index 0000000..ae64dce --- /dev/null +++ b/salt/dom0/init.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dom0 diff --git a/salt/dom0/install.sls b/salt/dom0/install.sls new file mode 100644 index 0000000..96da8a0 --- /dev/null +++ b/salt/dom0/install.sls @@ -0,0 +1,30 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] == 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkg: + - vim + - xclip + +"{{ slsdotpath }}-qubes-update-script": + file.managed: + - name: /usr/local/bin/qubes-update + - source: salt://{{ slsdotpath }}/files/bin/qubes-update + - mode: '0755' + - user: root + - group: root + +{% endif -%} diff --git a/salt/dom0/install.top b/salt/dom0/install.top new file mode 100644 index 0000000..a3b3b9f --- /dev/null +++ b/salt/dom0/install.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dom0.install diff --git a/salt/dom0/kde.sls b/salt/dom0/kde.sls new file mode 100644 index 0000000..62cf6f7 --- /dev/null +++ b/salt/dom0/kde.sls @@ -0,0 +1,66 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] == 'dom0' -%} + +"{{ slsdotpath }}-kde-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-kde-installed" + pkg.installed: + - pkgs: + - kde-settings-qubes + - sddm + +"{{ slsdotpath }}-configure-xinit": + file.managed: + - name: /etc/X11/xinit/xinitrc.d/55xfce-qubes.sh + - source: salt://{{ slsdotpath }}/files/xinitrc.d/55xfce-qubes.sh + - user: root + - group: root + - mode: '0755' + +"{{ slsdotpath }}-configure-sddm": + file.managed: + - name: /etc/sddm.conf.d/qubes.conf + - source: salt://{{ slsdotpath }}/files/sddm.conf.d/qubes.conf + - user: root + - group: root + - mode: '0644' + - makedirs: True + +"{{ slsdotpath }}-disable-lightdm": + cmd.run: + - name: systemctl disable lightdm + - runas: root + +"{{ slsdotpath }}-enable-sddm": + cmd.run: + - name: systemctl enable sddm + - runas: root + - require: + - cmd: disable-lightdm + +"{{ slsdotpath }}-activity-notifier": + file.managed: + - name: /home/user/.config/autostart-scripts/kde-activity-changed-notifier + - source: salt://{{ slsdotpath }}/files/autostart-scripts/kde-activity-changed-notifier + - user: user + - group: user + - mode: '0755' + - makedirs: True + +"{{ slsdotpath }}-qubes-kde-win-rules": + file.managed: + - name: /home/user/.local/bin/qubes-kde-win-rules + - source: salt://{{ slsdotpath }}/files/bin/qubes-kde-win-rules + - user: user + - group: user + - mode: '0755' + - makedirs: True + +{% endif -%} diff --git a/salt/dom0/kde.top b/salt/dom0/kde.top new file mode 100644 index 0000000..54b8bb4 --- /dev/null +++ b/salt/dom0/kde.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dom0.kde diff --git a/salt/dom0/xorg.sls b/salt/dom0/xorg.sls new file mode 100644 index 0000000..de710fd --- /dev/null +++ b/salt/dom0/xorg.sls @@ -0,0 +1,26 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] == 'dom0' -%} + +"{{ slsdotpath }}-xorg-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-xorg-allow-custom-xsession-login": + pkg.installed: + - pkgs: + - xorg-x11-xinit-session + +"{{ slsdotpath }}-xorg-tap-to-touch": + file.managed: + - name: /etc/X11/xorg.conf.d/30-touchpad.conf + - source: salt://{{ slsdotpath }}/files/xorg.conf.d/30-touchpad.conf + - user: root + - group: root + - mode: '0644' + +{% endif -%} diff --git a/salt/dom0/xorg.top b/salt/dom0/xorg.top new file mode 100644 index 0000000..69d224f --- /dev/null +++ b/salt/dom0/xorg.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dom0.xorg diff --git a/salt/dotfiles b/salt/dotfiles new file mode 160000 index 0000000..31a6472 --- /dev/null +++ b/salt/dotfiles @@ -0,0 +1 @@ +Subproject commit 31a64724d61d8ad0ee11e23f4a6891e14b567143 diff --git a/salt/fedora-minimal/README.md b/salt/fedora-minimal/README.md new file mode 100644 index 0000000..4050b31 --- /dev/null +++ b/salt/fedora-minimal/README.md @@ -0,0 +1,36 @@ +# fedora-minimal + +Fedora Minimal Template in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + + +## Description + +Creates the Fedora Minimal template as well as a Disposable Template based on +it. + +## Installation + +- Top: +```sh +qubesctl top.enable fedora-minimal +qubesctl --targets=fedora-38-minimal state.apply +qubesctl top.disable fedora-minimal +``` + +- State: + +```sh +qubesctl state.apply fedora-minimal.create +qubesctl --skip-dom0 --targets=fedora-38-minimal state.apply fedora-minimal.install +``` + + +## Usage + +AppVMs and StandaloneVMs can be based on this minimal template. diff --git a/salt/fedora-minimal/clone.sls b/salt/fedora-minimal/clone.sls new file mode 100644 index 0000000..5ffbb27 --- /dev/null +++ b/salt/fedora-minimal/clone.sls @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- import slsdotpath ~ "/template.jinja" as template -%} + +"{{ template.template }}-template-installed": + qvm.template_installed: + - name: {{ template.template }} + - fromrepo: {{ template.repo }} diff --git a/salt/fedora-minimal/clone.top b/salt/fedora-minimal/clone.top new file mode 100644 index 0000000..44a523e --- /dev/null +++ b/salt/fedora-minimal/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - fedora-minimal.clone diff --git a/salt/fedora-minimal/create.sls b/salt/fedora-minimal/create.sls new file mode 100644 index 0000000..52098c1 --- /dev/null +++ b/salt/fedora-minimal/create.sls @@ -0,0 +1,63 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +{%- import slsdotpath ~ "/template.jinja" as template -%} + +include: + - .clone + +"dvm-{{ template.template }}-absent": + qvm.absent: + - names: + - dvm-{{ template.template_clean }} + - {{ template.template_clean }}-dvm + - {{ template.template }}-dvm + +{% load_yaml as defaults -%} +name: dvm-{{ template.template_clean }} +force: True +require: +- sls: {{ template.template_clean }}.clone +present: +- template: {{ template.template }} +- label: red +prefs: +- template: {{ template.template }} +- label: red +- memory: 300 +- maxmem: 400 +- vcpus: 1 +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- set: + - menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ template.template_clean }} +force: True +require: +- sls: {{ template.template_clean }}.clone +present: +- label: black +prefs: +- label: black +- memory: 300 +- maxmem: 600 +- vcpus: 1 +- include_in_backups: False +features: +- set: + - menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" + - default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} diff --git a/salt/fedora-minimal/create.top b/salt/fedora-minimal/create.top new file mode 100644 index 0000000..6f933fe --- /dev/null +++ b/salt/fedora-minimal/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - fedora-minimal.create diff --git a/salt/fedora-minimal/init.top b/salt/fedora-minimal/init.top new file mode 100644 index 0000000..08006ac --- /dev/null +++ b/salt/fedora-minimal/init.top @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - fedora-minimal.create + 'I@qubes:type:template and E@^fedora-[0-9][0-9]-minimal$': + - match: compound + - fedora-minimal.install diff --git a/salt/fedora-minimal/install.sls b/salt/fedora-minimal/install.sls new file mode 100644 index 0000000..1d70369 --- /dev/null +++ b/salt/fedora-minimal/install.sls @@ -0,0 +1,16 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dotfiles.copy-x11 + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +{% endif %} diff --git a/salt/fedora-minimal/install.top b/salt/fedora-minimal/install.top new file mode 100644 index 0000000..f2ce1ee --- /dev/null +++ b/salt/fedora-minimal/install.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'I@qubes:type:template and E@^fedora-[0-9][0-9]-minimal$': + - match: compound + - fedora-minimal.install diff --git a/salt/fedora-minimal/template.jinja b/salt/fedora-minimal/template.jinja new file mode 100644 index 0000000..b5abf37 --- /dev/null +++ b/salt/fedora-minimal/template.jinja @@ -0,0 +1,11 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- import "fedora/template.jinja" as template_base -%} +{% set version = template_base.version -%} +{% set repo = template_base.repo -%} +{% set template = template_base.template ~ '-minimal' -%} +{% set template_clean = template_base.template_clean ~ '-minimal' -%} diff --git a/salt/fedora/README.md b/salt/fedora/README.md new file mode 100644 index 0000000..817d219 --- /dev/null +++ b/salt/fedora/README.md @@ -0,0 +1,34 @@ +# fedora + +Fedora Template in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Creates the Fedora template as well as a Disposable Template based on it. + +## Installation + +- Top: +```sh +qubesctl top.enable fedora +qubesctl --targets=fedora-38 state.apply +qubesctl top.disable fedora +``` + +- State: + +```sh +qubesctl state.apply fedora.create +qubesctl --skip-dom0 --targets=fedora-38 state.apply fedora.install +``` + + +## Usage + +AppVMs and StandaloneVMs can be based on this template. diff --git a/salt/fedora/clone.sls b/salt/fedora/clone.sls new file mode 100644 index 0000000..5ffbb27 --- /dev/null +++ b/salt/fedora/clone.sls @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- import slsdotpath ~ "/template.jinja" as template -%} + +"{{ template.template }}-template-installed": + qvm.template_installed: + - name: {{ template.template }} + - fromrepo: {{ template.repo }} diff --git a/salt/fedora/clone.top b/salt/fedora/clone.top new file mode 100644 index 0000000..1e6c580 --- /dev/null +++ b/salt/fedora/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - fedora.clone diff --git a/salt/fedora/create.sls b/salt/fedora/create.sls new file mode 100644 index 0000000..52098c1 --- /dev/null +++ b/salt/fedora/create.sls @@ -0,0 +1,63 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +{%- import slsdotpath ~ "/template.jinja" as template -%} + +include: + - .clone + +"dvm-{{ template.template }}-absent": + qvm.absent: + - names: + - dvm-{{ template.template_clean }} + - {{ template.template_clean }}-dvm + - {{ template.template }}-dvm + +{% load_yaml as defaults -%} +name: dvm-{{ template.template_clean }} +force: True +require: +- sls: {{ template.template_clean }}.clone +present: +- template: {{ template.template }} +- label: red +prefs: +- template: {{ template.template }} +- label: red +- memory: 300 +- maxmem: 400 +- vcpus: 1 +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- set: + - menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ template.template_clean }} +force: True +require: +- sls: {{ template.template_clean }}.clone +present: +- label: black +prefs: +- label: black +- memory: 300 +- maxmem: 600 +- vcpus: 1 +- include_in_backups: False +features: +- set: + - menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" + - default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} diff --git a/salt/fedora/create.top b/salt/fedora/create.top new file mode 100644 index 0000000..a4aa916 --- /dev/null +++ b/salt/fedora/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - fedora.create diff --git a/salt/fedora/init.top b/salt/fedora/init.top new file mode 100644 index 0000000..01ca49f --- /dev/null +++ b/salt/fedora/init.top @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - fedora.create + 'I@qubes:type:template and E@^fedora-[0-9][0-9]$': + - match: compound + - fedora.install diff --git a/salt/fedora/install.sls b/salt/fedora/install.sls new file mode 100644 index 0000000..41e3943 --- /dev/null +++ b/salt/fedora/install.sls @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +{% endif %} diff --git a/salt/fedora/install.top b/salt/fedora/install.top new file mode 100644 index 0000000..22c7c5c --- /dev/null +++ b/salt/fedora/install.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'I@qubes:type:template and E@^fedora-[0-9][0-9]$': + - match: compound + - fedora.install diff --git a/salt/fedora/template.jinja b/salt/fedora/template.jinja new file mode 100644 index 0000000..8f3448e --- /dev/null +++ b/salt/fedora/template.jinja @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% set version = salt['pillar.get']('qvm:fedora:version', '38') -%} +{% set repo = salt['pillar.get']('qvm:fedora:repo', 'qubes-templates-itl') -%} +{% set template = 'fedora-' ~ version -%} +{% set template_clean = 'fedora' -%} diff --git a/salt/media/README.md b/salt/media/README.md new file mode 100644 index 0000000..48b0a3a --- /dev/null +++ b/salt/media/README.md @@ -0,0 +1,48 @@ +# media + +Media opener through disposables in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) +* [Credits](#credits) + +## Description + +Creates the offline "media" qube for storing multimedia files and open the +files in a named disposable "disp-media" via MIME configuration. + +## Installation + +- Top: +```sh +qubesctl top.enable media +qubesctl --targets=tpl-media,media state.apply +qubesctl top.disable media +``` + +- State: + +```sh +qubesctl state.apply media.create +qubesctl --skip-dom0 --targets=tpl-media state.apply media.install +qubesctl --skip-dom0 --targets=media state.apply media.configure +``` + + +## Usage + +You will store multimedia files in the "media" qube. When you try to open a +file in that qube, it will open instead in the disposable "disp-media". + +No file browser is installed in the "media" qube as code execution exploits in +file browsers are common when rendering thumbnails, indexing file name, +automatically running scripts saved in the home directory. You are open to +forward files from the "media" qube to "disp-media" by running `xdg-open +/path/file` or more explicitly, `qvm-open-in-dvm /path/file`. + +## Credits + +- [Unman](https://github.com/unman/shaker/tree/main/multimedia) diff --git a/salt/media/clone.sls b/salt/media/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/media/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/media/clone.top b/salt/media/clone.top new file mode 100644 index 0000000..8c9ef97 --- /dev/null +++ b/salt/media/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - media.clone diff --git a/salt/media/configure.sls b/salt/media/configure.sls new file mode 100644 index 0000000..e7df484 --- /dev/null +++ b/salt/media/configure.sls @@ -0,0 +1,28 @@ +{# +SPDX-FileCopyrightText: 2022 - 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-home-config-mimeapps.list": + file.managed: + - name: /home/user/.config/mimeapps.list + - source: salt://{{ slsdotpath }}/files/client/mimeapps.list + - mode: '0644' + - user: user + - group: user + - makedirs: True + +"{{ slsdotpath }}-home-local-share-mimeapps.list": + file.symlink: + - name: /home/user/.local/share/applications/mimeapps.list + - target: /home/user/.config/mimeapps.list + - user: user + - group: user + - force: True + - makedirs: True + +{% endif -%} diff --git a/salt/media/configure.top b/salt/media/configure.top new file mode 100644 index 0000000..681f6f1 --- /dev/null +++ b/salt/media/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'media': + - media.configure diff --git a/salt/media/create.sls b/salt/media/create.sls new file mode 100644 index 0000000..7c60d55 --- /dev/null +++ b/salt/media/create.sls @@ -0,0 +1,105 @@ +{# +SPDX-FileCopyrightText: 2022 - 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +{%- import "templates/debian-minimal.jinja" as template -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: {{ template.template }} +- label: yellow +prefs: +- template: {{ template.template }} +- label: yellow +- netvm: "" +- vcpus: 2 +- memory: 300 +- maxmem: 800 +- autostart: False +- include_in_backups: True +features: +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy + - service.tracker + - service.evolution-data-server +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: dvm-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: yellow +prefs: +- template: tpl-{{ slsdotpath }} +- label: yellow +- netvm: "" +- memory: 300 +- maxmem: 800 +- vcpus: 2 +- template_for_dispvms: True +- include_in_backups: False +features: +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy + - service.tracker + - service.evolution-data-server +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: disp-{{ slsdotpath }} +force: True +require: +- qvm: dvm-{{ slsdotpath }} +present: +- template: dvm-{{ slsdotpath }} +- label: yellow +- class: DispVM +prefs: +- template: dvm-{{ slsdotpath }} +- label: yellow +- vcpus: 2 +- netvm: "" +- memory: 300 +- maxmem: 800 +- autostart: False +- include_in_backups: False +features: +- appmenus-dispvm: True +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy + - service.tracker + - service.evolution-data-server +- enable: + - service.shutdownle +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-extend-private-volume": + cmd.run: + - name: qvm-volume extend {{ slsdotpath }}:private 50Gi + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/media/create.top b/salt/media/create.top new file mode 100644 index 0000000..d4566d8 --- /dev/null +++ b/salt/media/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - media.create diff --git a/salt/media/files/admin/policy/default.policy b/salt/media/files/admin/policy/default.policy new file mode 100644 index 0000000..5d56bb1 --- /dev/null +++ b/salt/media/files/admin/policy/default.policy @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qubes.OpenInVM * {{ sls_path }} @dispvm allow target=disp-{{ sls_path }} +qubes.OpenInVM * {{ sls_path }} @default allow target=disp-{{ sls_path }} +qubes.OpenInVM * {{ sls_path }} @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/media/files/browser/mimeapps.list b/salt/media/files/browser/mimeapps.list new file mode 100644 index 0000000..508d6a0 --- /dev/null +++ b/salt/media/files/browser/mimeapps.list @@ -0,0 +1,73 @@ +# SPDX-FileCopyrightText: 2023 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Default Applications] +application/pdf=xpdf.desktop +application/epub+zip=calibre-ebook-viewer.desktop +application/epub=calibre-ebook-viewer.desktop +image/avs=gpicview.desktop +image/bie=gpicview.desktop +image/bmp=gpicview.desktop +image/cmyk=gpicview.desktop +image/dcx=gpicview.desktop +image/eps=gpicview.desktop +image/fax=gpicview.desktop +image/fits=gpicview.desktop +image/g3fax=gpicview.desktop +image/gif=gpicview.desktop +image/gray=gpicview.desktop +image/jpeg=gpicview.desktop +image/miff=gpicview.desktop +image/mono=gpicview.desktop +image/mtv=gpicview.desktop +image/pcd=gpicview.desktop +image/pcx=gpicview.desktop +image/pdf=gpicview.desktop +image/pict=gpicview.desktop +image/pjpeg=gpicview.desktop +image/png=gpicview.desktop +image/ps=gpicview.desktop +image/rad=gpicview.desktop +image/rgba=gpicview.desktop +image/rla=gpicview.desktop +image/rle=gpicview.desktop +image/sgi=gpicview.desktop +image/sun-raster=gpicview.desktop +image/svg+xml=gpicview.desktop +image/targa=gpicview.desktop +image/tiff=gpicview.desktop +image/uyvy=gpicview.desktop +image/vid=gpicview.desktop +image/viff=gpicview.desktop +image/vnd.djvu=gpicview.desktop +image/vnd.djvu+multipage=gpicview.desktop +image/vnd.rn-realpix=gpicview.desktop +image/x-bzeps=gpicview.desktop +image/x-compressed-xcf=gpicview.desktop +image/x-eps=gpicview.desktop +image/x-fits=gpicview.desktop +image/x-freehand=gpicview.desktop +image/x-gimp-gbr=gpicview.desktop +image/x-gimp-gih=gpicview.desktop +image/x-gimp-pat=gpicview.desktop +image/x-gzeps=gpicview.desktop +image/x-icon=gpicview.desktop +image/x-ms-bmp=gpicview.desktop +image/x-pcx=gpicview.desktop +image/x-portable-anymap=gpicview.desktop +image/x-portable-bitmap=gpicview.desktop +image/x-portable-graymap=gpicview.desktop +image/x-portable-pixmap=gpicview.desktop +image/x-psd=gpicview.desktop +image/x-psp=gpicview.desktop +image/x-rgb=gpicview.desktop +image/x-sgi=gpicview.desktop +image/x-tga=gpicview.desktop +image/x-wmf=gpicview.desktop +image/x-xbitmap=gpicview.desktop +image/x-xcf=gpicview.desktop +image/x-xcursor=gpicview.desktop +image/x-xpixmap=gpicview.desktop +image/x-xwindowdump=gpicview.desktop +image/yuv=gpicview.desktop diff --git a/salt/media/files/client/mimeapps.list b/salt/media/files/client/mimeapps.list new file mode 100644 index 0000000..313508a --- /dev/null +++ b/salt/media/files/client/mimeapps.list @@ -0,0 +1,805 @@ +# SPDX-FileCopyrightText: 2023 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Default Applications] +application/clarisworks=qvm-open-in-dvm.desktop +application/csv=qvm-open-in-dvm.desktop +application/epub=qvm-open-in-dvm.desktop +application/epub+zip=qvm-open-in-dvm.desktop +application/excel=qvm-open-in-dvm.desktop +application/macwriteii=qvm-open-in-dvm.desktop +application/mathml+xml=qvm-open-in-dvm.desktop +application/mpeg4-iod=qvm-open-in-dvm.desktop +application/mpeg4-muxcodetable=qvm-open-in-dvm.desktop +application/msexcel=qvm-open-in-dvm.desktop +application/mspowerpoint=qvm-open-in-dvm.desktop +application/msword=qvm-open-in-dvm.desktop +application/mxf=qvm-open-in-dvm.desktop +application/ogg=qvm-open-in-dvm.desktop +application/oxps=qvm-open-in-dvm.desktop +application/pdf=qvm-open-in-dvm.desktop +application/pkcs10=qvm-open-in-dvm.desktop +application/pkcs10+pem=qvm-open-in-dvm.desktop +application/pkcs12=qvm-open-in-dvm.desktop +application/pkcs12+pem=qvm-open-in-dvm.desktop +application/pkcs7-mime=qvm-open-in-dvm.desktop +application/pkcs7-mime+pem=qvm-open-in-dvm.desktop +application/pkcs8=qvm-open-in-dvm.desktop +application/pkcs8+pem=qvm-open-in-dvm.desktop +application/pkix-cert=qvm-open-in-dvm.desktop +application/pkix-cert+pem=qvm-open-in-dvm.desktop +application/pkix-crl=qvm-open-in-dvm.desktop +application/pkix-crl+pem=qvm-open-in-dvm.desktop +application/postscript=qvm-open-in-dvm.desktop +application/prs.plucker=qvm-open-in-dvm.desktop +application/ram=qvm-open-in-dvm.desktop +application/rdf+xml=qvm-open-in-dvm.desktop +application/rss+xml=qvm-open-in-dvm.desktop +application/rtf=qvm-open-in-dvm.desktop +application/sdp=qvm-open-in-dvm.desktop +application/tab-separated-values=qvm-open-in-dvm.desktop +application/vnd.apple.mpegurl=qvm-open-in-dvm.desktop +application/vnd.comicbook+zip=qvm-open-in-dvm.desktop +application/vnd.corel-draw=qvm-open-in-dvm.desktop +application/vnd.lotus-1-2-3=qvm-open-in-dvm.desktop +application/vnd.lotus-wordpro=qvm-open-in-dvm.desktop +application/vnd.mozilla.xul+xml=qvm-open-in-dvm.desktop +application/vnd.ms-asf=qvm-open-in-dvm.desktop +application/vnd.ms-excel=qvm-open-in-dvm.desktop +application/vnd.ms-excel.sheet.binary.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-excel.sheet.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-excel.template.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-powerpoint=qvm-open-in-dvm.desktop +application/vnd.ms-powerpoint.presentation.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-powerpoint.slideshow.macroEnabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-powerpoint.template.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-publisher=qvm-open-in-dvm.desktop +application/vnd.ms-word=qvm-open-in-dvm.desktop +application/vnd.ms-word.document.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-word.template.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-works=qvm-open-in-dvm.desktop +application/vnd.ms-wpl=qvm-open-in-dvm.desktop +application/vnd.ms-xpsdocument=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.chart=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.chart-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.formula=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.formula-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.graphics=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.graphics-flat-xml=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.graphics-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.presentation=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.presentation-flat-xml=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.presentation-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.spreadsheet=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.spreadsheet-flat-xml=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.spreadsheet-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-flat-xml=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-master=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-master-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-web=qvm-open-in-dvm.desktop +application/vnd.openofficeorg.extension=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.presentationml.presentation=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.presentationml.slide=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.presentationml.slideshow=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.presentationml.template=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.spreadsheetml.template=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.wordprocessingml.document=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.wordprocessingml.template=qvm-open-in-dvm.desktop +application/vnd.palm=qvm-open-in-dvm.desktop +application/vnd.rn-realmedia=qvm-open-in-dvm.desktop +application/vnd.rn-realmedia-vbr=qvm-open-in-dvm.desktop +application/vnd.stardivision.writer-global=qvm-open-in-dvm.desktop +application/vnd.sun.xml.calc=qvm-open-in-dvm.desktop +application/vnd.sun.xml.calc.template=qvm-open-in-dvm.desktop +application/vnd.sun.xml.draw=qvm-open-in-dvm.desktop +application/vnd.sun.xml.draw.template=qvm-open-in-dvm.desktop +application/vnd.sun.xml.impress=qvm-open-in-dvm.desktop +application/vnd.sun.xml.impress.template=qvm-open-in-dvm.desktop +application/vnd.sun.xml.math=qvm-open-in-dvm.desktop +application/vnd.sun.xml.writer=qvm-open-in-dvm.desktop +application/vnd.sun.xml.writer.global=qvm-open-in-dvm.desktop +application/vnd.sun.xml.writer.template=qvm-open-in-dvm.desktop +application/vnd.visio=qvm-open-in-dvm.desktop +application/vnd.wordperfect=qvm-open-in-dvm.desktop +application/wordperfect=qvm-open-in-dvm.desktop +application/x-123=qvm-open-in-dvm.desktop +application/x-abiword=qvm-open-in-dvm.desktop +application/x-aportisdoc=qvm-open-in-dvm.desktop +application/x-bzdvi=qvm-open-in-dvm.desktop +application/x-bzpdf=qvm-open-in-dvm.desktop +application/x-bzpostscript=qvm-open-in-dvm.desktop +application/x-cb7=qvm-open-in-dvm.desktop +application/x-cbr=qvm-open-in-dvm.desktop +application/x-cbz=qvm-open-in-dvm.desktop +application/x-cd-image=qvm-open-in-dvm.desktop +application/x-dbase=qvm-open-in-dvm.desktop +application/x-dbf=qvm-open-in-dvm.desktop +application/x-doc=qvm-open-in-dvm.desktop +application/x-dos_ms_excel=qvm-open-in-dvm.desktop +application/x-dvi=qvm-open-in-dvm.desktop +application/x-excel=qvm-open-in-dvm.desktop +application/x-ext-cb7=qvm-open-in-dvm.desktop +application/x-ext-cbr=qvm-open-in-dvm.desktop +application/x-ext-cbz=qvm-open-in-dvm.desktop +application/x-ext-djv=qvm-open-in-dvm.desktop +application/x-ext-djvu=qvm-open-in-dvm.desktop +application/x-ext-dvi=qvm-open-in-dvm.desktop +application/x-ext-eps=qvm-open-in-dvm.desktop +application/x-ext-pdf=qvm-open-in-dvm.desktop +application/x-ext-ps=qvm-open-in-dvm.desktop +application/x-extension-m4a=qvm-open-in-dvm.desktop +application/x-extension-mp4=qvm-open-in-dvm.desktop +application/x-extension-txt=qvm-open-in-dvm.desktop +application/x-fictionbook+xml=qvm-open-in-dvm.desktop +application/x-flac=qvm-open-in-dvm.desktop +application/x-flash-video=qvm-open-in-dvm.desktop +application/x-gnome-saved-search=qvm-open-in-dvm.desktop +application/x-gnucash=qvm-open-in-dvm.desktop +application/x-gzdvi=qvm-open-in-dvm.desktop +application/x-gzpdf=qvm-open-in-dvm.desktop +application/x-gzpostscript=qvm-open-in-dvm.desktop +application/x-hwp=qvm-open-in-dvm.desktop +application/x-iwork-keynote-sffkey=qvm-open-in-dvm.desktop +application/x-iwork-numbers-sffnumbers=qvm-open-in-dvm.desktop +application/x-iwork-pages-sffpages=qvm-open-in-dvm.desktop +application/x-keepass2=qvm-open-in-dvm.desktop +application/x-matroska=qvm-open-in-dvm.desktop +application/x-ms-excel=qvm-open-in-dvm.desktop +application/x-msexcel=qvm-open-in-dvm.desktop +application/x-mswrite=qvm-open-in-dvm.desktop +application/x-ogg=qvm-open-in-dvm.desktop +application/x-pagemaker=qvm-open-in-dvm.desktop +application/x-pem-file=qvm-open-in-dvm.desktop +application/x-pem-key=qvm-open-in-dvm.desktop +application/x-pkcs12=qvm-open-in-dvm.desktop +application/x-pkcs7-certificates=qvm-open-in-dvm.desktop +application/x-quattropro=qvm-open-in-dvm.desktop +application/x-quicktime-media-link=qvm-open-in-dvm.desktop +application/x-quicktimeplayer=qvm-open-in-dvm.desktop +application/x-shellscript=qvm-open-in-dvm.desktop +application/x-shockwave-flash=qvm-open-in-dvm.desktop +application/x-sony-bbeb=qvm-open-in-dvm.desktop +application/x-spkac=qvm-open-in-dvm.desktop +application/x-spkac+base64=qvm-open-in-dvm.desktop +application/x-t602=qvm-open-in-dvm.desktop +application/x-wpg=qvm-open-in-dvm.desktop +application/x-x509-ca-cert=qvm-open-in-dvm.desktop +application/x-x509-user-cert=qvm-open-in-dvm.desktop +application/x-xzpdf=qvm-open-in-dvm.desktop +application/xhtml+xml=qvm-open-in-dvm.desktop +application/xml=qvm-open-in-dvm.desktop +application/xspf+xml=qvm-open-in-dvm.desktop +audio/3gpp=qvm-open-in-dvm.desktop +audio/3gpp2=qvm-open-in-dvm.desktop +audio/AMR=qvm-open-in-dvm.desktop +audio/AMR-WB=qvm-open-in-dvm.desktop +audio/aac=qvm-open-in-dvm.desktop +audio/ac3=qvm-open-in-dvm.desktop +audio/basic=qvm-open-in-dvm.desktop +audio/dv=qvm-open-in-dvm.desktop +audio/eac3=qvm-open-in-dvm.desktop +audio/flac=qvm-open-in-dvm.desktop +audio/m4a=qvm-open-in-dvm.desktop +audio/midi=qvm-open-in-dvm.desktop +audio/mp1=qvm-open-in-dvm.desktop +audio/mp2=qvm-open-in-dvm.desktop +audio/mp3=qvm-open-in-dvm.desktop +audio/mp4=qvm-open-in-dvm.desktop +audio/mpeg=qvm-open-in-dvm.desktop +audio/mpegurl=qvm-open-in-dvm.desktop +audio/mpg=qvm-open-in-dvm.desktop +audio/ogg=qvm-open-in-dvm.desktop +audio/opus=qvm-open-in-dvm.desktop +audio/scpls=qvm-open-in-dvm.desktop +audio/vnd.dolby.heaac.1=qvm-open-in-dvm.desktop +audio/vnd.dolby.heaac.2=qvm-open-in-dvm.desktop +audio/vnd.dolby.mlp=qvm-open-in-dvm.desktop +audio/vnd.dts=qvm-open-in-dvm.desktop +audio/vnd.dts.hd=qvm-open-in-dvm.desktop +audio/vnd.rn-realaudio=qvm-open-in-dvm.desktop +audio/vorbis=qvm-open-in-dvm.desktop +audio/wav=qvm-open-in-dvm.desktop +audio/webm=qvm-open-in-dvm.desktop +audio/x-aac=qvm-open-in-dvm.desktop +audio/x-adpcm=qvm-open-in-dvm.desktop +audio/x-aiff=qvm-open-in-dvm.desktop +audio/x-ape=qvm-open-in-dvm.desktop +audio/x-flac=qvm-open-in-dvm.desktop +audio/x-gsm=qvm-open-in-dvm.desktop +audio/x-it=qvm-open-in-dvm.desktop +audio/x-m4a=qvm-open-in-dvm.desktop +audio/x-matroska=qvm-open-in-dvm.desktop +audio/x-mod=qvm-open-in-dvm.desktop +audio/x-mp1=qvm-open-in-dvm.desktop +audio/x-mp2=qvm-open-in-dvm.desktop +audio/x-mp3=qvm-open-in-dvm.desktop +audio/x-mpeg=qvm-open-in-dvm.desktop +audio/x-mpegurl=qvm-open-in-dvm.desktop +audio/x-mpg=qvm-open-in-dvm.desktop +audio/x-ms-asf=qvm-open-in-dvm.desktop +audio/x-ms-asx=qvm-open-in-dvm.desktop +audio/x-ms-wax=qvm-open-in-dvm.desktop +audio/x-ms-wma=qvm-open-in-dvm.desktop +audio/x-musepack=qvm-open-in-dvm.desktop +audio/x-pn-aiff=qvm-open-in-dvm.desktop +audio/x-pn-au=qvm-open-in-dvm.desktop +audio/x-pn-realaudio=qvm-open-in-dvm.desktop +audio/x-pn-realaudio-plugin=qvm-open-in-dvm.desktop +audio/x-pn-wav=qvm-open-in-dvm.desktop +audio/x-pn-windows-acm=qvm-open-in-dvm.desktop +audio/x-real-audio=qvm-open-in-dvm.desktop +audio/x-realaudio=qvm-open-in-dvm.desktop +audio/x-s3m=qvm-open-in-dvm.desktop +audio/x-scpls=qvm-open-in-dvm.desktop +audio/x-shorten=qvm-open-in-dvm.desktop +audio/x-speex=qvm-open-in-dvm.desktop +audio/x-tta=qvm-open-in-dvm.desktop +audio/x-vorbis=qvm-open-in-dvm.desktop +audio/x-vorbis+ogg=qvm-open-in-dvm.desktop +audio/x-wav=qvm-open-in-dvm.desktop +audio/x-wavpack=qvm-open-in-dvm.desktop +audio/x-xm=qvm-open-in-dvm.desktop +image/avs=qvm-open-in-dvm.desktop +image/bie=qvm-open-in-dvm.desktop +image/bmp=qvm-open-in-dvm.desktop +image/cmyk=qvm-open-in-dvm.desktop +image/dcx=qvm-open-in-dvm.desktop +image/eps=qvm-open-in-dvm.desktop +image/fax=qvm-open-in-dvm.desktop +image/fits=qvm-open-in-dvm.desktop +image/g3fax=qvm-open-in-dvm.desktop +image/gif=qvm-open-in-dvm.desktop +image/gray=qvm-open-in-dvm.desktop +image/jpeg=qvm-open-in-dvm.desktop +image/miff=qvm-open-in-dvm.desktop +image/mono=qvm-open-in-dvm.desktop +image/mtv=qvm-open-in-dvm.desktop +image/pcd=qvm-open-in-dvm.desktop +image/pcx=qvm-open-in-dvm.desktop +image/pdf=qvm-open-in-dvm.desktop +image/pict=qvm-open-in-dvm.desktop +image/pjpeg=qvm-open-in-dvm.desktop +image/png=qvm-open-in-dvm.desktop +image/ps=qvm-open-in-dvm.desktop +image/rad=qvm-open-in-dvm.desktop +image/rgba=qvm-open-in-dvm.desktop +image/rla=qvm-open-in-dvm.desktop +image/rle=qvm-open-in-dvm.desktop +image/sgi=qvm-open-in-dvm.desktop +image/sun-raster=qvm-open-in-dvm.desktop +image/svg+xml=qvm-open-in-dvm.desktop +image/targa=qvm-open-in-dvm.desktop +image/tiff=qvm-open-in-dvm.desktop +image/uyvy=qvm-open-in-dvm.desktop +image/vid=qvm-open-in-dvm.desktop +image/viff=qvm-open-in-dvm.desktop +image/vnd.djvu=qvm-open-in-dvm.desktop +image/vnd.djvu+multipage=qvm-open-in-dvm.desktop +image/vnd.rn-realpix=qvm-open-in-dvm.desktop +image/x-bzeps=qvm-open-in-dvm.desktop +image/x-compressed-xcf=qvm-open-in-dvm.desktop +image/x-eps=qvm-open-in-dvm.desktop +image/x-fits=qvm-open-in-dvm.desktop +image/x-freehand=qvm-open-in-dvm.desktop +image/x-gimp-gbr=qvm-open-in-dvm.desktop +image/x-gimp-gih=qvm-open-in-dvm.desktop +image/x-gimp-pat=qvm-open-in-dvm.desktop +image/x-gzeps=qvm-open-in-dvm.desktop +image/x-icon=qvm-open-in-dvm.desktop +image/x-ms-bmp=qvm-open-in-dvm.desktop +image/x-pcx=qvm-open-in-dvm.desktop +image/x-portable-anymap=qvm-open-in-dvm.desktop +image/x-portable-bitmap=qvm-open-in-dvm.desktop +image/x-portable-graymap=qvm-open-in-dvm.desktop +image/x-portable-pixmap=qvm-open-in-dvm.desktop +image/x-psd=qvm-open-in-dvm.desktop +image/x-psp=qvm-open-in-dvm.desktop +image/x-rgb=qvm-open-in-dvm.desktop +image/x-sgi=qvm-open-in-dvm.desktop +image/x-tga=qvm-open-in-dvm.desktop +image/x-wmf=qvm-open-in-dvm.desktop +image/x-xbitmap=qvm-open-in-dvm.desktop +image/x-xcf=qvm-open-in-dvm.desktop +image/x-xcursor=qvm-open-in-dvm.desktop +image/x-xpixmap=qvm-open-in-dvm.desktop +image/x-xwindowdump=qvm-open-in-dvm.desktop +image/yuv=qvm-open-in-dvm.desktop +inode/directory=qvm-open-in-dvm.desktop +message/rfc822=qvm-open-in-dvm.desktop +misc/ultravox=qvm-open-in-dvm.desktop +text/calendar=qvm-open-in-dvm.desktop +text/comma-separated-values=qvm-open-in-dvm.desktop +text/csv=qvm-open-in-dvm.desktop +text/english=qvm-open-in-dvm.desktop +text/google-video-pointer=qvm-open-in-dvm.desktop +text/html=qvm-open-in-dvm.desktop +text/mathml=qvm-open-in-dvm.desktop +text/plain=qvm-open-in-dvm.desktop +text/rtf=qvm-open-in-dvm.desktop +text/spreadsheet=qvm-open-in-dvm.desktop +text/tab-separated-values=qvm-open-in-dvm.desktop +text/x-c=qvm-open-in-dvm.desktop +text/x-c++=qvm-open-in-dvm.desktop +text/x-c++hdr=qvm-open-in-dvm.desktop +text/x-c++src=qvm-open-in-dvm.desktop +text/x-chdr=qvm-open-in-dvm.desktop +text/x-comma-separated-values=qvm-open-in-dvm.desktop +text/x-csrc=qvm-open-in-dvm.desktop +text/x-csv=qvm-open-in-dvm.desktop +text/x-google-video-pointer=qvm-open-in-dvm.desktop +text/x-java=qvm-open-in-dvm.desktop +text/x-makefile=qvm-open-in-dvm.desktop +text/x-moc=qvm-open-in-dvm.desktop +text/x-pascal=qvm-open-in-dvm.desktop +text/x-tcl=qvm-open-in-dvm.desktop +text/x-tex=qvm-open-in-dvm.desktop +text/x-vcard=qvm-open-in-dvm.desktop +text/xml=qvm-open-in-dvm.desktop +video/3gp=qvm-open-in-dvm.desktop +video/3gpp=qvm-open-in-dvm.desktop +video/3gpp2=qvm-open-in-dvm.desktop +video/avi=qvm-open-in-dvm.desktop +video/divx=qvm-open-in-dvm.desktop +video/dv=qvm-open-in-dvm.desktop +video/fli=qvm-open-in-dvm.desktop +video/flv=qvm-open-in-dvm.desktop +video/mp2t=qvm-open-in-dvm.desktop +video/mp4=qvm-open-in-dvm.desktop +video/mp4v-es=qvm-open-in-dvm.desktop +video/mpeg=qvm-open-in-dvm.desktop +video/mpeg-system=qvm-open-in-dvm.desktop +video/msvideo=qvm-open-in-dvm.desktop +video/ogg=qvm-open-in-dvm.desktop +video/quicktime=qvm-open-in-dvm.desktop +video/vnd.divx=qvm-open-in-dvm.desktop +video/vnd.mpegurl=qvm-open-in-dvm.desktop +video/vnd.rn-realvideo=qvm-open-in-dvm.desktop +video/webm=qvm-open-in-dvm.desktop +video/x-anim=qvm-open-in-dvm.desktop +video/x-avi=qvm-open-in-dvm.desktop +video/x-flc=qvm-open-in-dvm.desktop +video/x-fli=qvm-open-in-dvm.desktop +video/x-flv=qvm-open-in-dvm.desktop +video/x-m4v=qvm-open-in-dvm.desktop +video/x-matroska=qvm-open-in-dvm.desktop +video/x-mpeg=qvm-open-in-dvm.desktop +video/x-mpeg-system=qvm-open-in-dvm.desktop +video/x-mpeg2=qvm-open-in-dvm.desktop +video/x-ms-asf=qvm-open-in-dvm.desktop +video/x-ms-asf-plugin=qvm-open-in-dvm.desktop +video/x-ms-asx=qvm-open-in-dvm.desktop +video/x-ms-wm=qvm-open-in-dvm.desktop +video/x-ms-wmv=qvm-open-in-dvm.desktop +video/x-ms-wmx=qvm-open-in-dvm.desktop +video/x-ms-wvx=qvm-open-in-dvm.desktop +video/x-msvideo=qvm-open-in-dvm.desktop +video/x-nsv=qvm-open-in-dvm.desktop +video/x-ogm=qvm-open-in-dvm.desktop +video/x-ogm+ogg=qvm-open-in-dvm.desktop +video/x-theora=qvm-open-in-dvm.desktop +video/x-theora+ogg=qvm-open-in-dvm.desktop +x-content/audio-cdda=qvm-open-in-dvm.desktop +x-content/audio-player=qvm-open-in-dvm.desktop +x-content/unix-software=qvm-open-in-dvm.desktop +x-content/video-dvd=qvm-open-in-dvm.desktop +x-content/video-svcd=qvm-open-in-dvm.desktop +x-content/video-vcd=qvm-open-in-dvm.desktop +x-scheme-handler/ghelp=qvm-open-in-dvm.desktop +x-scheme-handler/help=qvm-open-in-dvm.desktop +x-scheme-handler/http=qvm-open-in-dvm.desktop +x-scheme-handler/https=qvm-open-in-dvm.desktop +x-scheme-handler/icy=qvm-open-in-dvm.desktop +x-scheme-handler/icyx=qvm-open-in-dvm.desktop +x-scheme-handler/info=qvm-open-in-dvm.desktop +x-scheme-handler/mailto=qvm-open-in-dvm.desktop +x-scheme-handler/man=qvm-open-in-dvm.desktop +x-scheme-handler/mms=qvm-open-in-dvm.desktop +x-scheme-handler/mmsh=qvm-open-in-dvm.desktop +x-scheme-handler/rtmp=qvm-open-in-dvm.desktop +x-scheme-handler/rtp=qvm-open-in-dvm.desktop +x-scheme-handler/rtsp=qvm-open-in-dvm.desktop +x-scheme-handler/vnd.libreoffice.cmis=qvm-open-in-dvm.desktop + +[Changed Applications] +application/clarisworks=qvm-open-in-dvm.desktop +application/csv=qvm-open-in-dvm.desktop +application/excel=qvm-open-in-dvm.desktop +application/macwriteii=qvm-open-in-dvm.desktop +application/mathml+xml=qvm-open-in-dvm.desktop +application/mpeg4-iod=qvm-open-in-dvm.desktop +application/mpeg4-muxcodetable=qvm-open-in-dvm.desktop +application/msexcel=qvm-open-in-dvm.desktop +application/mspowerpoint=qvm-open-in-dvm.desktop +application/msword=qvm-open-in-dvm.desktop +application/mxf=qvm-open-in-dvm.desktop +application/ogg=qvm-open-in-dvm.desktop +application/oxps=qvm-open-in-dvm.desktop +application/pdf=qvm-open-in-dvm.desktop +application/pkcs10=qvm-open-in-dvm.desktop +application/pkcs10+pem=qvm-open-in-dvm.desktop +application/pkcs12=qvm-open-in-dvm.desktop +application/pkcs12+pem=qvm-open-in-dvm.desktop +application/pkcs7-mime=qvm-open-in-dvm.desktop +application/pkcs7-mime+pem=qvm-open-in-dvm.desktop +application/pkcs8=qvm-open-in-dvm.desktop +application/pkcs8+pem=qvm-open-in-dvm.desktop +application/pkix-cert=qvm-open-in-dvm.desktop +application/pkix-cert+pem=qvm-open-in-dvm.desktop +application/pkix-crl=qvm-open-in-dvm.desktop +application/pkix-crl+pem=qvm-open-in-dvm.desktop +application/postscript=qvm-open-in-dvm.desktop +application/prs.plucker=qvm-open-in-dvm.desktop +application/ram=qvm-open-in-dvm.desktop +application/rdf+xml=qvm-open-in-dvm.desktop +application/rss+xml=qvm-open-in-dvm.desktop +application/rtf=qvm-open-in-dvm.desktop +application/sdp=qvm-open-in-dvm.desktop +application/tab-separated-values=qvm-open-in-dvm.desktop +application/vnd.apple.mpegurl=qvm-open-in-dvm.desktop +application/vnd.comicbook+zip=qvm-open-in-dvm.desktop +application/vnd.corel-draw=qvm-open-in-dvm.desktop +application/vnd.lotus-1-2-3=qvm-open-in-dvm.desktop +application/vnd.lotus-wordpro=qvm-open-in-dvm.desktop +application/vnd.mozilla.xul+xml=qvm-open-in-dvm.desktop +application/vnd.ms-asf=qvm-open-in-dvm.desktop +application/vnd.ms-excel=qvm-open-in-dvm.desktop +application/vnd.ms-excel.sheet.binary.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-excel.sheet.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-excel.template.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-powerpoint=qvm-open-in-dvm.desktop +application/vnd.ms-powerpoint.presentation.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-powerpoint.slideshow.macroEnabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-powerpoint.template.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-publisher=qvm-open-in-dvm.desktop +application/vnd.ms-word=qvm-open-in-dvm.desktop +application/vnd.ms-word.document.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-word.template.macroenabled.12=qvm-open-in-dvm.desktop +application/vnd.ms-works=qvm-open-in-dvm.desktop +application/vnd.ms-wpl=qvm-open-in-dvm.desktop +application/vnd.ms-xpsdocument=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.chart=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.chart-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.formula=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.formula-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.graphics=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.graphics-flat-xml=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.graphics-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.presentation=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.presentation-flat-xml=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.presentation-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.spreadsheet=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.spreadsheet-flat-xml=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.spreadsheet-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-flat-xml=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-master=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-master-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-template=qvm-open-in-dvm.desktop +application/vnd.oasis.opendocument.text-web=qvm-open-in-dvm.desktop +application/vnd.openofficeorg.extension=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.presentationml.presentation=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.presentationml.slide=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.presentationml.slideshow=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.presentationml.template=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.spreadsheetml.template=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.wordprocessingml.document=qvm-open-in-dvm.desktop +application/vnd.openxmlformats-officedocument.wordprocessingml.template=qvm-open-in-dvm.desktop +application/vnd.palm=qvm-open-in-dvm.desktop +application/vnd.rn-realmedia=qvm-open-in-dvm.desktop +application/vnd.rn-realmedia-vbr=qvm-open-in-dvm.desktop +application/vnd.stardivision.writer-global=qvm-open-in-dvm.desktop +application/vnd.sun.xml.calc=qvm-open-in-dvm.desktop +application/vnd.sun.xml.calc.template=qvm-open-in-dvm.desktop +application/vnd.sun.xml.draw=qvm-open-in-dvm.desktop +application/vnd.sun.xml.draw.template=qvm-open-in-dvm.desktop +application/vnd.sun.xml.impress=qvm-open-in-dvm.desktop +application/vnd.sun.xml.impress.template=qvm-open-in-dvm.desktop +application/vnd.sun.xml.math=qvm-open-in-dvm.desktop +application/vnd.sun.xml.writer=qvm-open-in-dvm.desktop +application/vnd.sun.xml.writer.global=qvm-open-in-dvm.desktop +application/vnd.sun.xml.writer.template=qvm-open-in-dvm.desktop +application/vnd.visio=qvm-open-in-dvm.desktop +application/vnd.wordperfect=qvm-open-in-dvm.desktop +application/wordperfect=qvm-open-in-dvm.desktop +application/x-123=qvm-open-in-dvm.desktop +application/x-abiword=qvm-open-in-dvm.desktop +application/x-aportisdoc=qvm-open-in-dvm.desktop +application/x-bzdvi=qvm-open-in-dvm.desktop +application/x-bzpdf=qvm-open-in-dvm.desktop +application/x-bzpostscript=qvm-open-in-dvm.desktop +application/x-cb7=qvm-open-in-dvm.desktop +application/x-cbr=qvm-open-in-dvm.desktop +application/x-cbz=qvm-open-in-dvm.desktop +application/x-cd-image=qvm-open-in-dvm.desktop +application/x-dbase=qvm-open-in-dvm.desktop +application/x-dbf=qvm-open-in-dvm.desktop +application/x-doc=qvm-open-in-dvm.desktop +application/x-dos_ms_excel=qvm-open-in-dvm.desktop +application/x-dvi=qvm-open-in-dvm.desktop +application/x-excel=qvm-open-in-dvm.desktop +application/x-ext-cb7=qvm-open-in-dvm.desktop +application/x-ext-cbr=qvm-open-in-dvm.desktop +application/x-ext-cbz=qvm-open-in-dvm.desktop +application/x-ext-djv=qvm-open-in-dvm.desktop +application/x-ext-djvu=qvm-open-in-dvm.desktop +application/x-ext-dvi=qvm-open-in-dvm.desktop +application/x-ext-eps=qvm-open-in-dvm.desktop +application/x-ext-pdf=qvm-open-in-dvm.desktop +application/x-ext-ps=qvm-open-in-dvm.desktop +application/x-extension-m4a=qvm-open-in-dvm.desktop +application/x-extension-mp4=qvm-open-in-dvm.desktop +application/x-extension-txt=qvm-open-in-dvm.desktop +application/x-fictionbook+xml=qvm-open-in-dvm.desktop +application/x-flac=qvm-open-in-dvm.desktop +application/x-flash-video=qvm-open-in-dvm.desktop +application/x-gnome-saved-search=qvm-open-in-dvm.desktop +application/x-gnucash=qvm-open-in-dvm.desktop +application/x-gzdvi=qvm-open-in-dvm.desktop +application/x-gzpdf=qvm-open-in-dvm.desktop +application/x-gzpostscript=qvm-open-in-dvm.desktop +application/x-hwp=qvm-open-in-dvm.desktop +application/x-iwork-keynote-sffkey=qvm-open-in-dvm.desktop +application/x-iwork-numbers-sffnumbers=qvm-open-in-dvm.desktop +application/x-iwork-pages-sffpages=qvm-open-in-dvm.desktop +application/x-keepass2=qvm-open-in-dvm.desktop +application/x-matroska=qvm-open-in-dvm.desktop +application/x-ms-excel=qvm-open-in-dvm.desktop +application/x-msexcel=qvm-open-in-dvm.desktop +application/x-mswrite=qvm-open-in-dvm.desktop +application/x-ogg=qvm-open-in-dvm.desktop +application/x-pagemaker=qvm-open-in-dvm.desktop +application/x-pem-file=qvm-open-in-dvm.desktop +application/x-pem-key=qvm-open-in-dvm.desktop +application/x-pkcs12=qvm-open-in-dvm.desktop +application/x-pkcs7-certificates=qvm-open-in-dvm.desktop +application/x-quattropro=qvm-open-in-dvm.desktop +application/x-quicktime-media-link=qvm-open-in-dvm.desktop +application/x-quicktimeplayer=qvm-open-in-dvm.desktop +application/x-shellscript=qvm-open-in-dvm.desktop +application/x-shockwave-flash=qvm-open-in-dvm.desktop +application/x-sony-bbeb=qvm-open-in-dvm.desktop +application/x-spkac=qvm-open-in-dvm.desktop +application/x-spkac+base64=qvm-open-in-dvm.desktop +application/x-t602=qvm-open-in-dvm.desktop +application/x-wpg=qvm-open-in-dvm.desktop +application/x-x509-ca-cert=qvm-open-in-dvm.desktop +application/x-x509-user-cert=qvm-open-in-dvm.desktop +application/x-xzpdf=qvm-open-in-dvm.desktop +application/xhtml+xml=qvm-open-in-dvm.desktop +application/xml=qvm-open-in-dvm.desktop +application/xspf+xml=qvm-open-in-dvm.desktop +audio/3gpp=qvm-open-in-dvm.desktop +audio/3gpp2=qvm-open-in-dvm.desktop +audio/AMR=qvm-open-in-dvm.desktop +audio/AMR-WB=qvm-open-in-dvm.desktop +audio/aac=qvm-open-in-dvm.desktop +audio/ac3=qvm-open-in-dvm.desktop +audio/basic=qvm-open-in-dvm.desktop +audio/dv=qvm-open-in-dvm.desktop +audio/eac3=qvm-open-in-dvm.desktop +audio/flac=qvm-open-in-dvm.desktop +audio/m4a=qvm-open-in-dvm.desktop +audio/midi=qvm-open-in-dvm.desktop +audio/mp1=qvm-open-in-dvm.desktop +audio/mp2=qvm-open-in-dvm.desktop +audio/mp3=qvm-open-in-dvm.desktop +audio/mp4=qvm-open-in-dvm.desktop +audio/mpeg=qvm-open-in-dvm.desktop +audio/mpegurl=qvm-open-in-dvm.desktop +audio/mpg=qvm-open-in-dvm.desktop +audio/ogg=qvm-open-in-dvm.desktop +audio/opus=qvm-open-in-dvm.desktop +audio/scpls=qvm-open-in-dvm.desktop +audio/vnd.dolby.heaac.1=qvm-open-in-dvm.desktop +audio/vnd.dolby.heaac.2=qvm-open-in-dvm.desktop +audio/vnd.dolby.mlp=qvm-open-in-dvm.desktop +audio/vnd.dts=qvm-open-in-dvm.desktop +audio/vnd.dts.hd=qvm-open-in-dvm.desktop +audio/vnd.rn-realaudio=qvm-open-in-dvm.desktop +audio/vorbis=qvm-open-in-dvm.desktop +audio/wav=qvm-open-in-dvm.desktop +audio/webm=qvm-open-in-dvm.desktop +audio/x-aac=qvm-open-in-dvm.desktop +audio/x-adpcm=qvm-open-in-dvm.desktop +audio/x-aiff=qvm-open-in-dvm.desktop +audio/x-ape=qvm-open-in-dvm.desktop +audio/x-flac=qvm-open-in-dvm.desktop +audio/x-gsm=qvm-open-in-dvm.desktop +audio/x-it=qvm-open-in-dvm.desktop +audio/x-m4a=qvm-open-in-dvm.desktop +audio/x-matroska=qvm-open-in-dvm.desktop +audio/x-mod=qvm-open-in-dvm.desktop +audio/x-mp1=qvm-open-in-dvm.desktop +audio/x-mp2=qvm-open-in-dvm.desktop +audio/x-mp3=qvm-open-in-dvm.desktop +audio/x-mpeg=qvm-open-in-dvm.desktop +audio/x-mpegurl=qvm-open-in-dvm.desktop +audio/x-mpg=qvm-open-in-dvm.desktop +audio/x-ms-asf=qvm-open-in-dvm.desktop +audio/x-ms-asx=qvm-open-in-dvm.desktop +audio/x-ms-wax=qvm-open-in-dvm.desktop +audio/x-ms-wma=qvm-open-in-dvm.desktop +audio/x-musepack=qvm-open-in-dvm.desktop +audio/x-pn-aiff=qvm-open-in-dvm.desktop +audio/x-pn-au=qvm-open-in-dvm.desktop +audio/x-pn-realaudio=qvm-open-in-dvm.desktop +audio/x-pn-realaudio-plugin=qvm-open-in-dvm.desktop +audio/x-pn-wav=qvm-open-in-dvm.desktop +audio/x-pn-windows-acm=qvm-open-in-dvm.desktop +audio/x-real-audio=qvm-open-in-dvm.desktop +audio/x-realaudio=qvm-open-in-dvm.desktop +audio/x-s3m=qvm-open-in-dvm.desktop +audio/x-scpls=qvm-open-in-dvm.desktop +audio/x-shorten=qvm-open-in-dvm.desktop +audio/x-speex=qvm-open-in-dvm.desktop +audio/x-tta=qvm-open-in-dvm.desktop +audio/x-vorbis=qvm-open-in-dvm.desktop +audio/x-vorbis+ogg=qvm-open-in-dvm.desktop +audio/x-wav=qvm-open-in-dvm.desktop +audio/x-wavpack=qvm-open-in-dvm.desktop +audio/x-xm=qvm-open-in-dvm.desktop +image/avs=qvm-open-in-dvm.desktop +image/bie=qvm-open-in-dvm.desktop +image/bmp=qvm-open-in-dvm.desktop +image/cmyk=qvm-open-in-dvm.desktop +image/dcx=qvm-open-in-dvm.desktop +image/eps=qvm-open-in-dvm.desktop +image/fax=qvm-open-in-dvm.desktop +image/fits=qvm-open-in-dvm.desktop +image/g3fax=qvm-open-in-dvm.desktop +image/gif=qvm-open-in-dvm.desktop +image/gray=qvm-open-in-dvm.desktop +image/jpeg=qvm-open-in-dvm.desktop +image/miff=qvm-open-in-dvm.desktop +image/mono=qvm-open-in-dvm.desktop +image/mtv=qvm-open-in-dvm.desktop +image/pcd=qvm-open-in-dvm.desktop +image/pcx=qvm-open-in-dvm.desktop +image/pdf=qvm-open-in-dvm.desktop +image/pict=qvm-open-in-dvm.desktop +image/pjpeg=qvm-open-in-dvm.desktop +image/png=qvm-open-in-dvm.desktop +image/ps=qvm-open-in-dvm.desktop +image/rad=qvm-open-in-dvm.desktop +image/rgba=qvm-open-in-dvm.desktop +image/rla=qvm-open-in-dvm.desktop +image/rle=qvm-open-in-dvm.desktop +image/sgi=qvm-open-in-dvm.desktop +image/sun-raster=qvm-open-in-dvm.desktop +image/svg+xml=qvm-open-in-dvm.desktop +image/targa=qvm-open-in-dvm.desktop +image/tiff=qvm-open-in-dvm.desktop +image/uyvy=qvm-open-in-dvm.desktop +image/vid=qvm-open-in-dvm.desktop +image/viff=qvm-open-in-dvm.desktop +image/vnd.djvu=qvm-open-in-dvm.desktop +image/vnd.djvu+multipage=qvm-open-in-dvm.desktop +image/vnd.rn-realpix=qvm-open-in-dvm.desktop +image/x-bzeps=qvm-open-in-dvm.desktop +image/x-compressed-xcf=qvm-open-in-dvm.desktop +image/x-eps=qvm-open-in-dvm.desktop +image/x-fits=qvm-open-in-dvm.desktop +image/x-freehand=qvm-open-in-dvm.desktop +image/x-gimp-gbr=qvm-open-in-dvm.desktop +image/x-gimp-gih=qvm-open-in-dvm.desktop +image/x-gimp-pat=qvm-open-in-dvm.desktop +image/x-gzeps=qvm-open-in-dvm.desktop +image/x-icon=qvm-open-in-dvm.desktop +image/x-ms-bmp=qvm-open-in-dvm.desktop +image/x-pcx=qvm-open-in-dvm.desktop +image/x-portable-anymap=qvm-open-in-dvm.desktop +image/x-portable-bitmap=qvm-open-in-dvm.desktop +image/x-portable-graymap=qvm-open-in-dvm.desktop +image/x-portable-pixmap=qvm-open-in-dvm.desktop +image/x-psd=qvm-open-in-dvm.desktop +image/x-psp=qvm-open-in-dvm.desktop +image/x-rgb=qvm-open-in-dvm.desktop +image/x-sgi=qvm-open-in-dvm.desktop +image/x-tga=qvm-open-in-dvm.desktop +image/x-wmf=qvm-open-in-dvm.desktop +image/x-xbitmap=qvm-open-in-dvm.desktop +image/x-xcf=qvm-open-in-dvm.desktop +image/x-xcursor=qvm-open-in-dvm.desktop +image/x-xpixmap=qvm-open-in-dvm.desktop +image/x-xwindowdump=qvm-open-in-dvm.desktop +image/yuv=qvm-open-in-dvm.desktop +inode/directory=qvm-open-in-dvm.desktop +message/rfc822=qvm-open-in-dvm.desktop +misc/ultravox=qvm-open-in-dvm.desktop +text/calendar=qvm-open-in-dvm.desktop +text/comma-separated-values=qvm-open-in-dvm.desktop +text/csv=qvm-open-in-dvm.desktop +text/english=qvm-open-in-dvm.desktop +text/google-video-pointer=qvm-open-in-dvm.desktop +text/html=qvm-open-in-dvm.desktop +text/mathml=qvm-open-in-dvm.desktop +text/plain=qvm-open-in-dvm.desktop +text/rtf=qvm-open-in-dvm.desktop +text/spreadsheet=qvm-open-in-dvm.desktop +text/tab-separated-values=qvm-open-in-dvm.desktop +text/x-c=qvm-open-in-dvm.desktop +text/x-c++=qvm-open-in-dvm.desktop +text/x-c++hdr=qvm-open-in-dvm.desktop +text/x-c++src=qvm-open-in-dvm.desktop +text/x-chdr=qvm-open-in-dvm.desktop +text/x-comma-separated-values=qvm-open-in-dvm.desktop +text/x-csrc=qvm-open-in-dvm.desktop +text/x-csv=qvm-open-in-dvm.desktop +text/x-google-video-pointer=qvm-open-in-dvm.desktop +text/x-java=qvm-open-in-dvm.desktop +text/x-makefile=qvm-open-in-dvm.desktop +text/x-moc=qvm-open-in-dvm.desktop +text/x-pascal=qvm-open-in-dvm.desktop +text/x-tcl=qvm-open-in-dvm.desktop +text/x-tex=qvm-open-in-dvm.desktop +text/x-vcard=qvm-open-in-dvm.desktop +text/xml=qvm-open-in-dvm.desktop +video/3gp=qvm-open-in-dvm.desktop +video/3gpp=qvm-open-in-dvm.desktop +video/3gpp2=qvm-open-in-dvm.desktop +video/avi=qvm-open-in-dvm.desktop +video/divx=qvm-open-in-dvm.desktop +video/dv=qvm-open-in-dvm.desktop +video/fli=qvm-open-in-dvm.desktop +video/flv=qvm-open-in-dvm.desktop +video/mp2t=qvm-open-in-dvm.desktop +video/mp4=qvm-open-in-dvm.desktop +video/mp4v-es=qvm-open-in-dvm.desktop +video/mpeg=qvm-open-in-dvm.desktop +video/mpeg-system=qvm-open-in-dvm.desktop +video/msvideo=qvm-open-in-dvm.desktop +video/ogg=qvm-open-in-dvm.desktop +video/quicktime=qvm-open-in-dvm.desktop +video/vnd.divx=qvm-open-in-dvm.desktop +video/vnd.mpegurl=qvm-open-in-dvm.desktop +video/vnd.rn-realvideo=qvm-open-in-dvm.desktop +video/webm=qvm-open-in-dvm.desktop +video/x-anim=qvm-open-in-dvm.desktop +video/x-avi=qvm-open-in-dvm.desktop +video/x-flc=qvm-open-in-dvm.desktop +video/x-fli=qvm-open-in-dvm.desktop +video/x-flv=qvm-open-in-dvm.desktop +video/x-m4v=qvm-open-in-dvm.desktop +video/x-matroska=qvm-open-in-dvm.desktop +video/x-mpeg=qvm-open-in-dvm.desktop +video/x-mpeg-system=qvm-open-in-dvm.desktop +video/x-mpeg2=qvm-open-in-dvm.desktop +video/x-ms-asf=qvm-open-in-dvm.desktop +video/x-ms-asf-plugin=qvm-open-in-dvm.desktop +video/x-ms-asx=qvm-open-in-dvm.desktop +video/x-ms-wm=qvm-open-in-dvm.desktop +video/x-ms-wmv=qvm-open-in-dvm.desktop +video/x-ms-wmx=qvm-open-in-dvm.desktop +video/x-ms-wvx=qvm-open-in-dvm.desktop +video/x-msvideo=qvm-open-in-dvm.desktop +video/x-nsv=qvm-open-in-dvm.desktop +video/x-ogm=qvm-open-in-dvm.desktop +video/x-ogm+ogg=qvm-open-in-dvm.desktop +video/x-theora=qvm-open-in-dvm.desktop +video/x-theora+ogg=qvm-open-in-dvm.desktop +x-content/audio-cdda=qvm-open-in-dvm.desktop +x-content/audio-player=qvm-open-in-dvm.desktop +x-content/unix-software=qvm-open-in-dvm.desktop +x-content/video-dvd=qvm-open-in-dvm.desktop +x-content/video-svcd=qvm-open-in-dvm.desktop +x-content/video-vcd=qvm-open-in-dvm.desktop +x-scheme-handler/ghelp=qvm-open-in-dvm.desktop +x-scheme-handler/help=qvm-open-in-dvm.desktop +x-scheme-handler/http=qvm-open-in-dvm.desktop +x-scheme-handler/https=qvm-open-in-dvm.desktop +x-scheme-handler/icy=qvm-open-in-dvm.desktop +x-scheme-handler/icyx=qvm-open-in-dvm.desktop +x-scheme-handler/info=qvm-open-in-dvm.desktop +x-scheme-handler/mailto=qvm-open-in-dvm.desktop +x-scheme-handler/man=qvm-open-in-dvm.desktop +x-scheme-handler/mms=qvm-open-in-dvm.desktop +x-scheme-handler/mmsh=qvm-open-in-dvm.desktop +x-scheme-handler/rtmp=qvm-open-in-dvm.desktop +x-scheme-handler/rtp=qvm-open-in-dvm.desktop +x-scheme-handler/rtsp=qvm-open-in-dvm.desktop +x-scheme-handler/vnd.libreoffice.cmis=qvm-open-in-dvm.desktop diff --git a/salt/media/init.top b/salt/media/init.top new file mode 100644 index 0000000..e2a0465 --- /dev/null +++ b/salt/media/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - media.create + 'tpl-media': + - media.install + 'media': + - media.configure diff --git a/salt/media/install.sls b/salt/media/install.sls new file mode 100644 index 0000000..6db6d41 --- /dev/null +++ b/salt/media/install.sls @@ -0,0 +1,50 @@ +{# +SPDX-FileCopyrightText: 2022 - 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - browser.install + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-app-shutdown-idle + - pulseaudio-qubes + - audacious + - calibre + - ffmpeg + - ffmpegthumbnailer + - gpicview + - mousepad + - mpv + - vlc + - xpdf + +"{{ slsdotpath }}-etc-mimeapps.list": + file.managed: + - name: /etc/xdg/mimeapps.list + - source: salt://{{ slsdotpath }}/files/browser/mimeapps.list + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-idle-trimleness": + file.replace: + - name: /usr/lib/python3/dist-packages/qubesidle/idleness_monitor.py + - pattern: '15 \* 60' + - repl: '3 * 60' + +{% endif -%} diff --git a/salt/media/install.top b/salt/media/install.top new file mode 100644 index 0000000..71c768c --- /dev/null +++ b/salt/media/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-media': + - media.install diff --git a/salt/mgmt/README.md b/salt/mgmt/README.md new file mode 100644 index 0000000..df80b6c --- /dev/null +++ b/salt/mgmt/README.md @@ -0,0 +1,39 @@ +# mgmt + +Management console environment in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +A Template for DispVMs will be created and named "dvm-mgmt" and become the +global "management_dispvm". It will be used when opening a disposable console +of a qube or for Salt Management on DomUs. + +## Installation + +- Top: +```sh +qubesctl top.enable mgmt +qubesctl --skip-dom0 --targets=tpl-mgmt state.apply +qubesctl top.disable mgmt +qubesctl state.apply mgmt.prefs +``` + +- State: + +```sh +qubesctl state.apply mgmt.create +qubesctl --skip-dom0 --targets=tpl-mgmt state.apply mgmt.install +qubesctl state.apply mgmt.prefs +``` + + +## Usage + +You will use the Template for DispVMs "dvm-mgmt" indirectly when running salt +states on minions/DomUs or when opening a disposable console of a qube. diff --git a/salt/mgmt/clone.sls b/salt/mgmt/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/mgmt/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/mgmt/clone.top b/salt/mgmt/clone.top new file mode 100644 index 0000000..e6a804c --- /dev/null +++ b/salt/mgmt/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - mgmt.clone diff --git a/salt/mgmt/create.sls b/salt/mgmt/create.sls new file mode 100644 index 0000000..d593194 --- /dev/null +++ b/salt/mgmt/create.sls @@ -0,0 +1,36 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +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: black +prefs: +- template: tpl-{{ slsdotpath }} +- label: black +- netvm: "" +- dispvm-allowed: True +- memory: 300 +- maxmem: 600 +- vcpus: 1 +- autostart: False +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm + - internal +{%- endload %} +{{ load(defaults) }} diff --git a/salt/mgmt/create.top b/salt/mgmt/create.top new file mode 100644 index 0000000..4c0fc42 --- /dev/null +++ b/salt/mgmt/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - mgmt.create diff --git a/salt/mgmt/init.top b/salt/mgmt/init.top new file mode 100644 index 0000000..c7694db --- /dev/null +++ b/salt/mgmt/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - mgmt.create + 'tpl-mgmt': + - mgmt.install diff --git a/salt/mgmt/install.sls b/salt/mgmt/install.sls new file mode 100644 index 0000000..a971769 --- /dev/null +++ b/salt/mgmt/install.sls @@ -0,0 +1,23 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-passwordless-root + - qubes-mgmt-salt-vm-connector + - socat + +{% endif -%} diff --git a/salt/mgmt/install.top b/salt/mgmt/install.top new file mode 100644 index 0000000..5ed61c2 --- /dev/null +++ b/salt/mgmt/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-mgmt': + - mgmt.install diff --git a/salt/mgmt/prefs.sls b/salt/mgmt/prefs.sls new file mode 100644 index 0000000..66bcf22 --- /dev/null +++ b/salt/mgmt/prefs.sls @@ -0,0 +1,15 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +"{{ slsdotpath }}-set-management_dispvm": + cmd.run: + - name: qubes-prefs management_dispvm dvm-{{ slsdotpath }} + +"{{ slsdotpath }}-remove-default-mgmt-dvm": + qvm.absent: + - name: default-mgmt-dvm + - require: + - cmd: {{ slsdotpath }}-set-management_dispvm diff --git a/salt/mgmt/prefs.top b/salt/mgmt/prefs.top new file mode 100644 index 0000000..f050a56 --- /dev/null +++ b/salt/mgmt/prefs.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - mgmt.prefs diff --git a/salt/mirage-builder/README.md b/salt/mirage-builder/README.md new file mode 100644 index 0000000..bda5aa3 --- /dev/null +++ b/salt/mirage-builder/README.md @@ -0,0 +1,51 @@ +# mirage-builder + +Mirage Builder environment in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Setup a builder qube for Mirage Unikernel named "mirage-builder". The tool +necessary to build Mirage with docker or directly with Opam will also be +installed. + +## Installation + +Mirage Firewall commits and tags are not signed by individuals, but as they +are done through the web interface, they have GitHub Web-Flow signature. This +is the best verification we can get for Mirage Firewall. If you don't trust +the hosting provider however, don't install this package. + +- Top +```sh +qubesctl top.enable mirage-builder +qubesctl --targets=tpl-mirage-builder,mirage-builder state.apply +qubesctl top.disable mirage-builder +``` + +- State + +```sh +qubesctl state.apply mirage-builder.create +qubesctl --skip-dom0 --targets=tpl-mirage-builder state.apply mirage-builder.install +qubesctl --skip-dom0 --targets=mirage-builder state.apply mirage-builder.configure +``` + + +## Usage + +The qube `mirage-builder` is intended to build Mirage Unikernel. Consult +upstream documentation on [how to build qubes-mirage-firewall from +source](https://github.com/mirage/qubes-mirage-firewall#build-from-source). + +If you plan to build without docker, the hooks and completion scripts are +already being sourced by your shell profile. Because of this, when calling +`opam-init`, use it together with the option `--no-setup`: +```sh +opam init --no-setup +``` diff --git a/salt/mirage-builder/clone.sls b/salt/mirage-builder/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/mirage-builder/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/mirage-builder/clone.top b/salt/mirage-builder/clone.top new file mode 100644 index 0000000..bf5d34a --- /dev/null +++ b/salt/mirage-builder/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - mirage-builder.clone diff --git a/salt/mirage-builder/configure.sls b/salt/mirage-builder/configure.sls new file mode 100644 index 0000000..3a2706c --- /dev/null +++ b/salt/mirage-builder/configure.sls @@ -0,0 +1,95 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +{% set mirage_firewall_tag = 'v0.8.6' -%} + +include: + - dev.home-cleanup + - dotfiles.copy-sh + - dotfiles.copy-ssh + - dotfiles.copy-git + - docker.configure + +"{{ slsdotpath }}-opam-completion-and-hooks": + file.managed: + - name: /home/user/.config/sh/profile.d/opam.sh + - source: salt://{{ slsdotpath }}/files/client/profile/opam.sh + - mode: '0755' + - user: user + - group: user + - makedirs: True + +"{{ slsdotpath }}-makedir-src": + file.directory: + - name: /home/user/src + - user: user + - group: user + - mode: '0755' + - makedirs: True + +"{{ slsdotpath }}-gnupg-home": + file.directory: + - name: /home/user/.gnupg/mirage-firewall + - user: user + - group: user + - mode: '0700' + - makedirs: True + +"{{ slsdotpath }}-keyring-and-trustdb": + file.managed: + - user: user + - group: user + - mode: '0600' + - names: + - /home/user/.gnupg/mirage-firewall/pubring.kbx: + - source: salt://{{ slsdotpath }}/files/client/keys/pubring.kbx + - /home/user/.gnupg/mirage-firewall/trustdb.gpg: + - source: salt://{{ slsdotpath }}/files/client/keys/trustdb.gpg + +"{{ slsdotpath }}-git-clone": + git.latest: + - name: https://github.com/mirage/qubes-mirage-firewall + - target: /home/user/src/qubes-mirage-firewall + - user: user + - force_fetch: True + +## The tag is annotated, using verify-commit instead. +"{{ slsdotpath }}-git-verify-tag": + cmd.run: + - require: + - git: "{{ slsdotpath }}-git-clone" + - name: GNUPGHOME="$HOME/.gnupg/mirage-firewall" git -c gpg.program=gpg2 verify-commit {{ mirage_firewall_tag }} + - cwd: /home/user/src/qubes-mirage-firewall + - runas: user + +"{{ slsdotpath }}-git-checkout-tag-{{ mirage_firewall_tag }}": + cmd.run: + - name: git checkout {{ mirage_firewall_tag }} + - require: + - cmd: "{{ slsdotpath }}-git-verify-tag" + - cwd: /home/user/src/qubes-mirage-firewall + - runas: user + +"{{ slsdotpath }}-makedir-home-docker": + file.directory: + - name: /home/user/docker + - user: user + - group: user + - mode: '0755' + - makedirs: True + +{% if salt['grains.get']('os_family') = 'RedHat' -%} +"{{ slsdotpath }}-file-security-context": + cmd.run: + - name: chcon -Rt container_file_t /home/user/docker + - require: + - file: "{{ slsdotpath }}-makedir-home-docker" + - runas: user +{% endif -%} + +{% endif -%} diff --git a/salt/mirage-builder/configure.top b/salt/mirage-builder/configure.top new file mode 100644 index 0000000..63f07f4 --- /dev/null +++ b/salt/mirage-builder/configure.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'mirage-builder': + - match: nodegroup + - mirage-builder.configure diff --git a/salt/mirage-builder/create.sls b/salt/mirage-builder/create.sls new file mode 100644 index 0000000..ed3438a --- /dev/null +++ b/salt/mirage-builder/create.sls @@ -0,0 +1,92 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: gray +prefs: +- template: tpl-{{ slsdotpath }} +- label: gray +- vcpus: 2 +- memory: 400 +- maxmem: 600 +- autostart: False +- include_in_backups: True +features: +- enable: + - service.split-gpg2-client +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% 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 +- vcpus: 2 +- memory: 400 +- maxmem: 600 +- autostart: False +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: disp-{{ slsdotpath }} +force: True +require: +- qvm: dvm-{{ slsdotpath }} +present: +- template: dvm-{{ slsdotpath }} +- label: red +- class: DispVM +prefs: +- template: dvm-{{ slsdotpath }} +- label: red +- vcpus: 2 +- memory: 400 +- maxmem: 600 +- autostart: False +- include_in_backups: False +features: +- disable: + - appmenus-dispvm + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-extend-volume": + cmd.run: + - name: qvm-volume extend {{ slsdotpath }}:private 10Gi + - require: + - qvm: {{ slsdotpath }} diff --git a/salt/mirage-builder/create.top b/salt/mirage-builder/create.top new file mode 100644 index 0000000..632492f --- /dev/null +++ b/salt/mirage-builder/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dev.create diff --git a/salt/mirage-builder/files/client/keys/5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23.asc b/salt/mirage-builder/files/client/keys/5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23.asc new file mode 100644 index 0000000..e7794c4 --- /dev/null +++ b/salt/mirage-builder/files/client/keys/5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23.asc @@ -0,0 +1,33 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +xsBNBFmUaEEBCACzXTDt6ZnyaVtueZASBzgnAmK13q9Urgch+sKYeIhdymjuMQta +x15OklctmrZtqre5kwPUosG3/B2/ikuPYElcHgGPL4uL5Em6S5C/oozfkYzhwRrT +SQzvYjsE4I34To4UdE9KA97wrQjGoz2Bx72WDLyWwctD3DKQtYeHXswXXtXwKfjQ +7Fy4+Bf5IPh76dA8NJ6UtjjLIDlKqdxLW4atHe6xWFaJ+XdLUtsAroZcXBeWDCPa +buXCDscJcLJRKZVc62gOZXXtPfoHqvUPp3nuLA4YjH9bphbrMWMf810Wxz9JTd3v +yWgGqNY0zbBqeZoGv+TuExlRHT8ASGFS9SVDABEBAAHNNUdpdEh1YiAod2ViLWZs +b3cgY29tbWl0IHNpZ25pbmcpIDxub3JlcGx5QGdpdGh1Yi5jb20+wsBiBBMBCAAW +BQJZlGhBCRBK7hj4Ov3rIwIbAwIZAQAAmQEIACATWFmi2oxlBh3wAsySNCNV4IPf +DDMeh6j80WT7cgoX7V7xqJOxrfrqPEthQ3hgHIm7b5MPQlUr2q+UPL22t/I+ESF6 +9b0QWLFSMJbMSk+BXkvSjH9q8jAO0986/pShPV5DU2sMxnx4LfLfHNhTzjXKokws ++8ptJ8uhMNIDXfXuzkZHIxoXk3rNcjDN5c5X+sK8UBRH092BIJWCOfaQt7v7wig5 +4Ra28pM9GbHKXVNxmdLpCFyzvyMuCmINYYADsC848QQFFwnd4EQnupo6QvhEVx1O +j7wDwvuH5dCrLuLwtwXaQh0onG4583p0LGms2Mf5F+Ick6o/4peOlBoZz48= +=HXDP +-----END PGP PUBLIC KEY BLOCK----------BEGIN PGP PUBLIC KEY BLOCK----- + +xsBNBFmUaEEBCACzXTDt6ZnyaVtueZASBzgnAmK13q9Urgch+sKYeIhdymjuMQta +x15OklctmrZtqre5kwPUosG3/B2/ikuPYElcHgGPL4uL5Em6S5C/oozfkYzhwRrT +SQzvYjsE4I34To4UdE9KA97wrQjGoz2Bx72WDLyWwctD3DKQtYeHXswXXtXwKfjQ +7Fy4+Bf5IPh76dA8NJ6UtjjLIDlKqdxLW4atHe6xWFaJ+XdLUtsAroZcXBeWDCPa +buXCDscJcLJRKZVc62gOZXXtPfoHqvUPp3nuLA4YjH9bphbrMWMf810Wxz9JTd3v +yWgGqNY0zbBqeZoGv+TuExlRHT8ASGFS9SVDABEBAAHNNUdpdEh1YiAod2ViLWZs +b3cgY29tbWl0IHNpZ25pbmcpIDxub3JlcGx5QGdpdGh1Yi5jb20+wsBiBBMBCAAW +BQJZlGhBCRBK7hj4Ov3rIwIbAwIZAQAAmQEIACATWFmi2oxlBh3wAsySNCNV4IPf +DDMeh6j80WT7cgoX7V7xqJOxrfrqPEthQ3hgHIm7b5MPQlUr2q+UPL22t/I+ESF6 +9b0QWLFSMJbMSk+BXkvSjH9q8jAO0986/pShPV5DU2sMxnx4LfLfHNhTzjXKokws ++8ptJ8uhMNIDXfXuzkZHIxoXk3rNcjDN5c5X+sK8UBRH092BIJWCOfaQt7v7wig5 +4Ra28pM9GbHKXVNxmdLpCFyzvyMuCmINYYADsC848QQFFwnd4EQnupo6QvhEVx1O +j7wDwvuH5dCrLuLwtwXaQh0onG4583p0LGms2Mf5F+Ick6o/4peOlBoZz48= +=HXDP +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/mirage-builder/files/client/keys/otrust.txt b/salt/mirage-builder/files/client/keys/otrust.txt new file mode 100644 index 0000000..28d9d10 --- /dev/null +++ b/salt/mirage-builder/files/client/keys/otrust.txt @@ -0,0 +1,3 @@ +# List of assigned trustvalues, created Thu 02 Nov 2023 09:43:48 PM UTC +# (Use "gpg --import-ownertrust" to restore them) +5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23:6: diff --git a/salt/mirage-builder/files/client/keys/pubring.kbx b/salt/mirage-builder/files/client/keys/pubring.kbx new file mode 100644 index 0000000..25df668 Binary files /dev/null and b/salt/mirage-builder/files/client/keys/pubring.kbx differ diff --git a/salt/mirage-builder/files/client/keys/trustdb.gpg b/salt/mirage-builder/files/client/keys/trustdb.gpg new file mode 100644 index 0000000..e08b410 Binary files /dev/null and b/salt/mirage-builder/files/client/keys/trustdb.gpg differ diff --git a/salt/mirage-builder/files/client/profile/opam.sh b/salt/mirage-builder/files/client/profile/opam.sh new file mode 100755 index 0000000..08dd78e --- /dev/null +++ b/salt/mirage-builder/files/client/profile/opam.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## +## SPDX-License-Identifier: AGPL-3.0-or-later + +# shellcheck disable=SC1091 +if test -n "${ZSH_VERSION-}" && test -r "$HOME/.opam/opam-init/init.zsh"; then + . "$HOME/.opam/opam-init/init.zsh" >/dev/null 2>&1 +elif test -r "$HOME/.opam/opam-init/init.sh"; then + . "$HOME/.opam/opam-init/init.sh" >/dev/null 2>&1 +fi diff --git a/salt/mirage-builder/init.top b/salt/mirage-builder/init.top new file mode 100644 index 0000000..9511c9f --- /dev/null +++ b/salt/mirage-builder/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - mirage-builder.create + 'tpl-mirage-builder': + - mirage-builder.install + 'mirage-builder': + - mirage-builder.configure diff --git a/salt/mirage-builder/install.sls b/salt/mirage-builder/install.sls new file mode 100644 index 0000000..f7a6dd8 --- /dev/null +++ b/salt/mirage-builder/install.sls @@ -0,0 +1,47 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dev.home-cleanup + - dotfiles.copy-sh + - dotfiles.copy-ssh + - dotfiles.copy-git + - sys-pgp.install-client + - sys-git.install-client + - sys-ssh-agent.install-client + - docker.install + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + ## https://github.com/mirage/qubes-mirage-firewall/blob/main/Dockerfile + - qubes-core-agent-passwordless-root + - qubes-core-agent-networking + - ca-certificates + - bash-completion + - man-db + - vim + - git + - patch + - unzip + - bzip2 + - make + - gcc + - g++ + - libc-dev-bin + - opam + - ocaml + +{% endif -%} diff --git a/salt/mirage-builder/install.top b/salt/mirage-builder/install.top new file mode 100644 index 0000000..7903a5d --- /dev/null +++ b/salt/mirage-builder/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-mirage-builder': + - mirage-builder.install diff --git a/salt/mutt/README.md b/salt/mutt/README.md new file mode 100644 index 0000000..01b5a0c --- /dev/null +++ b/salt/mutt/README.md @@ -0,0 +1,62 @@ +# mutt + +Mutt text-based mail client in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Create a mail client qube named "mutt" based on the program Mutt. + +## Installation + +- Top +```sh +qubesctl top.enable mutt +qubesctl --targets=tpl-mutt,mutt state.apply +qubesctl top.disable mutt +``` + +- State + +```sh +qubesctl state.apply mutt.create +qubesctl --skip-dom0 --targets=tpl-mutt state.apply mutt.install +qubesctl --skip-dom0 --targets=mutt state.apply mutt.configure +``` + + +## Usage + +You will use local files to override the ones provided by this package. Few +options must be set. + +The file `~/.muttrc-credentials.local` will set some variables that will be +used by other configuration files sourced later: +```muttrc +set pgp_default_key = "0x1234567890ABCDEF" +set pgp_sign_as = "0x1234567890ABCDEF" +set my_name = "Bilbo Baggins" +set my_user = "bilbo" +set my_server = "shire.org" +set my_pass = "mypassword" +``` + +You can define aliases in `~/.muttrc-aliases.local`. + +If you want to override any option, put the settings in `~/.muttrc.local`, +as this is the last file to be sourced. You might want to put for example, +subscribed lists in this file: +```muttrc +lists .*@googlegroups\\.com +subscribe qubes-(announce|devel)@googlegroups\\.com +fcc-save-hook qubes-announce@googlegroups\\.com =list/qubes-announce/ +fcc-save-hook qubes-devel@googlegroups\\.com =list/qubes-devel/ +``` + +If you want to have your e-mail signature (not PGP) at the end of every mail +you send, place it in `~/.signature`. diff --git a/salt/mutt/clone.sls b/salt/mutt/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/mutt/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/mutt/clone.top b/salt/mutt/clone.top new file mode 100644 index 0000000..e6a88fa --- /dev/null +++ b/salt/mutt/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - mutt.clone diff --git a/salt/mutt/configure.sls b/salt/mutt/configure.sls new file mode 100644 index 0000000..5ae8983 --- /dev/null +++ b/salt/mutt/configure.sls @@ -0,0 +1,15 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' %} + +include: + - dotfiles.copy-x11 + - dotfiles.copy-sh + - dotfiles.copy-net + - dotfiles.copy-mutt + +{% endif -%} diff --git a/salt/mutt/configure.top b/salt/mutt/configure.top new file mode 100644 index 0000000..85c787e --- /dev/null +++ b/salt/mutt/configure.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'mutt': + - match: nodegroup + - mutt.configure diff --git a/salt/mutt/create.sls b/salt/mutt/create.sls new file mode 100644 index 0000000..7652934 --- /dev/null +++ b/salt/mutt/create.sls @@ -0,0 +1,47 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: tpl-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +features: +- set: + - menu-items: "mutt.desktop qubes-run-terminal.desktop qubes-start.desktop" + - default-menu-items: "mutt.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: yellow +prefs: +- template: tpl-{{ slsdotpath }} +- label: yellow +- vcpus: 1 +- memory: 200 +- maxmem: 350 +- autostart: False +features: +- enable: + - service.shutdown-idle +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy +{%- endload %} +{{ load(defaults) }} diff --git a/salt/mutt/create.top b/salt/mutt/create.top new file mode 100644 index 0000000..13b9e6f --- /dev/null +++ b/salt/mutt/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - mutt.create diff --git a/salt/mutt/init.top b/salt/mutt/init.top new file mode 100644 index 0000000..1beae33 --- /dev/null +++ b/salt/mutt/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - mutt.create + 'tpl-mutt': + - mutt.install + 'mutt': + - mutt.configure diff --git a/salt/mutt/install.sls b/salt/mutt/install.sls new file mode 100644 index 0000000..6e21cd9 --- /dev/null +++ b/salt/mutt/install.sls @@ -0,0 +1,56 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' %} + +include: + - dotfiles.copy-x11 + - dotfiles.copy-sh + - dotfiles.copy-net + - dotfiles.copy-mutt + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - skip_suggestions: True + - install_recommends: False + - pkgs: + # general + - qubes-app-shutdown-idle + - qubes-core-agent-networking + - qubes-pdf-converter + - qubes-img-converter + - qubes-gpg-split + - w3m + - man-db + - less + # mutt + - vim + - mutt + - notmuch + - notmuch-mutt + - offlineimap3 + - mb2md + - ca-certificates + - libgnutls30 + - libio-socket-ssl-perl + - libnet-smtp-ssl-perl + - libnet-ssleay-perl + - libsasl2-2 + - libsasl2-modules + - libsasl2-modules-db + # git-email + - git-email + - libemail-valid-perl + - libmailtools-perl + - libauthen-sasl-perl + - libio-socket-ssl-perl + +{% endif -%} diff --git a/salt/mutt/install.top b/salt/mutt/install.top new file mode 100644 index 0000000..490adf5 --- /dev/null +++ b/salt/mutt/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-mutt': + - mutt.install diff --git a/salt/qubes-builder/README.md b/salt/qubes-builder/README.md new file mode 100644 index 0000000..b8767ed --- /dev/null +++ b/salt/qubes-builder/README.md @@ -0,0 +1,80 @@ +# qubes-builder + +Setup Qubes OS Builder V2 in Qubes OS itself. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Access Control](#access-control) +* [Usage](#usage) + +## Description + +Setup a Builder qube named "qubes-builder" and a disposable template for Qubes +Executor named "dvm-qubes-builder". It is possible to use any of the available +executors: docker, podman, qubes-executor. + +During installation, after cloning the qubes-builderv2 repository, signatures +will be verified and the installation will fail if the signatures couldn't be +verified. Packages necessary for split operations such as split-gpg2, spit-git +and split-ssh-agent will also be installed. + +## Installation + +The template is based on Fedora Minimal and not Debian Minimal due to the +Qubes Executor lacking some dependencies on Debian such as +[mock](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1025460). Even if the +builder qube was Debian based, the executor qube still needs to be a Fedora +template. + +A set of trusted keys is placed into the `qubes-builder` to be used to verify +the git repositories during this package installation. The split-gpg2 setup is +not used during installation as it can't restrict access to a certain set of +keys (GNUPGHOME) yet. Spit-gpg2 will be used for GPG operations transparently +when verifying and signing software, don't worry. + +- Top +```sh +qubesctl top.enable qubes-builder +qubesctl --targets=tpl-qubes-builder,dvm-qubes-builder,qubes-builder state.apply +qubesctl top.disable qubes-builder +``` + +- State + +```sh +qubesctl state.apply qubes-builder.create +qubesctl --skip-dom0 --targets=tpl-qubes-builder state.apply qubes-builder.install +qubesctl --skip-dom0 --targets=dvm-qubes-builder state.apply qubes-builder.configure-qubes-executor +qubesctl --skip-dom0 --targets=qubes-builder state.apply qubes-builder.configure +``` + + +## Access Control + +The policy is based on `qubes-builderv2/rpc/50-qubesbuilder.policy`. +Extra services added are `qubes.Gpg`, `qubes.Gpg2`, `qusal.GitInit`, +`qusal.GitFetch`, `qusal.GitPush`, `qusal.SshAgent`. + +Out of these services, if an argument `+qubes-builder` can be specified to +limit the scope, the action is `allowed`, else the action is to `ask`. + +## Usage + +The builder qube is named `qubes-builder.` + +When using the Qubes Executor, configure the builder.yml `dispvm` option to +either `dom0` or `dvm-qubes-builder`: +```yaml +executor: + type: qubes + options: + dispvm: "dom0" + #dispvm: "dvm-qubes-builder" +``` +Setting the Disposable VM to Dom0 works because it will use the +`default_dispvm` preference of `qubes-builder`, which is `dvm-qubes-builder`. + +There are no further modifications needed to comply with this package. Consult +upstream documentation on how to use the Qubes OS Builder. diff --git a/salt/qubes-builder/clone.sls b/salt/qubes-builder/clone.sls new file mode 100644 index 0000000..913eb86 --- /dev/null +++ b/salt/qubes-builder/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('fedora-minimal', sls_path) }} diff --git a/salt/qubes-builder/clone.top b/salt/qubes-builder/clone.top new file mode 100644 index 0000000..a1c6ac6 --- /dev/null +++ b/salt/qubes-builder/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - qubes-builder.clone diff --git a/salt/qubes-builder/configure-qubes-executor.sls b/salt/qubes-builder/configure-qubes-executor.sls new file mode 100644 index 0000000..a1855dd --- /dev/null +++ b/salt/qubes-builder/configure-qubes-executor.sls @@ -0,0 +1,46 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dotfiles.copy-net + - dotfiles.copy-sh + - dotfiles.copy-x11 + +"{{ slsdotpath }}-executor-rpc": + file.recurse: + - name: /usr/local/etc/qubes-rpc/ + - source: salt://{{ slsdotpath }}/files/server/rpc/ + - user: root + - group: root + - dir_mode: '0755' + - file_mode: '0755' + - makedirs: True + +"{{ slsdotpath }}-executor-makedir-binded-builder": + file.directory: + - name: /rw/bind-dirs/builder + - user: root + - group: root + - mode: '0755' + - makedirs: True + +"{{ slsdotpath }}-executor-bind-dirs": + file.managed: + - name: /rw/config/qubes-bind-dirs.d/builder.conf + - source: salt://{{ slsdotpath }}/files/server/builder.conf + - user: root + - group: root + - mode: '0644' + - makedirs: True + +"{{ slsdotpath }}-executor-rc.local": + file.append: + - name: /rw/config/rc.local + - text: "mount /builder -o dev,suid,remount" + +{% endif -%} diff --git a/salt/qubes-builder/configure-qubes-executor.top b/salt/qubes-builder/configure-qubes-executor.top new file mode 100644 index 0000000..0977462 --- /dev/null +++ b/salt/qubes-builder/configure-qubes-executor.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dvm-qubes-builder': + - qubes-builder.configure-qubes-executor diff --git a/salt/qubes-builder/configure.sls b/salt/qubes-builder/configure.sls new file mode 100644 index 0000000..8e4d6b2 --- /dev/null +++ b/salt/qubes-builder/configure.sls @@ -0,0 +1,104 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dotfiles.copy-git + - dotfiles.copy-net + - dotfiles.copy-pgp + - dotfiles.copy-sh + - dotfiles.copy-ssh + - dotfiles.copy-x11 + - docker.configure + +"{{ slsdotpath }}-gpg-split-domain": + file.managed: + - name: /rw/config/gpg-split-domain + - source: salt://{{ slsdotpath }}/files/client/gpg-split-domain + - mode: '0644' + - user: root + - group: root + +"{{ slsdotpath }}-rpmmacros": + file.managed: + - name: /home/user/.rpmmacros + - source: salt://{{ slsdotpath }}/files/client/rpmmacros + - mode: '0644' + - user: user + - group: user + +"{{ slsdotpath }}-makedir-src": + file.directory: + - name: /home/user/src + - user: user + - group: user + - mode: '0755' + - makedirs: True + +"{{ slsdotpath }}-git-clone-builderv2": + git.latest: + - name: https://github.com/QubesOS/qubes-builderv2.git + - target: /home/user/src/qubes-builderv2 + - user: user + +"{{ slsdotpath }}-git-clone-infrastructure-mirrors": + git.latest: + - name: https://github.com/QubesOS/qubes-infrastructure-mirrors.git + - target: /home/user/src/qubes-infrastructure-mirrors + - user: user + +"{{ slsdotpath }}-gnupg-home-for-builder": + file.directory: + - name: /home/user/.gnupg/qubes-builder + - user: user + - group: user + - mode: '0700' + +"{{ slsdotpath }}-keyring-and-trustdb": + file.managed: + - user: user + - group: user + - mode: '0600' + - names: + - /home/user/.gnupg/qubes-builder/pubring.kbx: + - source: salt://{{ slsdotpath }}/files/client/keys/pubring.kbx + - /home/user/.gnupg/qubes-builder/trustdb.gpg: + - source: salt://{{ slsdotpath }}/files/client/keys/trustdb.gpg + +"{{ slsdotpath }}-git-verify-HEAD-builderv2": + cmd.run: + - require: + - git: "{{ slsdotpath }}-git-clone-builderv2" + - name: GNUPGHOME="$HOME/.gnupg/qubes-builder" git -c gpg.program=gpg2 verify-commit "HEAD^{commit}" + - cwd: /home/user/src/qubes-builderv2 + - runas: user + +"{{ slsdotpath }}-git-verify-HEAD-infrastructure-mirrors": + cmd.run: + - require: + - git: "{{ slsdotpath }}-git-clone-infrastructure-mirrors" + - name: GNUPGHOME="$HOME/.gnupg/qubes-builder" git -c gpg.program=gpg2 verify-commit "HEAD^{commit}" + - cwd: /home/user/src/qubes-infrastructure-mirrors + - runas: user + +"{{ slsdotpath }}-build-infrastructure-mirrors": + cmd.run: + - require: + - cmd: "{{ slsdotpath }}-git-verify-HEAD-infrastructure-mirrors" + - name: sudo python3 setup.py build + - cwd: /home/user/src/qubes-infrastructure-mirrors + - runas: user + +"{{ slsdotpath }}-install-infrastructure-mirrors": + cmd.run: + - require: + - cmd: "{{ slsdotpath }}-build-infrastructure-mirrors" + - name: sudo python3 setup.py install + - cwd: /home/user/src/qubes-infrastructure-mirrors + - runas: user + +{% endif -%} diff --git a/salt/qubes-builder/configure.top b/salt/qubes-builder/configure.top new file mode 100644 index 0000000..aba4317 --- /dev/null +++ b/salt/qubes-builder/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'qubes-builder': + - qubes-builder.configure diff --git a/salt/qubes-builder/create.sls b/salt/qubes-builder/create.sls new file mode 100644 index 0000000..e2c1b54 --- /dev/null +++ b/salt/qubes-builder/create.sls @@ -0,0 +1,75 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +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 +- vcpus: 2 +- memory: 400 +- maxmem: 2000 +- autostart: False +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: gray +prefs: +- template: tpl-{{ slsdotpath }} +- label: gray +- memory: 800 +- maxmem: 8000 +- vcpus: 4 +- default_dispvm: dvm-{{ slsdotpath }} +features: +# - enable: +# - service.split-gpg2-client +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-extend-private-volume": + cmd.run: + - name: qvm-volume extend {{ slsdotpath }}:private 30Gi + - require: + - qvm: {{ slsdotpath }} + +"dvm-{{ slsdotpath }}-extend-private-volume": + cmd.run: + - name: qvm-volume extend dvm-{{ slsdotpath }}:private 30Gi + - require: + - qvm: dvm-{{ slsdotpath }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '70') }} diff --git a/salt/qubes-builder/create.top b/salt/qubes-builder/create.top new file mode 100644 index 0000000..24204b5 --- /dev/null +++ b/salt/qubes-builder/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - qubes-builder.create diff --git a/salt/qubes-builder/files/admin/policy/default.policy b/salt/qubes-builder/files/admin/policy/default.policy new file mode 100644 index 0000000..52f6bd7 --- /dev/null +++ b/salt/qubes-builder/files/admin/policy/default.policy @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qubes.Gpg2 * {{ sls_path }} @default ask target=sys-pgp +qubes.Gpg * {{ sls_path }} @default ask target=sys-pgp + +qusal.GitInit +qubes-builder {{ sls_path }} @default allow target=sys-git +qusal.GitFetch +qubes-builder {{ sls_path }} @default allow target=sys-git +qusal.GitPush +qubes-builder {{ sls_path }} @default ask target=sys-git + +qusal.SshAgent +qubes-builder {{ sls_path }} @default allow target=sys-ssh-agent +qusal.SshAgent +qubes-builder {{ sls_path }} @anyvm deny + +admin.vm.CreateDisposable * {{ sls_path }} dom0 allow +admin.vm.CreateDisposable * {{ sls_path }} dvm-qubes-builder allow target=dom0 +admin.vm.Start * {{ sls_path }} @tag:disp-created-by-{{ sls_path }} allow target=dom0 +admin.vm.Kill * {{ sls_path }} @tag:disp-created-by-{{ sls_path }} allow target=dom0 + +qubesbuilder.FileCopyIn * {{ sls_path }} @tag:disp-created-by-{{ sls_path }} allow +qubesbuilder.FileCopyOut * {{ sls_path }} @tag:disp-created-by-{{ sls_path }} allow + +qubes.WaitForSession * {{ sls_path }} @tag:disp-created-by-{{ sls_path }} allow +qubes.VMShell * {{ sls_path }} @tag:disp-created-by-{{ sls_path }} allow +## vim:ft=qrexecpolicy diff --git a/salt/qubes-builder/files/client/gpg-split-domain b/salt/qubes-builder/files/client/gpg-split-domain new file mode 100644 index 0000000..dea2381 --- /dev/null +++ b/salt/qubes-builder/files/client/gpg-split-domain @@ -0,0 +1 @@ +@default diff --git a/salt/qubes-builder/files/client/gpg-split-domain.license b/salt/qubes-builder/files/client/gpg-split-domain.license new file mode 100644 index 0000000..7fd1c84 --- /dev/null +++ b/salt/qubes-builder/files/client/gpg-split-domain.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/salt/qubes-builder/files/client/keys/0064428F455451B3EBE78A7F063938BA42CFA724.asc b/salt/qubes-builder/files/client/keys/0064428F455451B3EBE78A7F063938BA42CFA724.asc new file mode 100644 index 0000000..3c7b8cd --- /dev/null +++ b/salt/qubes-builder/files/client/keys/0064428F455451B3EBE78A7F063938BA42CFA724.asc @@ -0,0 +1,41 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFMWlQYBEADaQptkGvW41Nq7IjuiGYIkRpt6azFpigOJrUfTzgR7Nhs7CnD/ +lw/0L7Txs1UnVduq9qO321CvEvDksfNOoJTGY8iUZxRsk1Lwmgms0xvzLm6W/txq +mXsI0eTzN5bZ7h1MhvnWHg51J3qpN76qVcrCNbiMPfI3DrvNX4y/iDgH5DqyGr4W +0BiGHoaRfs4yGdgHTdDeo/uNXQ4lTjeeVQljUNJ4N8QY/4hPlMWq+xIGGq3xds3j +DBwF+GJbf3UyzGib2N5EzBiS+zh8/p67yG+Kv9dd2IFVvRLkdrC84ubQMyrkgzcD +z2YCFjdLyKgSD5iFnqfmh4IM8ASavCEfGT43uY2j2qVY0u597mNQsSOIS3TJyOEl +UUbTY+hGC5Ycc+Vrr66sG/MMlG5ixRxnzElxlDIjk553qNwjS95iIKfmUujgjjC+ +Tni/o6uHI9FhseJevVK85STUilkpcVZSBb6GUt0D4jMzEx/p8Z8TVa/S9iuJ+qX6 +fTvCKU3lZOuVoIjpvK97JIKz/h9zYr2Ni8WsHIRHNNn8/MnxqYJMGYEhA6tB2dcS +BosgK8LdomflSPwGWjlq4QFlCqHppm4mlUJ+LTsGbxC1CXH7vJLprow8cLWDfunL +WQW0jv1KSLvWtcnie+I5Dv9ELxTqLNcvrGUgIHcVEsT56/cNWKzY7zh3WwARAQAB +tFRNYXJlayBNYXJjenlrb3dza2ktR8OzcmVja2kgKFF1YmVzIE9TIHNpZ25pbmcg +a2V5KSA8bWFybWFyZWtAaW52aXNpYmxldGhpbmdzbGFiLmNvbT6JAjMEEAEKAB0W +IQRCfxH9D6pLCAEj8Bzd+ho+NoeUlAUCYaQgEQAKCRDd+ho+NoeUlClYEACV2MWC +Srw0R8QR8hc72JzoT21Szj0++4HESzd/CnROKJZKanif7mXkvJ7zDkT9FKQRptCt +5fVEDXSftkue2eJc1va7kC/XJPxn9VSA0lnqWXYi2Eg858okA1afwBRIZZ4Zq6A8 +8Qrvv6jlkHnv93KF03SsJiSGm7vgVN3PX+U3UEZ6SbR+OQMw+HNMjh5Zp2mwavcb +2zpn3CKd27/INF45SuvcN6auT4FHekNZUKk552IOg2SLTyUexcDTCICv2b061tMe +enJiv3jxtCLHyiJ5cdDEgUNaoHN7fnHcpycDU1u4HbmTkWPJmVHtFKzMRpBDfyFz +LRubGZIyQKbFCpOn36fpKvXni8vxeGDmy8VL/tC8yUpfhlVyd2bvoIv4VbwBD76S +dMxoSEJReeR+AdMQsbTAHN+Lh3vhU+5YY93MQAFuv8FXUFJLf1m1xQ1QGXBPzeFq +PzDX78Az0pIQWVGxaiFX5YgQcy3T7KjITtGXikZ8EfBA8QfLu3olcs6gwYYxMeIn +kK2A4yRCTtMakvAgmiU7MjszjI9i8OXfMmzeI7cP9FPk6yzpy8fTp03F1Wa5/Dhr +TxgDLrtyxFipAjGnYk0X12AmQYWkh6SDvD0V5x3eYe9Q1Ytth9XJRbjxGA9OtX+a +GBpepZfLuta9IwI7sHFL4ub88ph250qVPxNft4kCTgQTAQoAOBYhBABkQo9FVFGz +6+eKfwY5OLpCz6ckBQJhpDgrAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJ +EAY5OLpCz6ckPpIQAMK6/dzMBFJCJ2zcsIoHz6yIForJ8BEkruXIQQqdoiyrsIQH +7vBMOFAl9iN/eiovf8inHmJjoQNQz+9MngQVALW3vG6gvUf2+oz4T2axklafPv6v ++ygIfuxiISWISeOUN8skGksjPqmfs7xeJV5UjqLiXe1aZXT8VyepdOhrD5bArBsv +S7mhuLCUVGsJlf9YwySbO3JzZScpKNdeiQR9Ti1CaEFFTHBvEBT/8LQ655wuZgEo +LnG2SSyHa5jpQAY0J2mFInq3ic5TWnYUm6JBRDIcDPAeET/HM0VlKd4lCb1m5z8j +ZuT+umR4catAxT2ij1Der2MnTNbBoiyHosNP/IqUU6xm6tlngCy5dM8QX3Tux8S9 +Na9EskJFn1BvlTIvkBSPA0m8BrwbJpDYvIf63BXHfsMpwuS5zGN5paFRuQLNk1G7 +C2kJfn2ffHaXDo91+JyKoaHWztmKQueKeNrRVAa04gZUiNBb+DX8/496t3MRmvdg +sJU0cPFZJ4taUpr4zWP3fWJ1HZTWwkavVylrFKx6u/K+MBwjhuiXWpNkOdjbl6XW +f4RCI1tqmfXMq1LMxf5MHxt0Gk8onEmxBZDExLXHqIOZJtTtzqTx0Emt6jPJhxWU +hgufiq0TOGzd8Vgk87eEoh07Xkj2o7RXGfLtILi+UNcL5l+8V5FGKjymWvU0 +=m4dS +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/qubes-builder/files/client/keys/274E12AB03F2FE293765FC06DA0434BC706E1FCF.asc b/salt/qubes-builder/files/client/keys/274E12AB03F2FE293765FC06DA0434BC706E1FCF.asc new file mode 100644 index 0000000..4023480 --- /dev/null +++ b/salt/qubes-builder/files/client/keys/274E12AB03F2FE293765FC06DA0434BC706E1FCF.asc @@ -0,0 +1,41 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFvfu2EBEAC2pl3r7QWoFr4LTTXVe73u+UlQTCvJ+LZATSl1xATJZUVEXzaG +75WXY2AsfKd/JRHGY/mrdpBC9SF9mkSIGw7Sjr1jiDcn9kunOeGfjz9Bc4mfet7k +UDnbyJGQQ8WirLfJDsQ9zMlN0F3vLymV+dFqf4OVyS1hh/9WBC3Wy5UWe9PGw9TW +iqWr4EudzKgjwBcFWY9rxAuWPGLclBLUZrHOlLDz+4qX/xijKFQfhCLTQlk0LVLP +JSFroxAZSmsQzyxSB9vajDSV4thesAcafgiluwTRbKu/ySYdde+xK54AslmE7vx7 +ZucwtizJvKkdZPX8Ogv+4Kbai9DdBap5nPW4p4nzDaQr/GdSHZJNfAr36mF+ZGew +FIeKrot1uUnGhb92AEHSMacNrqrF8COuUxMWcjUHMD/PYFqywagMz7FIjz1H+3yS +N08mGrJSnxQRE8PVd+ipqsrA3bi4y9OI5Wzl0obMLOL0ZZOcbpLfP1faV4US/hqj +Kg59NH26h89z97mGv/iMGmGOZ5mGPHEKwZX2TEHxMnXNsi/eQzQ2oDSX0i4w8jFN +oQ7+cHl+8YGEvAWvJ0kahx7pERnQkUdJ7zGF5u3fhsX8S1VwqrmgWlNPHFLz+647 +SNJ5vRnnH7hU1I3+mkXIhjXf3Kh/scP4HQy9riqZoG9Reymq3h7vaU2HawARAQAB +tEJTaW1vbiBHYWlzZXIgKFF1YmVzIE9TIHNpZ25pbmcga2V5KSA8c2ltb25AaW52 +aXNpYmxldGhpbmdzbGFiLmNvbT6JAk4EEwEKADgWIQQnThKrA/L+KTdl/AbaBDS8 +cG4fzwUCW9+7YQIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRDaBDS8cG4f +z5+xD/4nnCwjvvjdX25sBtBkEv/Hzbnfr2lzNkimiQJuIC4Jj8KepYoWUz26sZJ2 +HFnabfA7Cqs/SudQNWqznLb58FYcQUr65skDJ69XrVcSbOOCs5/WjaCL3fQDbUKy +WxvLDjXc22X6H8/93RBNEyC4QbkA0JNq7ekMT45B3buhINo661iZZUFTVzO063cO +3JEgN5aW0e4YCvWA2LfuCzb3TI6/Z2i4WGKaGiOxR+h2XYO4glkgxLrbGTWdxzbi +Ltvv0dpGzgqwPWh3JNmw8YIvR6KuDKsPCaW2uZe+MlZ7ExkWo3j7i0c7V/SQ0JUB +nysiPWfZUEKQMZSIehx2tWQve+i87Q4I129yP7FA9RANpDfptXrzioQf+UIOusfB +0tLu5wPKTlb7s5muGzlUuMZIeYCLuu82KXthz0AsNYmQ+H9nJhC3w1QsbVRCo28Z +zHGsMWEYWOOzRVzlW4uRtXRJcgetdPUcN/Lsvbnxt94b9hUVrhPrvSXE2xIai/Dk +03qEmTYSUCtOnw2Z8Gu131ZFDChOwzmUhej45U9mBQ8PGOPVzalXqITfYhyHza1I +oEjbTvz54RnBj2zPD/e96ES844ONFE50zx6OY1+H2/1jrHZULVGhWLV+xNaBEDQ0 +y1o7IMqqLRLK3vezT2QEyPgmMkFL6XRKjBqjATGFXgp7E6R5SokCMwQQAQgAHRYh +BEJ/Ef0PqksIASPwHN36Gj42h5SUBQJb/IWQAAoJEN36Gj42h5SUnO4QALAl6KIG +1+BQm30o5RlTFLjiS0obvLKYZd0zTXOJBt4iXIpSrzzn+xavn7W+EzIbr9txQoc6 +8TlJSYtSI01MmG5SU4jkzFG8//xmAG3kIP5S5Ufl3zRfVse2ZfMV44/ZACH7+AUz +mbDKiV93xHLaHdS+wA0oq1qbex0R7SiCGtOjNWgmz1luwNcNqUiZmfDKGwhDhlTy +ezUo1caBzQ8qssQax4VB821sLuOkR9BPT7h5qtS1q9iowDxQa1kSbVUMl4s3A6SC +t8+mHn7Vt29GF2SU+KJ8xLc1MQHsffm1lVbCV56Hyf7oExs4T3KVB4bljLJ0Gfxr +bSV/gJgfNjBXuF2xN6OlW9TbJnQ1mw61uWAEScaln98chq0J9DB0L51yXvx6CX9L +cQo89CTNPF4g51i90RKVmtIis+Uk74nCRl/6EpOlVcH8kAOZl4I4JZjzkdwd7CbY +V3AuG6TwpeOaigD+PAB2cybn0c76q6+bDLBAJyzHo659064OPVcpXcTLq0amqwn/ +sZQDIOb7ffEH/qgBj9StAvxNQP8DEUBzTQT54D+MzoVrVYdZYQNc1ptJMfyHGMjB +fIbbB5HhS51us3zmwneS8EcDSesrmXw4VEelQBOcBlHOyA0rbcmDWB2zkCiOLHlp +xFPgjhWdH1dbFuQlwvYW+7ondPKiTCfv08B+ +=VFNe +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/qubes-builder/files/client/keys/427F11FD0FAA4B080123F01CDDFA1A3E36879494.asc b/salt/qubes-builder/files/client/keys/427F11FD0FAA4B080123F01CDDFA1A3E36879494.asc new file mode 100644 index 0000000..4ef3b26 --- /dev/null +++ b/salt/qubes-builder/files/client/keys/427F11FD0FAA4B080123F01CDDFA1A3E36879494.asc @@ -0,0 +1,28 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBEu0kPkBEADHOaL53AVx8ECt+vsTFpNv/oyDXXs8dNmMsQhaCQ7BxTu95QKD +j5S0TiFoXegBwE8YhRg/8sBHOUbmdD1iQHxJSlJc8NYJkctq4KjiyeshquT1mIYx +wTGSuagX2PbM+Sv6Cuyo/DyhmzIH5dssFH25qnQ/RwednxWMG9qBW2JujDdwlMjB +1p6u5lzkwECO0Kk8w7rvSMJwPo2FPTpSTcdN7+Yc1i7WEv1fOpNYBfEn76Eck3LP +dndceRxnErvkEH7K95R1wEOqXxOEjE3BoUqh7q40GDW6bBMV5EauLBgMX4DQRIDE +uU0NW5Kk29/8RZaZrRXmpVmof1dMYVBWu4wM+Khm3IZ30pUR188jZz+eUhPDieJL +lN3iRKikSv7Rm9SETmwvvVOpP+RfkfaS6XGu3XfSv1diLy00p6Eh9J6LsfiCRuCI +svADNHsyFxJkIwEGVkUgvPFCRDY73LQuV5Bt5gutPFVnVS5nM9pwQEBFAha8wB5N +L+0fq47a1NJFbmKQ5PzOom3qQjee/3ic4wPcf9YtmLOdxukIEXvrGtcMt2kQHC9a +YypW/AYQB/TxpLP/aXSHiO9bR4hA4au26d6ytsgCZpPVQ5WchYetTVXfcjv6mbCS +g/QFYx1Ss/lZ2Uao/w7eYdAlvvJ1JBYotuMLuiONReRHGY5I94H8RRju8wARAQAB +tBhRdWJlcyBNYXN0ZXIgU2lnbmluZyBLZXmJAk4EEwEKADgWIQRCfxH9D6pLCAEj +8Bzd+ho+NoeUlAUCYaQgOwIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRDd ++ho+NoeUlG44D/0cnbkcqw9DYnYGua0h2EnbRySmHcfrd3E+oqcOO2deVCstc7hk +FQM5jp9vLeOUm/5gfHCJbmYe5qwMUayYBl8VtpS3Kl0/i4rFKmvlYGHfeNjEGJc7 +ezTvK+0R5lUFFLHRbaGnVq54ZuSGmnzj/Wnddm63LNkRcF3GYfg3qEDtsvwo61ST +dY91/9tKkpoyt5YI+iRdC0HpvmuWSqFPbbjFmy/G3XQJNwa7sjhxI/Ox7xdwxhUh +jOb6bpX9kzXSobwpsth0BwIccTcPq3lAAjPdiUBxiqK3QmxrHA1fXf1dZA4W48Is +h/NEFMkEZnD9jpL+g9oBqEOIdTfDh493S6hnM09gx62Pm5m77U8+3D0SRwBbq8Cc +BrjkVMOs3QkruJOJkv7y1JI/zxqiKt60NDOEjB78pvCok6/Yk+mpsrHluQ+tPLKM +8svMPAm/Vxlp7XMC5Y8lIf4fHjnrKzI+rPy4Ra55OHximZo7I4hd4K+EeR/uRpnb +NPrtuemvs8QdmJ6Tv3Ec3q1DM6vurA+jyBDGNeWU5l+U4RVo6weI0h0S9JUjtpd0 +i3cj6z70nvDO2vinlbfuM5J9AIQ88Ul2/8/xLaP+KFqnGK6vpSsoU9c+PBE4Co6R +dlWX4ukIWsp9LG4hoo+wuBAbxALaoUtULunZ1YMr8C3VLg0T0nPE8FxZHw== +=wUgj +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/qubes-builder/files/client/keys/9FA64B92F95E706BF28E2CA6484010B5CDC576E2.asc b/salt/qubes-builder/files/client/keys/9FA64B92F95E706BF28E2CA6484010B5CDC576E2.asc new file mode 100644 index 0000000..bd31645 --- /dev/null +++ b/salt/qubes-builder/files/client/keys/9FA64B92F95E706BF28E2CA6484010B5CDC576E2.asc @@ -0,0 +1,54 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Comment: 9FA6 4B92 F95E 706B F28E 2CA6 4840 10B5 CDC5 76E2 +Comment: Frédéric Pierret (fepitre) +# +# SPDX-License-Identifier: GPL-2.0-only + +%__gpg /usr/bin/qubes-gpg-client-wrapper + +%__gpg_check_password_cmd %{__gpg} \ + gpg --batch --no-verbose -u "%{_gpg_name}" -s + +%__gpg_sign_cmd /bin/sh sh -c '/usr/bin/qubes-gpg-client-wrapper \\\ + --batch --no-verbose \\\ + %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}} \\\ + -u "%{_gpg_name}" \\\ + -sb %{__plaintext_filename} \\\ + >%{__signature_filename}' diff --git a/salt/qubes-builder/files/server/builder.conf b/salt/qubes-builder/files/server/builder.conf new file mode 100644 index 0000000..8f3ddca --- /dev/null +++ b/salt/qubes-builder/files/server/builder.conf @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2023 The Qubes OS Project +# +# SPDX-License-Identifier: GPL-2.0-only + +binds+=('/builder') + +# vim: ft=bash diff --git a/salt/qubes-builder/files/server/rc.local b/salt/qubes-builder/files/server/rc.local new file mode 100644 index 0000000..b585b34 --- /dev/null +++ b/salt/qubes-builder/files/server/rc.local @@ -0,0 +1 @@ +mount /builder -o dev,suid,remount diff --git a/salt/qubes-builder/files/server/rpc/qubesbuilder.FileCopyIn b/salt/qubes-builder/files/server/rpc/qubesbuilder.FileCopyIn new file mode 100755 index 0000000..8fbab7b --- /dev/null +++ b/salt/qubes-builder/files/server/rpc/qubesbuilder.FileCopyIn @@ -0,0 +1,11 @@ +#!/usr/bin/bash + +# SPDX-FileCopyrightText: 2022 - 2023 The Qubes OS Project +# +# SPDX-License-Identifier: GPL-2.0-only + +set -e + +sudo bash -c "mkdir -p /builder/incoming && chown -R user:user /builder" +id="$(id -u user)" +exec /usr/lib/qubes/qfile-unpacker "${id}" "/builder/incoming" diff --git a/salt/qubes-builder/files/server/rpc/qubesbuilder.FileCopyOut b/salt/qubes-builder/files/server/rpc/qubesbuilder.FileCopyOut new file mode 100755 index 0000000..4fcf2ba --- /dev/null +++ b/salt/qubes-builder/files/server/rpc/qubesbuilder.FileCopyOut @@ -0,0 +1,9 @@ +#!/usr/bin/bash + +# SPDX-FileCopyrightText: 2022 - 2023 The Qubes OS Project +# +# SPDX-License-Identifier: GPL-2.0-only + +path="${1//__/\//}" + +exec /usr/lib/qubes/qfile-agent "$path" diff --git a/salt/qubes-builder/init.sls b/salt/qubes-builder/init.sls new file mode 100644 index 0000000..2a7887f --- /dev/null +++ b/salt/qubes-builder/init.sls @@ -0,0 +1,16 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: +{% if grains['id'] == 'dom0' -%} + - .create +{% elif grains['id'] == 'tpl-' ~ slsdotpath -%} + - .install +{% elif grains['id'] == 'dvm-' ~ slsdotpath -%} + - .configure-qubes-executor +{% elif grains['id'] == slsdotpath -%} + - .configure +{% endif -%} diff --git a/salt/qubes-builder/init.top b/salt/qubes-builder/init.top new file mode 100644 index 0000000..3866ba0 --- /dev/null +++ b/salt/qubes-builder/init.top @@ -0,0 +1,16 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - qubes-builder.create + 'tpl-qubes-builder': + - qubes-builder.install + 'dvm-qubes-builder': + - qubes-builder.configure-qubes-executor + 'qubes-builder': + - qubes-builder.configure diff --git a/salt/qubes-builder/install-qubes-executor.sls b/salt/qubes-builder/install-qubes-executor.sls new file mode 100644 index 0000000..e13fd9a --- /dev/null +++ b/salt/qubes-builder/install-qubes-executor.sls @@ -0,0 +1,39 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated-qubes-executor": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-qubes-executor": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - dnf-plugins-core + - createrepo_c + - debootstrap + - devscripts + - dpkg-dev + - git + - mock + - pbuilder + - which + - perl-Digest-MD5 + - perl-Digest-SHA + - python3-pyyaml + - python3-sh + - rpm-build + - rpmdevtools + - wget + - python3-debian + - reprepro + - systemd-udev + +{% endif -%} diff --git a/salt/qubes-builder/install-qubes-executor.top b/salt/qubes-builder/install-qubes-executor.top new file mode 100644 index 0000000..e554a5f --- /dev/null +++ b/salt/qubes-builder/install-qubes-executor.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-qubes-builder': + - qubes-builder.install-qubes-executor diff --git a/salt/qubes-builder/install.sls b/salt/qubes-builder/install.sls new file mode 100644 index 0000000..b565bb6 --- /dev/null +++ b/salt/qubes-builder/install.sls @@ -0,0 +1,65 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dotfiles.copy-git + - dotfiles.copy-net + - dotfiles.copy-pgp + - dotfiles.copy-sh + - dotfiles.copy-ssh + - dotfiles.copy-x11 + - sys-git.install-client + - sys-pgp.install-client + - sys-ssh-agent.install-client + - docker.install + - .install-qubes-executor + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + ## Goodies + - rpmautospec + - rpmlint + - vim-enhanced + ## Minimal template dependencies + - qubes-core-agent-networking + - qubes-core-agent-passwordless-root + ## Undocumented Infraestructure Mirrors dependencies + - python3-lxml + ## Undocumented Builder dependencies + - python3-click + ## Dependencies: https://github.com/QubesOS/qubes-builderv2#dependencies + - asciidoc + - createrepo_c + - devscripts + - m4 + - mktorrent + - mock + - openssl + - pacman + - podman + - python3-docker + - python3-jinja2-cli + - python3-packaging + - python3-pathspec + - python3-podman + - python3-pyyaml + - reprepro + - rpm + - rpm-sign + - rsync + - tree + +{% endif -%} diff --git a/salt/qubes-builder/install.top b/salt/qubes-builder/install.top new file mode 100644 index 0000000..6b3307f --- /dev/null +++ b/salt/qubes-builder/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-qubes-builder': + - qubes-builder.install diff --git a/salt/reader/README.md b/salt/reader/README.md new file mode 100644 index 0000000..7dd96b1 --- /dev/null +++ b/salt/reader/README.md @@ -0,0 +1,46 @@ +# reader + +Reader environment as the default_dispvm in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) +* [Credits](#credits) + +## Description + +Create a disposable template for reading documents and viewing images called +"dvm-reader". It is designated to be the "default_dispvm", because of this, +there is no "netvm", but if you assign one, you will get networking as the +necessary packages will be installed in the template. + +## Installation + +- Top: +```sh +qubesctl top.enable reader +qubesctl --targets=tpl-reader state.apply +qubesctl top.disable reader +``` + +- State: + +```sh +qubesctl state.apply reader.create +qubesctl --skip-dom0 --targets=tpl-reader state.apply reader.install +``` + + +## Usage + +The intended usage of this qube is a receiver of incoming files that the call +originator/client did no trust to open in its environment. When you run +`qvm-open-in-dvm` from a qube and it is using the global preferences default +`default_dispvm`, it will open the file to be read in a disposable based on +`dvm-reader`. + +## Credits + +- [Unman](https://github.com/unman/shaker/tree/main/reader) diff --git a/salt/reader/clone.sls b/salt/reader/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/reader/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/reader/clone.top b/salt/reader/clone.top new file mode 100644 index 0000000..f85ab41 --- /dev/null +++ b/salt/reader/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - reader.clone diff --git a/salt/reader/create.sls b/salt/reader/create.sls new file mode 100644 index 0000000..ea9ed1f --- /dev/null +++ b/salt/reader/create.sls @@ -0,0 +1,57 @@ +{# +SPDX-FileCopyrightText: 2022 - 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: tpl-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +prefs: +- memory: 300 +- maxmem: 2000 +features: +- set: + - default-menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop libreoffice-base.desktop libreoffice-calc.desktop libreoffice-draw.desktop libreoffice-impress.desktop libreoffice-math.desktop libreoffice-startcenter.desktop libreoffice-writer.desktop org.gnome.Evince.desktop qubes-open-file-manager.desktop" # noqa: 204 + - menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop libreoffice-base.desktop libreoffice-calc.desktop libreoffice-draw.desktop libreoffice-impress.desktop libreoffice-math.desktop libreoffice-startcenter.desktop libreoffice-writer.desktop org.gnome.Evince.desktop qubes-open-file-manager.desktop" # noqa: 204 +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: dvm-{{ slsdotpath }} +force: True +require: +- qvm: tpl-{{ slsdotpath }} +present: +- template: tpl-{{ slsdotpath }} +- label: red +prefs: +- template: tpl-{{ slsdotpath }} +- label: red +- netvm: "" +- memory: 400 +- maxmem: 700 +- vcpus: 1 +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- set: + - menu-items: "qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-set-default_dispvm": + cmd.run: + - name: qubes-prefs default_dispvm dvm-{{ slsdotpath }} + - require: + - qvm: dvm-{{ slsdotpath }} diff --git a/salt/reader/create.top b/salt/reader/create.top new file mode 100644 index 0000000..a67f1d3 --- /dev/null +++ b/salt/reader/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - reader.create diff --git a/salt/reader/init.top b/salt/reader/init.top new file mode 100644 index 0000000..433d3e1 --- /dev/null +++ b/salt/reader/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - reader.create + 'tpl-reader': + - reader.install diff --git a/salt/reader/install.sls b/salt/reader/install.sls new file mode 100644 index 0000000..7902abc --- /dev/null +++ b/salt/reader/install.sls @@ -0,0 +1,29 @@ +{# +SPDX-FileCopyrightText: 2022 - 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - browser.install + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - libreoffice + - antiword + - evince + - python3-pdfminer + - vim + +{% endif -%} diff --git a/salt/reader/install.top b/salt/reader/install.top new file mode 100644 index 0000000..ea0dae3 --- /dev/null +++ b/salt/reader/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-reader': + - reader.install diff --git a/salt/remmina/README.md b/salt/remmina/README.md new file mode 100644 index 0000000..78b45c5 --- /dev/null +++ b/salt/remmina/README.md @@ -0,0 +1,42 @@ +# remmina + +Remmina Remote Desktop Client in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Creates a disposable template named "dvm-remmina". From it, you can create +disposables for Remmina usage for SSH, VNC, SPICE, HTTP(S), X2Go and more. If +you prefer to use an app qube, a qube named "remmina" will also be created. + +## Installation + +- Top: +```sh +qubesctl top.enable remmina +qubesctl --targets=tpl-remmina state.apply +qubesctl top.disable remmina +qubesctl state.apply remmina.appmenus +``` + +- State: + +```sh +qubesctl state.apply remmina.create +qubesctl --skip-dom0 --targets=tpl-remmina state.apply remmina.install +qubesctl state.apply remmina.appmenus +``` + + +## Usage + +You will use Remmina to access remote computers, be it though a login shell +(SSH) or through a desktop connection (VNC, SPICE, HTTP, X2Go). + +You can base your qubes of `dvm-remmina` for disposables or `remmina` for +persistence of data. diff --git a/salt/remmina/appmenus.sls b/salt/remmina/appmenus.sls new file mode 100644 index 0000000..a84a247 --- /dev/null +++ b/salt/remmina/appmenus.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus('tpl-' ~ sls_path) }} diff --git a/salt/remmina/appmenus.top b/salt/remmina/appmenus.top new file mode 100644 index 0000000..a62828d --- /dev/null +++ b/salt/remmina/appmenus.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - remmina.appmenus diff --git a/salt/remmina/clone.sls b/salt/remmina/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/remmina/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/remmina/clone.top b/salt/remmina/clone.top new file mode 100644 index 0000000..844d6f7 --- /dev/null +++ b/salt/remmina/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - remmina.clone diff --git a/salt/remmina/create.sls b/salt/remmina/create.sls new file mode 100644 index 0000000..71d1208 --- /dev/null +++ b/salt/remmina/create.sls @@ -0,0 +1,70 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: tpl-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +features: +- set: + - default-menu-items: "qubes-run-terminal.desktop qubes-start.desktop org.remmina.Remmina.desktop" + - menu-items: "qubes-run-terminal.desktop qubes-start.desktop org.remmina.Remmina.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: dvm-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: orange +prefs: +- template: tpl-{{ slsdotpath }} +- label: orange +- memory: 300 +- maxmem: 600 +- vcpus: 1 +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- set: + - menu-items: "qubes-run-terminal.desktop qubes-start.desktop org.remmina.Remmina.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: orange +prefs: +- template: tpl-{{ slsdotpath }} +- label: orange +- memory: 300 +- maxmem: 600 +- vcpus: 1 +- include_in_backups: False +features: +- disable: + - service.cups + - service.cups-browsed +- set: + - menu-items: "qubes-run-terminal.desktop qubes-start.desktop org.remmina.Remmina.desktop" +{%- endload %} +{{ load(defaults) }} diff --git a/salt/remmina/create.top b/salt/remmina/create.top new file mode 100644 index 0000000..d384deb --- /dev/null +++ b/salt/remmina/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - remmina.create diff --git a/salt/remmina/init.top b/salt/remmina/init.top new file mode 100644 index 0000000..6ec5803 --- /dev/null +++ b/salt/remmina/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - remmina.create + 'tpl-remmina': + - remmina.install diff --git a/salt/remmina/install.sls b/salt/remmina/install.sls new file mode 100644 index 0000000..d538914 --- /dev/null +++ b/salt/remmina/install.sls @@ -0,0 +1,27 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - ca-certificates + - remmina + - remmina-plugin-rdp + - remmina-plugin-vnc + - remmina-plugin-www + - remmina-plugin-x2go + +{% endif -%} diff --git a/salt/remmina/install.top b/salt/remmina/install.top new file mode 100644 index 0000000..981e4b8 --- /dev/null +++ b/salt/remmina/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-remmina': + - remmina.install diff --git a/salt/signal/README.md b/salt/signal/README.md new file mode 100644 index 0000000..0715c9c --- /dev/null +++ b/salt/signal/README.md @@ -0,0 +1,50 @@ +# signal + +Signal messaging app in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Install Signal Desktop and creates an app qube named "signal". + +## Installation + +- Top: +```sh +qubesctl top.enable signal +qubesctl --targets=tpl-signal,signal state.appply +qubesctl top.disable signal +``` + +- State: + +```sh +qubesctl state.apply signal.create +qubesctl --skip-dom0 --targets=tpl-signal state.apply signal.install +qubesctl --skip-dom0 --targets=signal state.apply signal.configure +``` + + +## Usage + +You may use different Signal accounts for different identities, such as +personal, work or pseudonym. Maintain the `signal` qube pristine and clone it +to the assigned domain, `personal-signal`, `work-signal`, `anon-signal`. If +you don't maintain the qube pristine, you will have to apply the firewall +rules manually. + +Signal might loose connectivity due to [upstream rotating IP +addresses](https://support.signal.org/hc/en-us/articles/360007320291) with the +use of [CDNs to evade +blocking](https://signal.org/blog/looking-back-on-the-front/). +You will have to reapply the firewall rules eventually. + +TODO: Is it worth using the firewall? If you allow all [cloudfront.net +IPs](https://ip-ranges.amazonaws.com/ip-ranges.json) for region "GLOBAL", what +is blocking an attacker from using that to host his malicious callback server? +Recently (2023-11-11) signal stopped working with the current firewall. diff --git a/salt/signal/clone.sls b/salt/signal/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/signal/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/signal/clone.top b/salt/signal/clone.top new file mode 100644 index 0000000..2e4e2fe --- /dev/null +++ b/salt/signal/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - signal.clone diff --git a/salt/signal/configure.sls b/salt/signal/configure.sls new file mode 100644 index 0000000..a8b76dd --- /dev/null +++ b/salt/signal/configure.sls @@ -0,0 +1,22 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dotfiles.copy-x11 + +"{{ slsdotpath }}-create-autostart-dir": + cmd.run: + - name: mkdir -p ~/.config/autostart + - runas: user + +"{{ slsdotpath }}-desktop-autostart": + cmd.run: + - name: ln -sf /usr/share/applications/signal-desktop.desktop ~/.config/autostart/ + - runas: user + +{% endif -%} diff --git a/salt/signal/configure.top b/salt/signal/configure.top new file mode 100644 index 0000000..09ee459 --- /dev/null +++ b/salt/signal/configure.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - signal.configure diff --git a/salt/signal/create.sls b/salt/signal/create.sls new file mode 100644 index 0000000..d38ce36 --- /dev/null +++ b/salt/signal/create.sls @@ -0,0 +1,54 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + - .firewall + +{% load_yaml as defaults -%} +name: tpl-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +features: +- set: + - menu-items: "signal-desktop.desktop qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" + - default-menu-items: "signal-desktop.desktop qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +- qvm: tpl-{{ slsdotpath }} +present: +- template: tpl-{{ slsdotpath }} +- label: yellow +prefs: +- template: tpl-{{ slsdotpath }} +- label: yellow +- vcpus: 1 +- memory: 400 +- maxmem: 600 +- autostart: False +features: +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy + - service.tracker + - service.evolution-data-server +- set: + - menu-items: "signal-desktop.desktop qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus with context -%} +{{ sync_appmenus('tpl-' ~ sls_path) }} diff --git a/salt/signal/create.top b/salt/signal/create.top new file mode 100644 index 0000000..879095d --- /dev/null +++ b/salt/signal/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - signal.create diff --git a/salt/signal/files/repo/signal.asc b/salt/signal/files/repo/signal.asc new file mode 100644 index 0000000..4b09c47 --- /dev/null +++ b/salt/signal/files/repo/signal.asc @@ -0,0 +1,51 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFjlSicBEACgho//0EzxuvuCn01LwFqGAgwPKcSSl4L+AWws5/YbsZZvmTBk +ggIiVOCIMh+d3cmGu5W3ydaeUbWbFGNsxO44EB5YBZcuLa5EzRKbNPVaOXKXmhp+ +w0mEbkoKbF+3mz3lifwBnzcBpukyJDgcJSq8cXfq5JsDPR1KAL6ph/kwKeiDNg+8 +oFgqfboukK56yPTYc9iM8hkTFdx9L6JCJaZGaDMfihoQm2caKAmqc+TlpgtKbBL0 +t5hrzDpCPpJvCddu1NRysTcqfACSSocvoqY0dlbNPMN8j04LH8hcKGFipuLdI8qx +BFqlMIQJCVJhr05E8rEsI4nYEyG44YoPopTFLuQa+wewZsQkLwcfYeCecU1KxlpE +OI3xRtALJjA/C/AzUXVXsWn7Xpcble8i3CKkm5LgX5zvR6OxTbmBUmpNgKQiyxD6 +TrP3uADm+0P6e8sJQtA7DlxZLA6HuSi+SQ2WNcuyLL3Q/lJE0qBRWVJ08nI9vvxR +vAs20LKxq+D1NDhZ2jfG2+5agY661fkx66CZNFdz5OgxJih1UXlwiHpn6qhP7Rub +OJ54CFb+EwyzDVVKj3EyIZ1FeN/0I8a0WZV6+Y/p08DsDLcKgqcDtK01ydWYP0tA +o1S2Z7Jsgya50W7ZuP/VkobDqhOmE0HDPggX3zEpXrZKuMnRAcz6Bgi6lwARAQAB +tDFPcGVuIFdoaXNwZXIgU3lzdGVtcyA8c3VwcG9ydEB3aGlzcGVyc3lzdGVtcy5v +cmc+iQI3BBMBCgAhBQJY5UonAhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJ +ENmAoXRX9vsGU00P/RBPPc5qx1EljTW3nnTtgugORrJhYl1CxNvrohVovAF4oP1b +UIGT5/3FoDsxJHSEIvorPFSaG2+3CBhMB1k950Ig2c2n+PTnNk6D0YIUbbEI0KTX +nLbCskdpy/+ICiaLfJZMe11wcQpkoNbG587JdQwnGegbQoo580CTSsYMdnvGzC8A +l1F7r37RVZToJMGgfMKK3oz8xIDXqOe5oiiKcV36tZ5V/PCDAu0hXYBRchtqHlHP +cKWeRTb1aDkbQ7SPlJ2bSvUjFdB6KahlSGJl3nIU5zAH2LA/tUQY16Z1QaJmfkEb +RY61B/LPv1TaA1SIUW32ej0NmeF09Ze4Cggdkacxv6E+CaBVbz5rLh6m91acBibm +pJdGWdZyQU90wYFRbSsqdDNB+0DvJy6AUg4e5f79JYDWT/Szdr0TLKmdPXOxa1Mb +i34UebYI7WF7q22e7AphpO/JbHcD+N6yYtN6FkUAmJskGkkgYzsM/G8OEbBRS7A+ +eg3+NdQRFhKa7D7nIuufXDOTMUUkUqNYLC+qvZVPJrWnK9ZsGKsP0EUZTfEGkmEN +UzmASxyMMe6JHmm5Alk4evJeQ31U5jy7ntZSWEV1pSGmSEJLRNJtycciFJpsEp/p +LkL0iFb30R9bHBp6cg7gjXbqZ9ZpEsxtZMBuqS70ZZyQdu2yGDQCBk7eLKCjuQIN +BFjlSicBEACsxCLVUE7UuxsEjNblTpSEysoTD6ojc2nWP/eCiII5g6SwA/tQKiQI +ZcGZsTZB9kTbCw4T3hVEmzPl6u2G6sY9Kh1NHKMR3jXvMC+FHODhOGyAOPERjHCJ +g20XF2/Gg462iW8e3lS7CQBzbplUCW/oMajj2Qkc61NLtxxzsssXjCKExub2HxCQ +AYtenuDtLU73G75BoghWJ19dIkodnEI0/fzccsgiP5xeVgmkWJPo9xKJtrBS5gcS +s7yaGY9YYo71RFzkpJpeAeLrJJqt+2KqH1u0EJUbs8YVGXKlnYeSNisg4OaRsldW +JmDDCD5WUdFq2LNdVisfwirgjmwYpLrzVMbmzPvdmxQ1NYzJsX4ARSL/wuKCvEub +gh1AR5oV7mUEA9I3KRH0TIDOnH4nGG3kqArzrV2E1WtnNzFII0IN9/48xY7Vkxs7 +Oil+E+wCpzUv/tF4ALx5TAXoPd66ddEOxzDrtBpEzsouszt7uUyncyT3X6ip5l9f +mI4uxbsjwkLVfd1WpD1uvp869oyx6wtHluswr1VY/cbnHO8J6J35JVMhYQdMOaTZ +rX6npe/YOHJ4a7YzLMfdrxyzK1wq5xu/9LgclMTdIhAKvnaXBg41jsid5n0GdIeW +ek8WAVNyvuvoTwm3GG6+/pkTwu0J79lAMD1mhJsuSca6SFNgYnd+PQARAQABiQIf +BBgBCgAJBQJY5UonAhsMAAoJENmAoXRX9vsGvRgQAJ4tWnK2TncCpu5nTCxYMXjW +LuvwORq8EBWczHS6SjLdwmSVKGKSYtl2n6nCkloVY6tONMoiCWmtcq7SJMJoyZw3 +XIf82Z39tzn/conjQcP0aIOFzww1XG7YiaTAhsDZ62kchukI52jUYm2w8cTZMEZB +oIwIWBpmLlyaDhjIM5neY5RuL7IbIpS/fdk2lwfAwcNq6z/ri2E5RWl3AEINdLUO +gAiVMagNJaJ+ap7kMcwOLoI2GD84mmbtDWemdUZ3HnqLHv0mb1djsWL6LwjCuOgK +l2GDrWCh18mE+9mVB1Lo7jzYXNSHXQP6FlDE6FhGO1nNBs2IJzDvmewpnO+a/0pw +dCerATHWtrCKwMOHrbGLSiTKEjnNt/74gKjXxdFKQkpaEfMFCeiAOFP93tKjRRhP +5wf1JHBZ1r1+pgfZlS5F20XnM2+f/K1dWmgh+4Grx8pEHGQGLP+A22O7iWjg9pS+ +LD3yikgyGGyQxgcN3sJBQ4yxakOUDZiljm3uNyklUMCiMjTvT/F02PalQMapvA5w +7Gwg5mSI8NDs3RtiG1rKl9Ytpdq7uHaStlHwGXBVfvayDDKnlpmndee2GBiU/hc2 +ZsYHzEWKXME/ru6EZofUFxeVdev5+9ztYJBBZCGMug5Xp3Gxh/9JUWi6F1+9qAyz +N+O606NOXLwcmq5KZL0g +=zyVo +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/signal/files/repo/signal.list b/salt/signal/files/repo/signal.list new file mode 100644 index 0000000..16c5a78 --- /dev/null +++ b/salt/signal/files/repo/signal.list @@ -0,0 +1,2 @@ +deb [arch=amd64 signed-by=/usr/share/keyrings/signal.asc] http://updates.signal.org/desktop/apt xenial main +# vim: ft=debsources diff --git a/salt/signal/files/repo/signal.sources b/salt/signal/files/repo/signal.sources new file mode 100644 index 0000000..3879b14 --- /dev/null +++ b/salt/signal/files/repo/signal.sources @@ -0,0 +1,6 @@ +Types: deb +URIs: http://updates.signal.org/desktop/apt +Suites: xenial +Components: main +Signed-by: /usr/share/keyrings/signal.asc +# vim: ft=debsources diff --git a/salt/signal/firewall.sls b/salt/signal/firewall.sls new file mode 100644 index 0000000..68fbb3f --- /dev/null +++ b/salt/signal/firewall.sls @@ -0,0 +1,24 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +"{{ slsdotpath }}-firewall": + cmd.run: + - require: + - qvm: {{ slsdotpath }} + - name: | + qvm-check -q --running {{ slsdotpath }} && qvm-pause {{ slsdotpath }} + qvm-firewall {{ slsdotpath }} reset + qvm-firewall {{ slsdotpath }} del --rule-no 0 + qvm-check -q --running {{ slsdotpath }} && qvm-unpause {{ slsdotpath }} + qvm-firewall {{ slsdotpath }} add accept signal.org + qvm-firewall {{ slsdotpath }} add accept storage.signal.org + qvm-firewall {{ slsdotpath }} add accept chat.signal.org + qvm-firewall {{ slsdotpath }} add accept cdn.signal.org + qvm-firewall {{ slsdotpath }} add accept cdn2.signal.org + qvm-firewall {{ slsdotpath }} add accept sfu.voip.signal.org + qvm-firewall {{ slsdotpath }} add accept turn.voip.signal.org + qvm-firewall {{ slsdotpath }} add accept turn2.voip.signal.org + qvm-firewall {{ slsdotpath }} add accept turn3.voip.signal.org diff --git a/salt/signal/firewall.top b/salt/signal/firewall.top new file mode 100644 index 0000000..12317a5 --- /dev/null +++ b/salt/signal/firewall.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - signal.firewall diff --git a/salt/signal/init.top b/salt/signal/init.top new file mode 100644 index 0000000..2126c4c --- /dev/null +++ b/salt/signal/init.top @@ -0,0 +1,15 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - signal.create + - signal.firewall + 'tpl-signal': + - signal.install + 'signal': + - signal.configure diff --git a/salt/signal/install.sls b/salt/signal/install.sls new file mode 100644 index 0000000..636127e --- /dev/null +++ b/salt/signal/install.sls @@ -0,0 +1,37 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +{% from 'utils/macros/install-repo.sls' import install_repo -%} +{{ install_repo(sls_path, 'signal') }} + +include: + - dotfiles.copy-x11 + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - ca-certificates + - qubes-core-agent-thunar + - thunar + - pulseaudio-qubes + - signal-desktop + - zenity + - dunst + - libatk1.0-0 + - libatk-bridge2.0-0 + - libgtk-4-1 + +{% endif -%} diff --git a/salt/signal/install.top b/salt/signal/install.top new file mode 100644 index 0000000..47c95a7 --- /dev/null +++ b/salt/signal/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-signal': + - signal.install diff --git a/salt/ssh/README.md b/salt/ssh/README.md new file mode 100644 index 0000000..bd46310 --- /dev/null +++ b/salt/ssh/README.md @@ -0,0 +1,48 @@ +# ssh + +SSH remote login client in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Setup SSH client AppVM ssh and a DispVM Template "dvm-ssh". +It's use is plain simple, SSH to servers, no extra configuration is required. +When saving the SSH configuration is necessary, use the ssh qube. If login +in as a one time connection or to an untrusted host use a DispVM based on +"dvm-ssh" for disposability. + +## Installation + +- Top: +```sh +qubesctl top.enable ssh +qubesctl --targets=tpl-ssh,dvm-ssh,ssh state.apply +qubesctl top.disable ssh +``` + +- State: + +```sh +qubesctl state.apply ssh.create +qubesctl --skip-dom0 --targets=tpl-ssh state.apply ssh.install +qubesctl --skip-dom0 --targets=dvm-ssh,ssh state.apply ssh.configure +``` + + +## Usage + +Create DispVMs based on the Template for DispVMs "dvm-ssh" for disposable SSH +sessions or create AppVMs based on "tpl-ssh", such as the "ssh" qube for for +preserving the SSH configuration client side. + +The client qube can enhanced by being: + +- sys-ssh-agent's client and not storing the SSH keys on the client; or +- sys-git's client and fetching from qubes and push to remote servers. + +The server requires the OpenSSH server to be installed. diff --git a/salt/ssh/clone.sls b/salt/ssh/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/ssh/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/ssh/clone.top b/salt/ssh/clone.top new file mode 100644 index 0000000..c938b58 --- /dev/null +++ b/salt/ssh/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - ssh.clone diff --git a/salt/ssh/configure.sls b/salt/ssh/configure.sls new file mode 100644 index 0000000..ffc42e8 --- /dev/null +++ b/salt/ssh/configure.sls @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dev.home-cleanup + - dotfiles.copy-x11 + - dotfiles.copy-ssh + +{% endif -%} diff --git a/salt/ssh/configure.top b/salt/ssh/configure.top new file mode 100644 index 0000000..a525310 --- /dev/null +++ b/salt/ssh/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'ssh,dvm-ssh': + - ssh.configure diff --git a/salt/ssh/create.sls b/salt/ssh/create.sls new file mode 100644 index 0000000..988cf61 --- /dev/null +++ b/salt/ssh/create.sls @@ -0,0 +1,59 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: purple +prefs: +- template: tpl-{{ slsdotpath }} +- label: purple +- vcpus: 1 +- memory: 400 +- maxmem: 500 +- autostart: False +features: +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: dvm-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: purple +prefs: +- template: tpl-{{ slsdotpath }} +- label: purple +- vcpus: 1 +- memory: 400 +- maxmem: 500 +- autostart: False +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - appmenus-dispvm +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} diff --git a/salt/ssh/create.top b/salt/ssh/create.top new file mode 100644 index 0000000..6374fe3 --- /dev/null +++ b/salt/ssh/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - ssh.create diff --git a/salt/ssh/init.top b/salt/ssh/init.top new file mode 100644 index 0000000..0b241ad --- /dev/null +++ b/salt/ssh/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - ssh.create + 'tpl-ssh': + - ssh.install + 'dvm-ssh,ssh': + - ssh.configure diff --git a/salt/ssh/install.sls b/salt/ssh/install.sls new file mode 100644 index 0000000..7c94b2b --- /dev/null +++ b/salt/ssh/install.sls @@ -0,0 +1,42 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dotfiles.copy-x11 + - dotfiles.copy-ssh + +"{{ slsdotpath }}-client-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-client-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - ca-certificates + +{% set pkg = { + 'Debian': { + 'pkg': ['openssh-client'], + }, + 'RedHat': { + 'pkg': ['openssh-clients'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-client-installed-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +{% endif %} diff --git a/salt/ssh/install.top b/salt/ssh/install.top new file mode 100644 index 0000000..85323b2 --- /dev/null +++ b/salt/ssh/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-ssh': + - ssh.install diff --git a/salt/sys-audio/README.md b/salt/sys-audio/README.md new file mode 100644 index 0000000..a7faa33 --- /dev/null +++ b/salt/sys-audio/README.md @@ -0,0 +1,44 @@ +# sys-audio + +Audio operations in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Creates the "sys-audio" qube for providing audio operations such as microphone +and speakers to and from qubes. By default, you can use wired USB audio, but +if you want, you can install the necessary packages for bluetooth with the +provided state. + +## Installation + +- Top +```sh +qubesctl top.enable sys-audio +qubesctl --targets=tpl-sys-audio state.apply +qubesctl top.disable sys-audio +``` + +- State + +```sh +qubesctl state.apply sys-audio.create +qubesctl --skip-dom0 --targets=tpl-sys-audio state.apply sys-audio.install +``` + + +If you need Bluetooth support: +```sh +qubesctl --skip-dom0 --targets=tpl-sys-audio state.apply sys-audio.install-bluetooth +``` + +## Usage + +The qube `sys-audio` will be used for audio capabilities for speakers and +microphone, with builtin modules, jack port or Bluetooth. You are be able to +control the volume via the volume icon that appears on the system tray. diff --git a/salt/sys-audio/clone.sls b/salt/sys-audio/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-audio/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-audio/clone.top b/salt/sys-audio/clone.top new file mode 100644 index 0000000..604c36a --- /dev/null +++ b/salt/sys-audio/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-audio.clone diff --git a/salt/sys-audio/create.sls b/salt/sys-audio/create.sls new file mode 100644 index 0000000..659cd41 --- /dev/null +++ b/salt/sys-audio/create.sls @@ -0,0 +1,77 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +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: 400 +- maxmem: 0 +- vcpus: 1 +- virt_mode: hvm +- template_for_dispvms: True +- include_in_backups: False +featuresq: +- enable: + - servicevm + - appmenus-dispvm +- disable: + - service.cups + - service.cups-browsed + - service.meminfo-writer + - service.qubes-updates-proxy +{%- endload %} +{{ load(defaults) }} + +{% set audio_pcidevs = salt['grains.get']('pci_audio_devs', []) -%} +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- qvm: dvm-{{ slsdotpath }} +present: +- template: dvm-{{ slsdotpath }} +- label: red +- class: DispVM +prefs: +- template: dvm-{{ slsdotpath }} +- label: red +- netvm: "" +- include_in_backups: False +- pci_strictreset: False +- autostart: False +- pcidevs: {{ audio_pcidevs|yaml }} +features: +- enable: + - servicevm +- disable: + - service.cups + - service.cups-browsed + - service.meminfo-writer + - service.qubes-updates-proxy +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-default_audiovm": + cmd.run: + - require: + - qvm: {{ slsdotpath }} + - name: qubes-prefs default_audiovm {{ slsdotpath }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-audio/create.top b/salt/sys-audio/create.top new file mode 100644 index 0000000..3a1fdb6 --- /dev/null +++ b/salt/sys-audio/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-audio.create diff --git a/salt/sys-audio/files/admin/policy/default.policy b/salt/sys-audio/files/admin/policy/default.policy new file mode 100644 index 0000000..344abb5 --- /dev/null +++ b/salt/sys-audio/files/admin/policy/default.policy @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +admin.Events * {{ sls_path }} @adminvm allow target=dom0 +admin.Events +domain-stopped {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.Events +domain-shutdown {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.Events +domain-start {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.Events +connection-established {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 + +admin.vm.CurrentState * {{ sls_path }} @adminvm allow target=dom0 +admin.vm.CurrentState * {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.vm.List * {{ sls_path }} @adminvm allow target=dom0 +admin.vm.List * {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 + +admin.vm.property.Get +audiovm {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.vm.property.Get +xid {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.vm.property.Get +stubdom_xid {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 + +admin.vm.feature.CheckWithTemplate +audio {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.vm.feature.CheckWithTemplate +audio-model {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +## vim:ft=qrexecpolicy diff --git a/salt/sys-audio/init.top b/salt/sys-audio/init.top new file mode 100644 index 0000000..3f9603b --- /dev/null +++ b/salt/sys-audio/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-audio.create + 'tpl-sys-audio': + - sys-audio.install diff --git a/salt/sys-audio/install-bluetooth.sls b/salt/sys-audio/install-bluetooth.sls new file mode 100644 index 0000000..2ad63a8 --- /dev/null +++ b/salt/sys-audio/install-bluetooth.sls @@ -0,0 +1,25 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install + +"{{ slsdotpath }}-bluetooth-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-bluetooth-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - blueman + - linux-firmware + +{% endif -%} diff --git a/salt/sys-audio/install-bluetooth.top b/salt/sys-audio/install-bluetooth.top new file mode 100644 index 0000000..dda2775 --- /dev/null +++ b/salt/sys-audio/install-bluetooth.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-audio': + - match: list + - sys-audio.install-bluetooth diff --git a/salt/sys-audio/install.sls b/salt/sys-audio/install.sls new file mode 100644 index 0000000..0f71825 --- /dev/null +++ b/salt/sys-audio/install.sls @@ -0,0 +1,45 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - sys-usb.install-client-proxy + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-admin-client + - qubes-audio-daemon + - pipewire-qubes + - alsa-utils + - volumeicon-alsa + - socat + +{% set pkg = { + 'Debian': { + 'pkg': ['pipewire', 'libpam-systemd'], + }, + 'RedHat': { + 'pkg': ['pipewire-utils', 'systemd-pam'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-installed-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +{% endif -%} diff --git a/salt/sys-audio/install.top b/salt/sys-audio/install.top new file mode 100644 index 0000000..11cd9dc --- /dev/null +++ b/salt/sys-audio/install.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-audio': + - match: list + - sys-audio.install diff --git a/salt/sys-cacher/README.md b/salt/sys-cacher/README.md new file mode 100644 index 0000000..442d4c5 --- /dev/null +++ b/salt/sys-cacher/README.md @@ -0,0 +1,139 @@ +# sys-cacher + +Caching proxy server for software repositories in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + * [Report Page and Maintenance Tasks](#report-page-and-maintenance-tasks) + * [Connect to the cacher via IP instead of Qrexec](#connect-to-the-cacher-via-ip-instead-of-qrexec) + * [Non-TemplateVMs integration](#non-templatevms-integration) +* [Uninstallation](#uninstallation) +* [Credits](#credits) + +## Description + +The caching proxy is "sys-cacher" based on apt-cacher-ng, it stores downloaded +packages, so that you need only download a package once for it to be used when +updating many The proxy is preconfigured to work out of the box +for Debian, Ubuntu, Arch, and Fedora + +When you install this package, qubes will be tagged with "sys-cacher-updatevm" +and they will be altered to use the proxy by default. When there is "https://" +in your repository definitions, the entries will be changed in the templates +from to "http://HTTPS///". This is so that the request to the proxy is plain +text, and the proxy will then make the request via https. + +This change will be done automatically for every template that exists and is +not Whonix based. No changes are made to Whonix templates, and updates to +those templates will not be cached. + +## Installation + +Installation may take a long time as it will target all templates unless you +specify otherwise. + +- Top +```sh +qubesctl top.enable sys-cacher browser +qubesctl --targets=tpl-browser,tpl-sys-cacher,sys-cacher,sys-cacher-browser state.apply +qubesctl top.disable sys-cacher browser +qubesctl state.apply sys-cacher.appmenus,sys-cacher.tag +``` + +- State + +```sh +qubesctl state.apply sys-cacher.create +qubesctl --skip-dom0 --targets=tpl-browser state.apply browser.install +qubesctl --skip-dom0 --targets=tpl-sys-cacher state.apply sys-cacher.install +qubesctl --skip-dom0 --targets=sys-cacher state.apply sys-cacher.configure +qubesctl --skip-dom0 --targets=sys-cacher-browser state.apply sys-cacher.configure-browser +qubesctl state.apply sys-cacher.appmenus,sys-cacher.tag +qubesctl --skip-dom0 --templates state.apply sys-cacher.install-client +``` + + +## Usage + +### Report Page and Maintenance Tasks + +The report page is available from `sys-cacher` and `sys-cacher-browser` at +`http://127.0.0.1:8082/acng-report.html` and any other client qube that has +`sys-cacher` as it's update qube. This is apt-cacher-ng limitation and is bad +security wise, every client has administrative access to the cacher qube. You +should add the following to the end of `sys-cacher` rc.local: +```sh +echo "AdminAuth: username:password" | tee /etc/apt-cacher-ng/zzz_security.conf +``` +Where username and password are HTTP Auth strings. + +If you want to view statistics or manage the server through a GUI, open +`sys-cacher` or `sys-cacher-browser` desktop file `cacher-browser.desktop` +from Dom0. Addresses starting with `http` or `https` will be redirected +to `sys-cacher-browser`. + +The browser separation from the server is to avoid browsing malicious sites +and exposing the browser to direct network on the same machine the server is +running. The browser qube is offline and only has access to the admin +interface. In other words, it has control over the server functions, if the +browser is compromised, it can compromise the server. + +### Connect to the cacher via IP instead of Qrexec + +Because the `sys-cacher` qube is listening on port `8082`, you can use it from +non-template qubes and qubes that do not have a working Qrexec. Use the native +configuration to set the update proxy using the IP address of `sys-cacher` by +setting the cacher as the netvm of the client qube. + +### Non-TemplateVMs integration + +**Attention**: this method will allow for a client qube to bypass the qubes +firewall and connect to a remote via the updates proxy. + +By default, only templates will use the proxy to update, if you want to cache +Non-TemplateVMs updates or simply make them functional again, the qube will +need the `service.updates-proxy-setup` feature set: +```sh +qubesctl --skip-dom0 --targets=QUBE state.apply sys-cacher.install-client +qvm-tags add QUBE sys-cacher-updatevm +qvm-features QUBE service.updates-proxy-setup 1 +``` +Don't forget to restart the qube. + +If you don't want or can't restart the qube, such as DispVMs, where you would +lose you session, run the same commands as above plus the following inside the +qube: +```sh +sudo touch /var/run/qubes-service/updates-proxy-setup +sudo /usr/lib/qubes/update-proxy-configs +sudo systemctl restart qubes-updates-proxy-forwarder.socket +``` + +## Uninstallation + +- Top: +```sh +qubesctl top.enable sys-cacher.deinit +qubesctl --templates state.apply +qubesctl top.disable sys-cacher.deinit +``` + +- State: +```sh +qubesctl state.apply sys-cacher.remove-policy +qubesctl state.apply sys-cacher.untag +qubesctl --skip-dom0 --templates state.apply sys-cacher.uninstall-client +``` + +If you want to use the standard proxy for a few templates: +```sh +qubesctl --skip-dom0 --targets=TEMPLATE state.apply sys-cacher.uninstall-client +qvm-tags del TEMPLATE sys-cacher-updatevm +``` + +## Credits + +- [Unman](https://github.com/unman/shaker/tree/main/cacher) diff --git a/salt/sys-cacher/appmenus.sls b/salt/sys-cacher/appmenus.sls new file mode 100644 index 0000000..0d056d5 --- /dev/null +++ b/salt/sys-cacher/appmenus.sls @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - browser.appmenus + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus('tpl-' ~ sls_path) }} + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus(sls_path ~ '-browser') }} diff --git a/salt/sys-cacher/appmenus.top b/salt/sys-cacher/appmenus.top new file mode 100644 index 0000000..3d9eaa3 --- /dev/null +++ b/salt/sys-cacher/appmenus.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-cacher.appmenus diff --git a/salt/sys-cacher/clone.sls b/salt/sys-cacher/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-cacher/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-cacher/clone.top b/salt/sys-cacher/clone.top new file mode 100644 index 0000000..4d16822 --- /dev/null +++ b/salt/sys-cacher/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-cacher.clone diff --git a/salt/sys-cacher/configure-browser.sls b/salt/sys-cacher/configure-browser.sls new file mode 100644 index 0000000..eee3196 --- /dev/null +++ b/salt/sys-cacher/configure-browser.sls @@ -0,0 +1,23 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' %} + +"{{ slsdotpath }}-browser-rc.local": + file.append: + - name: /rw/config/rc.local + - text: "qvm-connect-tcp 8082:@default:8082" + +"{{ slsdotpath }}-browser-desktop-application": + file.managed: + - name: /home/user/.local/share/applications/cacher-browser.desktop + - source: salt://{{ slsdotpath }}/files/browser/cacher-browser.desktop + - mode: '0644' + - user: user + - group: user + - makedirs: True + +{% endif -%} diff --git a/salt/sys-cacher/configure-browser.top b/salt/sys-cacher/configure-browser.top new file mode 100644 index 0000000..13798b9 --- /dev/null +++ b/salt/sys-cacher/configure-browser.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-cacher-browser': + - sys-cacher.configure-browser diff --git a/salt/sys-cacher/configure.sls b/salt/sys-cacher/configure.sls new file mode 100644 index 0000000..7d994eb --- /dev/null +++ b/salt/sys-cacher/configure.sls @@ -0,0 +1,35 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dotfiles.copy-x11 + +"{{ slsdotpath }}-install-rc.local": + file.append: + - name: /rw/config/rc.local + - text: | + chown -R apt-cacher-ng:apt-cacher-ng /var/log/apt-cacher-ng + chown -R apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng + systemctl unmask apt-cacher-ng + systemctl --no-block restart apt-cacher-ng + nft 'insert rule ip filter INPUT tcp dport 8082 counter accept' + +"{{ slsdotpath }}-install-qubes-firewall-user-script": + file.append: + - name: /rw/config/qubes-firewall-user-script + - text: nft 'insert rule ip filter INPUT tcp dport 8082 counter accept' + +"{{ slsdotpath }}-bind-dirs": + file.managed: + - name: /rw/config/qubes-bind-dirs.d/50_cacher.conf + - source: salt://{{ slsdotpath }}/files/server/bind-dirs/50_cacher.conf + - user: root + - group: root + - makedirs: True + +{% endif -%} diff --git a/salt/sys-cacher/configure.top b/salt/sys-cacher/configure.top new file mode 100644 index 0000000..a29dc3a --- /dev/null +++ b/salt/sys-cacher/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-cacher': + - sys-cacher.configure diff --git a/salt/sys-cacher/create.sls b/salt/sys-cacher/create.sls new file mode 100644 index 0000000..2d13001 --- /dev/null +++ b/salt/sys-cacher/create.sls @@ -0,0 +1,102 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: tpl-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +prefs: +- vcpus: 1 +- memory: 300 +- maxmem: 500 +- autostart: False +- include_in_backups: False +features: +- disable: + - service.cups + - service.cups-browsed + - service.tracker + - service.evolution-data-server +- set: + - menu-items: "cacher-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" + - default-menu-items: "cacher-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: gray +prefs: +- template: tpl-{{ slsdotpath }} +- label: gray + ## Disable memory balooning because of HTTP 503: Cannot allocate memory +- maxmem: 0 +- memory: 500 +- vcpus: 1 +- provides-network: true +- autostart: False +- include_in_backups: True +features: +- enable: + - servicevm + - service.shutdown-idle +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy + - service.meminfo-writer +- set: + - menu-items: "cacher-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }}-browser +force: true +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-browser +- label: gray +prefs: +- template: tpl-browser +- label: gray +- vcpus: 1 +- netvm: "" +- memory: 300 +- maxmem: 500 +- autostart: False +- include_in_backups: False +features: +- disable: + - service.cups + - service.cups-browsed + - service.tracker + - service.evolution-data-server +- set: + - menu-items: "cacher-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '75') }} + +"{{ slsdotpath }}-extend-volume": + cmd.run: + - name: qvm-volume extend {{ slsdotpath }}:private 20Gi + - require: + - qvm: {{ slsdotpath }} diff --git a/salt/sys-cacher/create.top b/salt/sys-cacher/create.top new file mode 100644 index 0000000..f5cfe21 --- /dev/null +++ b/salt/sys-cacher/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-cacher.create diff --git a/salt/sys-cacher/deinit.top b/salt/sys-cacher/deinit.top new file mode 100644 index 0000000..34281c5 --- /dev/null +++ b/salt/sys-cacher/deinit.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-cacher.untag + - sys-cacher.remove-policy + 'qubes:type:template': + - match: pillar + - sys-cacher.uninstall-client diff --git a/salt/sys-cacher/files/admin/policy/default.policy b/salt/sys-cacher/files/admin/policy/default.policy new file mode 100644 index 0000000..ec0a21b --- /dev/null +++ b/salt/sys-cacher/files/admin/policy/default.policy @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qubes.OpenURL * {{ sls_path }} @default allow target={{ sls_path }}-browser +qubes.OpenURL * {{ sls_path }} @anyvm deny +qubes.ConnectTCP +8082 {{ sls_path }}-browser @default allow target={{ sls_path }} +qubes.ConnectTCP * {{ sls_path }}-browser @anyvm deny +qubes.UpdatesProxy * @tag:whonix-updatevm @default allow target=sys-whonix +qubes.UpdatesProxy * @tag:whonix-updatevm @anyvm deny +qubes.UpdatesProxy * @tag:{{ sls_path }}-updatevm @default allow target={{ sls_path }} +qubes.UpdatesProxy * @tag:{{ sls_path }}-updatevm @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/sys-cacher/files/browser/cacher-browser.desktop b/salt/sys-cacher/files/browser/cacher-browser.desktop new file mode 100644 index 0000000..7bbf0ed --- /dev/null +++ b/salt/sys-cacher/files/browser/cacher-browser.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Apt-Cacher-NG Browser +Exec=xdg-open http://127.0.0.1:8082/acng-report.html +Icon=web-browser +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=synchronization;interface; +Categories=Network;WebBrowser;FileTransfer;P2P; diff --git a/salt/sys-cacher/files/server/bind-dirs/50_cacher.conf b/salt/sys-cacher/files/server/bind-dirs/50_cacher.conf new file mode 100755 index 0000000..320d64c --- /dev/null +++ b/salt/sys-cacher/files/server/bind-dirs/50_cacher.conf @@ -0,0 +1,10 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2023 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +binds+=( '/var/cache/apt-cacher-ng' ) +binds+=( '/var/log/apt-cacher-ng' ) + +# vim: ft=bash diff --git a/salt/sys-cacher/files/server/cacher-browser-general.desktop b/salt/sys-cacher/files/server/cacher-browser-general.desktop new file mode 100644 index 0000000..cf8163c --- /dev/null +++ b/salt/sys-cacher/files/server/cacher-browser-general.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Apt-Cacher-NG Browser URL Forwarder +Exec=qvm-open-in-vm -- @default %u +Icon=web-browser +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=synchronization;interface; +Categories=Network;WebBrowser;FileTransfer;P2P; diff --git a/salt/sys-cacher/files/server/cacher-browser.desktop b/salt/sys-cacher/files/server/cacher-browser.desktop new file mode 100644 index 0000000..05e3509 --- /dev/null +++ b/salt/sys-cacher/files/server/cacher-browser.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Apt-Cacher-NG Browser +Exec=qvm-open-in-vm -- @default http://127.0.0.1:8082/acng-report.html +Icon=web-browser +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=synchronization;interface; +Categories=Network;WebBrowser;FileTransfer;P2P; diff --git a/salt/sys-cacher/files/server/conf/acng.conf b/salt/sys-cacher/files/server/conf/acng.conf new file mode 100644 index 0000000..f3d38d2 --- /dev/null +++ b/salt/sys-cacher/files/server/conf/acng.conf @@ -0,0 +1,604 @@ +# SPDX-FileCopyrightText: 2022 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +# +# IMPORTANT NOTE: +# +# THIS FILE IS MAYBE JUST ONE OF MANY CONFIGURATION FILES IN THIS DIRECTORY. +# SETTINGS MADE IN OTHER FILES CAN OVERRIDE VALUES THAT YOU CHANGE HERE. GO +# LOOK FOR OTHER CONFIGURATION FILES! CHECK THE MANUAL AND INSTALLATION NOTES +# (like README.Debian) FOR MORE DETAILS! +# + +# This is a configuration file for apt-cacher-ng, a smart caching proxy for +# software package downloads. It's supposed to be in a directory specified by +# the -c option of apt-cacher-ng, see apt-cacher-ng(8) for details. +# RULES: +# - letter case in variable names does not matter +# - names and values are separated by colon or equals sign +# - for boolean variables, zero means false, non-zero means true +# - "default value" means built-in (!) defaults, i.e. something which the +# program uses if the option is not set here or in other config files. +# That value might be explicitly mentioned in the description. Where it is +# not, there is no reason to assume any of the examples to be the default +# value! In doubt, use acngtool to query the value of the particular variable. + +# Storage directory for downloaded data and related maintenance activity. +# +# Note: When the value for CacheDir is changed, change the file +# /lib/systemd/system/apt-cacher-ng.service too +# +CacheDir: /var/cache/apt-cacher-ng + +# Log file directory, can be set empty to disable logging +# +LogDir: /var/log/apt-cacher-ng + +# A place to look for additional configuration and resource files if they are not +# found in the configuration directory +# +SupportDir: /usr/lib/apt-cacher-ng + +# TCP server port for incoming http (or HTTP proxy) connections. +# Can be set to 9999 to emulate apt-proxy. Value of 0 turns off TCP server +# (SocketPath must be set in this case). +# +Port:8082 + +# Addresses or hostnames to listen on. Multiple addresses must be separated by +# spaces. Each entry must be an exact local address which is associated with a +# local interface. DNS resolution is performed using getaddrinfo(3) for all +# available protocols (IPv4, IPv6, ...). Using a protocol specific format will +# create binding(s) only on protocol specific socket(s), e.g. 0.0.0.0 will +# listen only to IPv4. The endpoint can also be specified as host:port (or +# [ipv6-address]:port) which allows binding on non-standard ports (Port +# directive is ignored in this case). +# +# Default: listens on all interfaces and protocols +# +# BindAddress: localhost 192.168.7.254 publicNameOnMainInterface + +# The specification of another HTTP proxy which shall be used for downloads. +# It can include user name and password but see the manual for limitations. +# +# Default: uses direct connection +# +# Proxy: http://www-proxy.example.net:3128 +# Proxy: https://username:proxypassword@proxy.example.net:3129 + +# Repository remapping. See manual for details. +# In this example, some backends files might be generated during package +# installation using information collected on the system. +# Examples: +#Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian # Debian Archives +Remap-alxrep: file:archlx_mirrors /archlinux # ; file:backend_archlx # Arch Linux +Remap-debrep: https://deb.debian.org http://deb.debian.org file:deb_mirrors.gz /debian +Remap-fedora: file:fedora_mirrors # Fedora Linux +Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu # Ubuntu Archives +Remap-klxrep: file:kali_mirrors /kali ; file:backends_kali # Kali Linux Archives +Remap-cygwin: file:cygwin_mirrors /cygwin # ; file:backends_cygwin # incomplete, please create this file or specify preferred mirrors here +Remap-sfnet: file:sfnet_mirrors # ; file:backends_sfnet # incomplete, please create this file or specify preferred mirrors here +Remap-alxrep: file:archlx_mirrors /archlinux # ; file:backend_archlx # Arch Linux +Remap-fedora: file:fedora_mirrors # Fedora Linux +Remap-epel: file:epel_mirrors # Fedora EPEL +Remap-slrep: file:sl_mirrors # Scientific Linux +Remap-gentoo: file:gentoo_mirrors.gz /gentoo ; file:backends_gentoo # Gentoo Archives +Remap-secdeb: security.debian.org security.debian.org/debian-security deb.debian.org/debian-security /debian-security cdn-fastly.deb.debian.org/debian-security ; deb.debian.org/debian-security security.debian.org cdn-fastly.deb.debian.org/debian-security +# Qusal external repositories +Remap-qubesdebrep: https://deb.qubes-os.org http://deb.qubes-os.org +Remap-qubesyumrep: https://yum.qubes-os.org http://yum.qubes-os.org +Remap-dockerrep: https://download.docker.com http://download.docker.com +Remap-googlerep: https://dl.google.com http://dl.google.com +Remap-hashicorprep: https://apt.releases.hashicorp.com http://apt.releases.hashicorp.com +Remap-launchpadrep: https://ppa.launchpad.net http://ppa.launchpad.net +Remap-signalrep: https://updates.signal.org http://updates.signal.org +Remap-syncthingrep: https://apt.syncthing.net + +# Virtual page accessible in a web browser to see statistics and status +# information, i.e. under http://localhost:3142/acng-report.html +# NOTE: This option must be configured to run maintenance jobs (even when used +# via acngtool in cron scripts). The AdminAuth option can be used to restrict +# access to sensitive areas on that page. +# +# Default: not set, should be set by the system administrator +# +ReportPage: acng-report.html + +# Socket file for accessing through local UNIX socket instead of TCP/IP. Can be +# used with inetd (via bridge tool in.acng from apt-cacher-ng package), is also +# used internally for administrative purposes. +# +# Default: /run/apt-cacher-ng/socket +# +# SocketPath: /var/run/apt-cacher-ng/socket + +# If set to 1, makes log files be written to disk on every new line. Default +# is 0, buffers are flushed after the client disconnects. Technically, +# it's a convenience alias for the Debug option, see below for details. +# +UnbufferLogs: 1 + +# Enables extended client information in log entries. When set to 0, only +# activity type, time and transfer sizes are logged. +# +# VerboseLog: 1 + +# Don't detach from the starting console. +# +# ForeGround: 0 + +# Store the pid of the daemon process in the specified text file. +# Default: disabled +# +# PidFile: /var/run/apt-cacher-ng/pid + +# Forbid outgoing connections and work without an internet connection or +# respond with 503 error where it's not possible. +# +# Offlinemode: 0 + +# Forbid downloads from locations that are directly specified in the user +# request, i.e. all downloads must be processed by the preconfigured remapping +# backends (see above). +# +# ForceManaged: 0 + +# Days before considering an unreferenced file expired (to be deleted). +# WARNING: if the value is set too low and particular index files are not +# available for some days (mirror downtime) then there is a risk of removal of +# still useful package files. +# +ExThreshold: 4 + +# If set to true, the removal (i.e. response status 404) of remote +# volatile/index files is considered a hint to consider the local cached +# versions irrelevant and also expire them just like package files. This adds +# some risk of removing too much cache contents in cases where a middlebox +# reports bogus 404 codes. +# +# If false (0), a less sloppy algorithm is used to invalidate certain keyfiles +# first, which might subsequently expire the cache contents but much later or +# maybe never unless the administrator intervenes. +# +FollowIndexFileRemoval: 1 + +# If the expiration is run daily, it sometimes does not make much sense to do +# it because the expected changes (i.e. removal of expired files) don't justify +# the extra processing time or additional downloads for expiration operation +# itself. This discrepancy might be especially worse if the local client +# installations are small or are rarely updated but the daily changes of +# the remote archive metadata are heavy. +# +# The following option enables a possible trade-off: the expiration run is +# suppressed until a certain amount of data has been downloaded through +# apt-cacher-ng since the last expiration execution (which might indicate that +# packages were replaced with newer versions). +# +# The number can have a suffix (k,K,m,M for Kb,KiB,Mb,MiB) +# +# ExStartTradeOff: 500m + +# Stop expiration when a critical problem appears, issue like a failed update +# of an index file in the preparation step. +# +# WARNING: don't set this option to zero or empty without considering possible +# consequences like a sudden and complete cache data loss. +# +# ExAbortOnProblems: 1 + +# Number of failed nightly expiration runs which are considered acceptable and +# do not trigger an error notification to the admin (e.g. via daily cron job) +# before the (day) count is reached. Might be useful with whacky internet +# connections. +# +# Default: a guessed value, 1 if ExThreshold is 5 or more, 0 otherwise. +# +# ExSuppressAdminNotification: 1 + +# Modify file names to work around limitations of some file systems. +# WARNING: experimental feature, subject to change +# +# StupidFs: 0 + +# Experimental feature for apt-listbugs: pass-through SOAP requests and +# responses to/from bugs.debian.org. +# Default: guessed value, true unless ForceManaged is enabled +# +# ForwardBtsSoap: 1 + +# There is a small in-memory cache for DNS resolution data, expired by +# this timeout (in seconds). Internal caching is disabled if set to a value +# less than zero. +# +# DnsCacheSeconds: 1800 + +############################################################################### +# +# WARNING: don't modify thread and file matching parameters without a clear +# idea of what is happening behind the scene! +# +# Max. count of connection threads kept ready (for faster response in the +# future). Should be a sane value between 0 and average number of connections, +# and depend on the amount of spare RAM. +# MaxStandbyConThreads: 8 +# +# Hard limit of active thread count for incoming connections, i.e. operation +# is refused when this value is reached (below zero = unlimited). +# MaxConThreads: -1 +# +# Timeout for a forced disconnect in cases where a client connection is about +# to be closed but remote refuses to confirm the disconnect request. Setting +# this to a lower value mitigates the effects of resource starvation in case of +# a DOS attack but increases the risk of failing to flush the remaining portion +# of data. +# DisconnectTimeout: 15 + +# By default, if a remote suddenly reconnects, ACNG tries at least two times to +# redownload from the same or different location (if known). +# DlMaxRetries: 2 + +# Pigeonholing files (like static vs. volatile contents) is done by (extended) +# regular expressions. +# +# The following patterns are available for the purposes detailed, where +# the latter takes precedence over the former: +# - «PFilePattern» for static data that doesn't change silently on the server. +# - «VFilePattern» for volatile data that may change like every hour. Files +# that match both PFilePattern and VfilePattern will be treated as volatile. +# - Static data with file names that match VFilePattern may be overriden being +# treated as volatile by making it match the special static data pattern, +# «SPfilePattern». +# - «SVfilePattern» or the "special volatile data" pattern is for the +# convenience of specifying any exceptions to matches with SPfilePattern, +# for cases where data must still be treated as volatile. +# - «WfilePattern» specifies a "whitelist pattern" for the regular expiration +# job, telling it to keep the files even if they are not referenced by +# others, like crypto signatures with which clients begin their downloads. +# +# There are two versions. The pattern variables mentioned above should not be +# set without good reason, because they would override the built-in defaults +# (that might impact updates to future versions of apt-cacher-ng). There are +# also versions of those patterns ending with Ex, which may be modified by the +# local administrator. They are evaluated in addition to the regular patterns +# at runtime. +# +# To see examples of the expected syntax, run: apt-cacher-ng -p debug=1 +# +PfilePatternEx: .*yaml.gz$|.*fedora.*arch=x86_64$|.*f35&arch=x86_64|.*f36&arch=x86_64|.*f37&arch=x86_64 +VfilePatternEx: .*fedora.*updateinfo.*xml.zck$|^/\?release=[0-9]+&arch=.*|.*/RPM-GPG-KEY.*|.*\?repo=fedora|.*pkg.tar.zst.sig +# SPfilePatternEx: +# SVfilePatternEx: +# WfilePatternEx: +# +############################################################################### + +# A bitmask type value declaring the loging verbosity and behavior of the error +# log writing. Non-zero value triggers at least faster log file flushing. +# +# Some higher bits only working with a special debug build of apt-cacher-ng, +# see the manual for details. +# +# WARNING: this can write significant amount of data into apt-cacher.err logfile. +# +# Default: 0 +# +# Debug:3 + +# Usually, general purpose proxies like Squid expose the IP address of the +# client user to the remote server using the X-Forwarded-For HTTP header. This +# behaviour can be optionally turned on with the Expose-Origin option. +# +# ExposeOrigin: 0 + +# When logging the originating IP address, trust the information supplied by +# the client in the X-Forwarded-For header. +# +# LogSubmittedOrigin: 0 + +# The version string reported to the peer, to be displayed as HTTP client (and +# version) in the logs of the mirror. +# +# WARNING: Expect side effects! Some archives use this header to guess +# capabilities of the client (i.e. allow redirection and/or https links) and +# change their behaviour accordingly but ACNG might not support the expected +# features. +# +# Default: +# +# UserAgent: Yet Another HTTP Client/1.2.3p4 + +# In some cases the Import and Expiration tasks might create fresh volatile +# data for internal use by reconstructing them using patch files. This +# by-product might be recompressed with bzip2 and with some luck the resulting +# file becomes identical to the *.bz2 file on the server which can be used by +# APT when requesting a complete version of this file. +# The downside of this feature is higher CPU load on the server during +# the maintenance tasks, and the outcome might have not much value in a LAN +# where all clients update their data often and regularly and therefore usually +# don't need the full version of the index file. +# +# RecompBz2: 0 + +# Network timeout for outgoing connections, in seconds. +# +# NetworkTimeout: 40 + +# Fast fallback timeout, in seconds. This is the time to wait before +# alternative target addresses for a client connection are tried, which can be +# usefull for quick fallback to IPv4 in case of whacky IPv6 configuration. +# +# FastTimeout = 4 + +# Sometimes it makes sense to not store the data in cache and just return the +# package data to client while it comes in. The following DontCache* parameters +# can enable this behaviour for certain URL types. The tokens are extended +# regular expressions which the URLs are evaluated against. +# +# DontCacheRequested is applied to the URL as it comes in from the client. +# Example: exclude packages built with kernel-package for x86 +# DontCacheRequested: linux-.*_10\...\.Custo._i386 +# Example usecase: exclude popular private IP ranges from caching +# DontCacheRequested: 192.168.0 ^10\..* 172.30 +# +# DontCacheResolved is applied to URLs after mapping to the target server. If +# multiple backend servers are specified then it's only matched against the +# download link for the FIRST possible source (due to implementation limits). +# +# Example usecase: all Ubuntu stuff comes from a local mirror (specified as +# backend), don't cache it again: +# DontCacheResolved: ubuntumirror.local.net +# +# DontCache directive sets (overrides) both, DontCacheResolved and +# DontCacheRequested. Provided for convenience, see those directives for +# details. +# +# Example: +DontCache: .*fedora.*updates.*updateinfo.xml.zck + +# Default permission set of freshly created files and directories, as octal +# numbers (see chmod(1) for details). +# Can by limited by the umask value (see umask(2) for details) if it's set in +# the environment of the starting shell, e.g. in apt-cacher-ng init script or +# in its configuration file. +# +# DirPerms: 00755 +# FilePerms: 00664 + +# It's possible to use use apt-cacher-ng as a regular web server with a limited +# feature set, i.e. directory browsing, downloads of any files, Content-Type +# based on /etc/mime.types, but without sorting, CGI execution, index page +# redirection and other funny things. +# To get this behavior, mappings between virtual directories and real +# directories on the server must be defined with the LocalDirs directive. +# Virtual and real directories are separated by spaces, multiple pairs are +# separated by semi-colons. Real directories must be absolute paths. +# NOTE: Since the names of that key directories share the same namespace as +# repository names (see Remap-...) it is administrator's job to avoid conflicts +# between them or explicitly create them. +# +# LocalDirs: woo /data/debarchive/woody ; hamm /data/debarchive/hamm +LocalDirs: acng-doc /usr/share/doc/apt-cacher-ng + +# Precache a set of files referenced by specified index files. This can be used +# to create a partial mirror usable for offline work. There are certain limits +# and restrictions on the path specification, see manual and the cache control +# web site for details. A list of (maybe) relevant index files could be +# retrieved via "apt-get --print-uris update" on a client machine. +# +# Example: +# PrecacheFor: debrep/dists/unstable/*/source/Sources* debrep/dists/unstable/*/binary-amd64/Packages* + +# Arbitrary set of data to append to request headers sent over the wire. Should +# be a well formated HTTP headers part including newlines (DOS style) which +# can be entered as escape sequences (\r\n). +# +# RequestAppendix: X-Tracking-Choice: do-not-track\r\n + +# Specifies the IP protocol families to use for remote connections. Order does +# matter, first specified are considered first. Possible combinations: +# v6 v4 +# v4 v6 +# v6 +# v4 +# Default: use native order of the system's TCP/IP stack, influenced by the +# BindAddress value. +# +# ConnectProto: v6 v4 + +# Regular expiration algorithm finds package files which are no longer listed +# in any index file and removes them of them after a safety period. +# This option allows to keep more versions of a package in the cache after +# the safety period is over. +# +# KeepExtraVersions: 0 + +# Optionally uses TCP access control provided by libwrap, see hosts_access(5) +# for details. Daemon name is apt-cacher-ng. +# +# Default: guessed on startup by looking for explicit mention of apt-cacher-ng +# in /etc/hosts.allow or /etc/hosts.deny files. +# +# UseWrap: 0 + +# If many machines from the same local network attempt to update index files +# (apt-get update) at nearly the same time, the known state of these index file +# is temporarily frozen and multiple requests receive the cached response +# without contacting the remote server again. This parameter (in seconds) +# specifies the length of this period before these (volatile) files are +# considered outdated. +# Setting this value too low transfers more data and increases remote server +# load, setting this too high (more than a couple of minutes) increases the +# risk of delivering inconsistent responses to the clients. +# +# FreshIndexMaxAge: 27 + +# Usually the users are not allowed to specify custom TCP ports of remote +# mirrors in the requests, only the default HTTP port can be used (as +# workaround, proxy administrator can create Remap- rules with custom ports). +# This restriction can be disabled by specifying a list of allowed ports or 0 +# for any port. +# +AllowUserPorts: 80 443 + +# Normally the HTTP redirection responses are forwarded to the original caller +# (i.e. APT) which starts a new download attempt from the new URL. This +# solution is ok for client configurations with proxy mode but doesn't work +# well with configurations using URL prefixes in sources.list. To work around +# this the server can restart its own download with a redirection URL, +# configured with the following option. The downside is that this might be used +# to circumvent download source policies by malicious users. +# The RedirMax option specifies how many such redirects the server is allowed +# to follow per request, 0 disables the internal redirection. +# Default: guessed on startup, 0 if ForceManaged is used and 5 otherwise. +# +# RedirMax: 5 + +# There some broken HTTP servers and proxy servers in the wild which don't +# support the If-Range header correctly and return incorrect data when the +# contents of a (volatile) file changed. This also applies to incomplete +# resumed downloads. Setting VfileUseRangeOps to 0 disables Range-based +# requests (using purely If-Modified-Since and requesting the complete file +# instead, if changed). Setting it to a negative value removes even this check +# and means fetching the whole file from the beginning. +# +# VfileUseRangeOps: 1 +# +# Syncthing server: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053833 +VfileUseRangeOps: 0 + +# Allow data pass-through mode for certain hosts when requested by the client +# using a CONNECT request. This is particularly useful to allow access to SSL +# sites (https proxying). The string is a regular expression which should cover +# the server name with port and must be correctly formated and terminated. +# Examples: +# PassThroughPattern: private-ppa\.launchpad\.net:443$ +# PassThroughPattern: .* # this would allow CONNECT to everything +# +# Default: ^(bugs\.debian\.org|changelogs\.ubuntu\.com):443$ +# PassThroughPattern: ^(bugs\.debian\.org|changelogs\.ubuntu\.com):443$ +PassThroughPattern: ^codecs\.fedoraproject\.org:443$ + +# Interval an overaged local cache item (i.e. active file descriptor) can be +# considered broken so that a new forced download can be started. Such +# situation can happen when a very slow clients keeps a hot cache item active +# for extended amounts of time so that even the remote freshness checks +# intervals might become overrun. +# +# Default time is based on the value of FreshIndexMaxAge with a safety factor. +# +# ResponseFreezeDetectTime: 60 + +# Keep outgoing connections alive and reuse them for later downloads from +# the same server as long as possible. +# +# ReuseConnections: 1 + +# Maximum number of requests sent in a batch to remote servers before the first +# response is expected. Using higher values can greatly improve average +# throughput depending on network latency and the implementation of remote +# servers. Makes most sense when also enabled on the client side, see apt.conf +# documentation for details. +# +# Default: 10 if ReuseConnections is set, 1 otherwise +# +# PipelineDepth: 10 + +# Path to the system directory containing trusted CA certificates used for +# outgoing connections, see OpenSSL documentation for details. +# +# CApath: /etc/ssl/certs +# +# Path to a single trusted trusted CA certificate used for outgoing +# connections, see OpenSSL documentation for details. +# +# CAfile: + +# There are different ways to detect that an upstream proxy is broken and turn +# off its use and connect directly. The first is through a custom command - +# when it returns successfully, the proxy is used, otherwise not and the +# command will be rerun only after a specified period. +# Another way is to try to connect to the proxy first and detect a connection +# timeout. The connection will then be made without HTTP proxy for the life +# time of the particular download stream and it may also affect other other +# parallel downloads. +# NOTE: this operation modes are still experimental and are subject to change! +# Unwanted side effects may occur with multiple simultaneous user connections +# or with specific per-repository proxy settings. +# +# Shell command, default: not set. Executed with the default shell and +# permissions of the apt-cacher-ng's process user. Examples: +# /bin/ip route | grep -q 192.168.117 +# /usr/sbin/arp | grep -q 00:22:1f:51:8e:c1 +# +# OptProxyCheckCommand: ... +# +# Check intervall, in seconds. +# +# OptProxyCheckInterval: 99 +# +# Conection timeout in seconds, default: negative, means disabled. +# +# OptProxyTimeout: -1 + +# It's possible to limit the processing speed of download agents to set an +# overall download speed limit. Unit: KiB/s, Default: unlimited. +# +# MaxDlSpeed: 500 + +# In special corner cases, download clients attempt to download random chunks +# of a files headers, i.e. the first kilobytes. The "don't get client stuck" +# policy converts this usually to a 200 response starting the body from the +# beginning but that confuses some clients. When this option is set to a +# certain value, this modifies the behaviour and allows to start a file +# download where the distance between available data and the specified range +# lies within that bounds. This can look like random lag for the user but +# should be harmless apart from that. +# +# MaxInresponsiveDlSize: 64000 + +# In mobile environments having an adhoc connection with a redirection to some +# id verification side, this redirect might damage the cache since the data is +# involuntarily stored as package data. There is a mechanism which attempts to +# detect a such situation and mitigate the mentioned effects by not storing the +# data and also dropping the DNS cache. The trigger is the occurrence of a +# specific SUBSTRING in the content type field of the final download target +# (i.e. the auth web site) and at least one followed redirection. +# +# BadRedirDetectMime: text/html + +# When a BUS signal is received (typically on IO errors), a shell command can be +# executed before the daemon is terminated. +# Example: +# BusAction: ls -l /proc/$PPID/ | mail -s SIGBUS! root + +# Only set this value for debugging purposes. It disables SSL security checks +# like strict host verification. 0 means no, any other value can have +# differrent meaning in the future. +# +# NoSSLChecks: 0 + +# Setting this value means: on file downloads from/via cache, tag relevant +# files. And when acngtool runs the shrink command, it will look at the day +# when the file was retrieved from cache last time (and not when it was +# originally downloaded). +# +# TrackFileUse: 0 + +# Controls preallocation of file system space where this feature is supported. +# This might reduce disk fragmentation and therefore improve later read +# performance. However, write performance can be reduced which could be +# exploited by malicious users. +# The value defines a size limit of how much to report to the OS as expected +# file size (starting from the beginning of the file). +# Set to zero to disable this feature completely. Default: one megabyte +# +# ReserveSpace: 1048576 + +# PermitCacheControl will allow users to specify a few hints for processing +# of a request, for example bypassing the local cache (see +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control for +# no-cache, no-store). +# +# PermitCacheControl: no-cache, no-store diff --git a/salt/sys-cacher/files/server/mimeapps.list b/salt/sys-cacher/files/server/mimeapps.list new file mode 100644 index 0000000..641dbff --- /dev/null +++ b/salt/sys-cacher/files/server/mimeapps.list @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2023 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Default Applications] +x-scheme-handler/http=cacher-browser-general.desktop +x-scheme-handler/https=cacher-browser-general.desktop diff --git a/salt/sys-cacher/files/server/mirrors/archlx_mirrors b/salt/sys-cacher/files/server/mirrors/archlx_mirrors new file mode 100644 index 0000000..f14b993 --- /dev/null +++ b/salt/sys-cacher/files/server/mirrors/archlx_mirrors @@ -0,0 +1,349 @@ +# SPDX-FileCopyrightText: 2022 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +http://arch.hu.fo/archlinux/ +http://arch.jensgutermuth.de/ +http://arch.lucassymons.net/ +http://arch.midov.pl/arch/ +http://arch.mirror.constant.com/ +http://arch.mirror.far.fi/ +http://arch.mirror.square-r00t.net/ +http://arch.mirror.zachlge.org/ +http://arch.mirrors.lavatech.top/ +http://arch.mirrors.pair.com/ +http://arch.nimukaito.net/ +http://arch.nixlab.pl/ +http://arch.opnmirror.co.za/ +http://arch.petarmaric.com/ +http://arch.serverspace.co.uk/arch/ +http://arch.softver.org.mk/archlinux/ +http://arch.yourlabs.org/ +http://archimonde.ts.si/archlinux/ +http://archlinux.c3sl.ufpr.br/ +http://archlinux.ccns.ncku.edu.tw/archlinux/ +http://archlinux.cs.nctu.edu.tw/ +http://archlinux.cu.be/ +http://archlinux.de-labrusse.fr/ +http://archlinux.dynamict.se/ +http://archlinux.grena.ge/ +http://archlinux.honkgong.info/ +http://archlinux.ip-connect.vn.ua/ +http://archlinux.iskon.hr/ +http://archlinux.koyanet.lv/archlinux/ +http://archlinux.mailtunnel.eu/ +http://archlinux.mirror.ba/ +http://archlinux.mirror.colo-serv.net/ +http://archlinux.mirror.digitalpacific.com.au/ +http://archlinux.mirror.garr.it/archlinux/ +http://archlinux.mirror.iphh.net/ +http://archlinux.mirror.kangaroot.net/ +http://archlinux.mirror.liquidtelecom.com/ +http://archlinux.mirror.liteserver.nl/ +http://archlinux.mirror.pcextreme.nl/ +http://archlinux.mirror.py/archlinux/ +http://archlinux.mirror.rafal.ca/ +http://archlinux.mirror.root.lu/ +http://archlinux.mirror.server24.net/ +http://archlinux.mirror.wearetriple.com/ +http://archlinux.mirrors.benatherton.com/ +http://archlinux.mirrors.linux.ro/ +http://archlinux.mirrors.ovh.net/archlinux/ +http://archlinux.mirrors.uk2.net/ +http://archlinux.nautile.nc/archlinux/ +http://archlinux.polymorf.fr/ +http://archlinux.pop-es.rnp.br/ +http://archlinux.rezopole.net/ +http://archlinux.surlyjake.com/archlinux/ +http://archlinux.thaller.ws/ +http://archlinux.uib.no/ +http://archlinux.uk.mirror.allworldit.com/archlinux/ +http://archlinux.za.mirror.allworldit.com/archlinux/ +http://archlinux.zepto.cloud/ +http://archmirror.hbit.sztaki.hu/archlinux/ +http://archmirror1.octyl.net/ +http://arlm.tyzoid.com/ +http://artfiles.org/archlinux.org/ +http://br.mirror.archlinux-br.org/ +http://ca.us.mirror.archlinux-br.org/ +http://dfw.mirror.rackspace.com/archlinux/ +http://distro.ibiblio.org/archlinux/ +http://f.archlinuxvn.org/archlinux/ +http://free.nchc.org.tw/arch/ +http://ftp-stud.hs-esslingen.de/pub/Mirrors/archlinux/ +http://ftp.acc.umu.se/mirror/archlinux/ +http://ftp.agdsn.de/pub/mirrors/archlinux/ +http://ftp.byfly.by/pub/archlinux/ +http://ftp.cc.uoc.gr/mirrors/linux/archlinux/ +http://ftp.energia.mta.hu/pub/mirrors/ftp.archlinux.org/ +http://ftp.fau.de/archlinux/ +http://ftp.fi.muni.cz/pub/linux/arch/ +http://ftp.gwdg.de/pub/linux/archlinux/ +http://ftp.halifax.rwth-aachen.de/archlinux/ +http://ftp.harukasan.org/archlinux/ +http://ftp.heanet.ie/mirrors/ftp.archlinux.org/ +http://ftp.hosteurope.de/mirror/ftp.archlinux.org/ +http://ftp.icm.edu.pl/pub/Linux/dist/archlinux/ +http://ftp.iinet.net.au/pub/archlinux/ +http://ftp.jaist.ac.jp/pub/Linux/ArchLinux/ +http://ftp.lanet.kr/pub/archlinux/ +http://ftp.linux.cz/pub/linux/arch/ +http://ftp.linux.org.tr/archlinux/ +http://ftp.lysator.liu.se/pub/archlinux/ +http://ftp.myrveln.se/pub/linux/archlinux/ +http://ftp.nluug.nl/os/Linux/distr/archlinux/ +http://ftp.ntua.gr/pub/linux/archlinux/ +http://ftp.osuosl.org/pub/archlinux/ +http://ftp.otenet.gr/linux/archlinux/ +http://ftp.rediris.es/mirror/archlinux/ +http://ftp.rnl.tecnico.ulisboa.pt/pub/archlinux/ +http://ftp.sh.cvut.cz/arch/ +http://ftp.snt.utwente.nl/pub/os/linux/archlinux/ +http://ftp.spline.inf.fu-berlin.de/mirrors/archlinux/ +http://ftp.sudhip.com/archlinux/ +http://ftp.swin.edu.au/archlinux/ +http://ftp.tku.edu.tw/Linux/ArchLinux/ +http://ftp.tsukuba.wide.ad.jp/Linux/archlinux/ +http://ftp.tu-chemnitz.de/pub/linux/archlinux/ +http://ftp.u-strasbg.fr/linux/distributions/archlinux/ +http://ftp.uni-bayreuth.de/linux/archlinux/ +http://ftp.uni-hannover.de/archlinux/ +http://ftp.uni-kl.de/pub/linux/archlinux/ +http://ftp.vectranet.pl/archlinux/ +http://ftp.wrz.de/pub/archlinux/ +http://ftp.yzu.edu.tw/Linux/archlinux/ +http://ftpmirror.infania.net/mirror/archlinux/ +http://glua.ua.pt/pub/archlinux/ +http://gluttony.sin.cvut.cz/arch/ +http://hkg.mirror.rackspace.com/archlinux/ +http://iad.mirror.rackspace.com/archlinux/ +http://iad.mirrors.misaka.one/archlinux/ +http://il.us.mirror.archlinux-br.org/ +http://linorg.usp.br/archlinux/ +http://linux.rz.rub.de/archlinux/ +http://lon.mirror.rackspace.com/archlinux/ +http://mir.archlinux.fr/ +http://mirroir.wptheme.fr/archlinux/ +http://mirror-archlinux.webruimtehosting.nl/ +http://mirror-hk.koddos.net/archlinux/ +http://mirror.0x.sg/archlinux/ +http://mirror.23media.com/archlinux/ +http://mirror.aktkn.sg/archlinux/ +http://mirror.ams1.nl.leaseweb.net/archlinux/ +http://mirror.anigil.com/archlinux/ +http://mirror.anquan.cl/archlinux/ +http://mirror.archlinux.cl/ +http://mirror.archlinux.ikoula.com/archlinux/ +http://mirror.archlinux.no/ +http://mirror.arctic.lol/ArchMirror/ +http://mirror.arizona.edu/archlinux/ +http://mirror.bizflycloud.vn/archlinux/ +http://mirror.bytemark.co.uk/archlinux/ +http://mirror.cc.columbia.edu/pub/linux/archlinux/ +http://mirror.cedia.org.ec/archlinux/ +http://mirror.cedille.club/archlinux/ +http://mirror.chaoticum.net/arch/ +http://mirror.checkdomain.de/archlinux/ +http://mirror.clientvps.com/archlinux/ +http://mirror.cs.pitt.edu/archlinux/ +http://mirror.cs.vt.edu/pub/ArchLinux/ +http://mirror.csclub.uwaterloo.ca/archlinux/ +http://mirror.cse.iitk.ac.in/archlinux/ +http://mirror.cspacehostings.com/archlinux/ +http://mirror.cyberbits.eu/archlinux/ +http://mirror.dal10.us.leaseweb.net/archlinux/ +http://mirror.datacenter.by/pub/archlinux/ +http://mirror.digitalnova.at/archlinux/ +http://mirror.dkm.cz/archlinux/ +http://mirror.easylee.nl/archlinux/ +http://mirror.easyname.at/archlinux/ +http://mirror.efect.ro/archlinux/ +http://mirror.es.its.nyu.edu/archlinux/ +http://mirror.espoch.edu.ec/archlinux/ +http://mirror.ette.biz/archlinux/ +http://mirror.f4st.host/archlinux/ +http://mirror.faizuladib.com/archlinux/ +http://mirror.fra10.de.leaseweb.net/archlinux/ +http://mirror.fsmg.org.nz/archlinux/ +http://mirror.fsrv.services/archlinux/ +http://mirror.gi.co.id/archlinux/ +http://mirror.guillaumea.fr/archlinux/ +http://mirror.hackingand.coffee/arch/ +http://mirror.host.ag/archlinux/ +http://mirror.hoster.kz/archlinux/ +http://mirror.hosthink.net/archlinux/ +http://mirror.i3d.net/pub/archlinux/ +http://mirror.ibcp.fr/pub/archlinux/ +http://mirror.ihost.md/archlinux/ +http://mirror.init7.net/archlinux/ +http://mirror.internode.on.net/pub/archlinux/ +http://mirror.is.co.za/mirror/archlinux.org/ +http://mirror.isoc.org.il/pub/archlinux/ +http://mirror.its.dal.ca/archlinux/ +http://mirror.juniorjpdj.pl/archlinux/ +http://mirror.kaminski.io/archlinux/ +http://mirror.kku.ac.th/archlinux/ +http://mirror.koddos.net/archlinux/ +http://mirror.kumi.systems/archlinux/ +http://mirror.labkom.id/archlinux/ +http://mirror.lagoon.nc/pub/archlinux/ +http://mirror.lastmikoi.net/archlinux/ +http://mirror.launtel.net.au/repo/arch/ +http://mirror.librelabucm.org/archlinux/ +http://mirror.lnx.sk/pub/linux/archlinux/ +http://mirror.lty.me/archlinux/ +http://mirror.lyrahosting.com/archlinux/ +http://mirror.lzu.edu.cn/archlinux/ +http://mirror.math.princeton.edu/pub/archlinux/ +http://mirror.metalgamer.eu/archlinux/ +http://mirror.metrocast.net/archlinux/ +http://mirror.mia11.us.leaseweb.net/archlinux/ +http://mirror.mijn.host/archlinux/ +http://mirror.mikrogravitation.org/archlinux/ +http://mirror.mirohost.net/archlinux/ +http://mirror.nak-mci.ir/arch/ +http://mirror.neostrada.nl/archlinux/ +http://mirror.netcologne.de/archlinux/ +http://mirror.netweaver.uk/archlinux/ +http://mirror.neuf.no/archlinux/ +http://mirror.nus.edu.sg/archlinux/ +http://mirror.oldsql.cc/archlinux/ +http://mirror.one.com/archlinux/ +http://mirror.onet.pl/pub/mirrors/archlinux/ +http://mirror.onevip.mk/archlinux/ +http://mirror.orbit-os.com/archlinux/ +http://mirror.papua.go.id/archlinux/ +http://mirror.pit.teraswitch.com/archlinux/ +http://mirror.pmf.kg.ac.rs/archlinux/ +http://mirror.poliwangi.ac.id/archlinux/ +http://mirror.premi.st/archlinux/ +http://mirror.ps.kz/archlinux/ +http://mirror.pseudoform.org/ +http://mirror.puzzle.ch/archlinux/ +http://mirror.rackspace.com/archlinux/ +http://mirror.rasanegar.com/archlinux/ +http://mirror.redrock.team/archlinux/ +http://mirror.reisenbauer.ee/archlinux/ +http://mirror.rise.ph/archlinux/ +http://mirror.rol.ru/archlinux/ +http://mirror.satis-faction.de/archlinux/ +http://mirror.scd31.com/arch/ +http://mirror.selfnet.de/archlinux/ +http://mirror.sergal.org/archlinux/ +http://mirror.serverion.com/archlinux/ +http://mirror.sfinae.tech/pub/mirrors/archlinux/ +http://mirror.sfo12.us.leaseweb.net/archlinux/ +http://mirror.siena.edu/archlinux/ +http://mirror.smith.geek.nz/archlinux/ +http://mirror.stephen304.com/archlinux/ +http://mirror.surf/archlinux/ +http://mirror.system.is/arch/ +http://mirror.t-home.mk/archlinux/ +http://mirror.tarellia.net/distr/archlinux/ +http://mirror.telepoint.bg/archlinux/ +http://mirror.telkomuniversity.ac.id/archlinux/ +http://mirror.terrahost.no/linux/archlinux/ +http://mirror.tiguinet.net/arch/ +http://mirror.truenetwork.ru/archlinux/ +http://mirror.ubrco.de/archlinux/ +http://mirror.ufam.edu.br/archlinux/ +http://mirror.ufro.cl/archlinux/ +http://mirror.ufscar.br/archlinux/ +http://mirror.umd.edu/archlinux/ +http://mirror.undisclose.de/archlinux/ +http://mirror.united-gameserver.de/archlinux/ +http://mirror.uta.edu.ec/archlinux/ +http://mirror.veriteknik.net.tr/archlinux/ +http://mirror.vpsfree.cz/archlinux/ +http://mirror.vtti.vt.edu/archlinux/ +http://mirror.wdc1.us.leaseweb.net/archlinux/ +http://mirror.wtnet.de/arch/ +http://mirror.wuki.li/archlinux/ +http://mirror.xeonbd.com/archlinux/ +http://mirror.xtom.com.hk/archlinux/ +http://mirror.yandex.ru/archlinux/ +http://mirror1.cl.netactuate.com/archlinux/ +http://mirror2.evolution-host.com/archlinux/ +http://mirror2.totbb.net/archlinux/ +http://mirrors.163.com/archlinux/ +http://mirrors.acm.wpi.edu/archlinux/ +http://mirrors.advancedhosters.com/archlinux/ +http://mirrors.aggregate.org/archlinux/ +http://mirrors.atviras.lt/archlinux/ +http://mirrors.bfsu.edu.cn/archlinux/ +http://mirrors.cat.net/archlinux/ +http://mirrors.cat.pdx.edu/archlinux/ +http://mirrors.celianvdb.fr/archlinux/ +http://mirrors.chroot.ro/archlinux/ +http://mirrors.cqu.edu.cn/archlinux/ +http://mirrors.dgut.edu.cn/archlinux/ +http://mirrors.dotsrc.org/archlinux/ +http://mirrors.evowise.com/archlinux/ +http://mirrors.gethosted.online/archlinux/ +http://mirrors.gigenet.com/archlinux/ +http://mirrors.go.ro/archlinux/ +http://mirrors.hit.edu.cn/archlinux/ +http://mirrors.hostico.ro/archlinux/ +http://mirrors.ims.nksc.lt/archlinux/ +http://mirrors.kernel.org/archlinux/ +http://mirrors.liquidweb.com/archlinux/ +http://mirrors.lug.mtu.edu/archlinux/ +http://mirrors.m247.ro/archlinux/ +http://mirrors.manchester.m247.com/arch-linux/ +http://mirrors.melbourne.co.uk/archlinux/ +http://mirrors.mit.edu/archlinux/ +http://mirrors.myaegean.gr/linux/archlinux/ +http://mirrors.n-ix.net/archlinux/ +http://mirrors.nav.ro/archlinux/ +http://mirrors.netix.net/archlinux/ +http://mirrors.neusoft.edu.cn/archlinux/ +http://mirrors.nic.cz/archlinux/ +http://mirrors.nix.org.ua/linux/archlinux/ +http://mirrors.niyawe.de/archlinux/ +http://mirrors.nju.edu.cn/archlinux/ +http://mirrors.nxthost.com/archlinux/ +http://mirrors.ocf.berkeley.edu/archlinux/ +http://mirrors.piconets.webwerks.in/archlinux-mirror/ +http://mirrors.pidginhost.com/arch/ +http://mirrors.powernet.com.ru/archlinux/ +http://mirrors.prometeus.net/archlinux/ +http://mirrors.rit.edu/archlinux/ +http://mirrors.rutgers.edu/archlinux/ +http://mirrors.sonic.net/archlinux/ +http://mirrors.standaloneinstaller.com/archlinux/ +http://mirrors.tuna.tsinghua.edu.cn/archlinux/ +http://mirrors.udenar.edu.co/archlinux/ +http://mirrors.ukfast.co.uk/sites/archlinux.org/ +http://mirrors.uni-plovdiv.net/archlinux/ +http://mirrors.urbanwave.co.za/archlinux/ +http://mirrors.ustc.edu.cn/archlinux/ +http://mirrors.xmission.com/archlinux/ +http://mirrors.xtom.com/archlinux/ +http://mirrors.xtom.nl/archlinux/ +http://mirrors.zju.edu.cn/archlinux/ +http://muug.ca/mirror/archlinux/ +http://nova.quantum-mirror.hu/mirrors/pub/archlinux/ +http://ord.mirror.rackspace.com/archlinux/ +http://packages.oth-regensburg.de/archlinux/ +http://phinau.de/arch/ +http://piotrkosoft.net/pub/mirrors/ftp.archlinux.org/ +http://pkg.adfinis.com/archlinux/ +http://plug-mirror.rcac.purdue.edu/archlinux/ +http://quantum-mirror.hu/mirrors/pub/archlinux/ +http://repo.ialab.dsu.edu/archlinux/ +http://repo.inara.pk/archlinux/ +http://repo.iut.ac.ir/repo/archlinux/ +http://repo.miserver.it.umich.edu/archlinux/ +http://shadow.ind.ntou.edu.tw/archlinux/ +http://sharing.thelinuxsect.com/archlinux/ +http://super.quantum-mirror.hu/mirrors/pub/archlinux/ +http://suro.ubaya.ac.id/archlinux/ +http://syd.mirror.rackspace.com/archlinux/ +http://tedwall.se/archlinux/ +http://tux.rainside.sk/archlinux/ +http://vpsmurah.jagoanhosting.com/archlinux/ +http://www.caco.ic.unicamp.br/archlinux/ +http://www.gtlib.gatech.edu/pub/archlinux/ +http://www.gutscheindrache.com/mirror/archlinux/ +http://www.mirrorservice.org/sites/ftp.archlinux.org/ +http://za.mirror.archlinux-br.org/ diff --git a/salt/sys-cacher/files/server/mirrors/fedora_mirrors b/salt/sys-cacher/files/server/mirrors/fedora_mirrors new file mode 100644 index 0000000..6d4a714 --- /dev/null +++ b/salt/sys-cacher/files/server/mirrors/fedora_mirrors @@ -0,0 +1,154 @@ +# SPDX-FileCopyrightText: 2022 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +http://archive.linux.duke.edu/pub/fedora/linux/ +http://distrib-coffee.ipsl.jussieu.fr/pub/linux/fedora/linux/ +http://dl.fedoraproject.org +http://download-cc-rdu01.fedoraproject.org/pub/fedora/linux/ +http://download-ib01.fedoraproject.org/pub/fedora/linux +http://download.fedoraproject.org/pub/fedora/linux/ +http://fedora-mirror01.rbc.ru/pub/fedora/linux/ +http://fedora.blizoo.mk/fedora/linux/ +http://fedora.cu.be +http://fedora.ip-connect.info +http://fedora.ipacct.com +http://fedora.is.co.za/linux/ +http://fedora.mirror.angkasa.id/pub/fedora/linux/ +http://fedora.mirror.constant.com +http://fedora.mirror.digitalpacific.com.au/linux/ +http://fedora.mirror.garr.it +http://fedora.mirror.iweb.com/linux/ +http://fedora.mirror.liteserver.nl +http://fedora.mirror.root.lu/ +http://fedora.mirror.tn/pub/fedora/linux/ +http://fedora.mirror.wearetriple.com +http://fedora.mirrors.pair.com/linux/ +http://fedora.mirrors.telekom.ro/pub/fedora/linux/ +http://fedora.mirrorservice.org +http://fedora.tu-chemnitz.de/pub/linux/fedora/linux/ +http://fr2.rpmfind.net/linux/fedora/linux/ +http://free.nchc.org.tw/fedora/linux/ +http://ftp-nyc.osuosl.org +http://ftp-stud.hs-esslingen.de/pub/fedora/linux/ +http://ftp.acc.umu.se/mirror/fedora/linux/ +http://ftp.byfly.by/pub/fedoraproject.org/linux/ +http://ftp.cc.uoc.gr/pub/linux/fedora/linux/ +http://ftp.cica.es/fedora/linux/ +http://ftp.colocall.net/pub/fedora/linux/ +http://ftp.cse.buffalo.edu/pub/fedora/linux/ +http://ftp.fau.de/fedora/linux/ +http://ftp.fi.muni.cz/pub/linux/fedora/linux/ +http://ftp.halifax.rwth-aachen.de/fedora/linux/ +http://ftp.icm.edu.pl/pub/Linux/fedora/linux/ +http://ftp.iij.ad.jp/pub/linux/Fedora/fedora/linux/ +http://ftp.ines.lug.ro/fedora/linux/ +http://ftp.jaist.ac.jp/pub/Linux/Fedora/ +http://ftp.linux.cz/pub/linux/fedora/linux/ +http://ftp.lip6.fr/ftp/pub/linux/distributions/fedora/ +http://ftp.lysator.liu.se/pub/fedora/linux/ +http://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/ +http://ftp.ntua.gr/pub/linux/fedora/linux/ +http://ftp.plusline.net/fedora/linux/ +http://ftp.tsukuba.wide.ad.jp/Linux/fedora/linux/ +http://ftp.tudelft.nl/download.fedora.redhat.com/linux/ +http://ftp.uma.es/mirror/fedora/linux/ +http://ftp.uni-bayreuth.de/linux/fedora/linux/ +http://ftp.uni-kl.de/pub/linux/fedora/linux/ +http://ftp.uni-stuttgart.de/epel/ +http://ftp.upjs.sk/pub/fedora/linux/ +http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/fedora/linux/ +http://ftp.yzu.edu.tw/Linux/Fedora/linux/ +http://kdeforge2.unl.edu/mirrors/fedora/linux/ +http://linux.mirrors.es.net/fedora/ +http://mirror.1000mbps.com/fedora/linux/ +http://mirror.23m.com +http://mirror.23media.de/fedora/linux/ +http://mirror.aarnet.edu.au/pub/fedora/linux/ +http://mirror.bytemark.co.uk/fedora/epel/ +http://mirror.bytemark.co.uk/fedora/linux/ +http://mirror.cedia.org.ec/fedora/linux/ +http://mirror.chpc.utah.edu/pub/fedora/linux/ +http://mirror.clarkson.edu/fedora/linux/ +http://mirror.cogentco.com/pub/linux/fedora/linux/ +http://mirror.cs.pitt.edu/fedora/linux/ +http://mirror.cs.princeton.edu/pub/mirrors/fedora/linux/ +http://mirror.csclub.uwaterloo.ca/fedora/linux/ +http://mirror.datacenter.by/pub/fedoraproject.org/linux/ +http://mirror.de.leaseweb.net/fedora/linux/ +http://mirror.dogado.de/fedora/linux/ +http://mirror.easyspeedy.com/fedora/ +http://mirror.epn.edu.ec/fedora/linux/ +http://mirror.etf.bg.ac.rs/fedora/ +http://mirror.euserv.net/linux/fedora/linux/ +http://mirror.globo.com/fedora/linux/ +http://mirror.i3d.net/pub/fedora/linux/ +http://mirror.in2p3.fr/pub/fedora/linux/ +http://mirror.infonline.de/fedora/linux/ +http://mirror.init7.net/fedora/fedora/linux/ +http://mirror.its.dal.ca/pub/fedora/linux/ +http://mirror.karneval.cz/pub/linux/fedora/linux/ +http://mirror.lagoon.nc/pub/fedora/linux/ +http://mirror.library.ucy.ac.cy/linux/fedora/linux/ +http://mirror.linux-ia64.org/fedora/linux/ +http://mirror.metrocast.net/fedora/linux/ +http://mirror.mrjester.net/fedora/linux/ +http://mirror.netcologne.de/fedora/linux/ +http://mirror.netsite.dk/fedora/linux/ +http://mirror.nexcess.net/fedora/ +http://mirror.nl.leaseweb.net/fedora/linux/ +http://mirror.nonstop.co.il/fedora/linux/ +http://mirror.onet.pl/pub/mirrors/fedora/linux/ +http://mirror.optus.net/fedora/linux/ +http://mirror.pmf.kg.ac.rs/fedora/linux/ +http://mirror.pnl.gov/fedora/linux/ +http://mirror.prgmr.com/pub/fedora/linux/ +http://mirror.realcompute.io/fedora/linux/ +http://mirror.rise.ph/fedora/linux/ +http://mirror.rnet.missouri.edu/fedora/linux/ +http://mirror.seas.harvard.edu/fedora/linux/ +http://mirror.sfo12.us.leaseweb.net/fedora/linux/ +http://mirror.slu.cz/fedora/linux/ +http://mirror.smartmedia.net.id/fedora/linux/ +http://mirror.steadfast.net/fedora/ +http://mirror.steadfastnet.com/epel/ +http://mirror.switch.ch/ftp/mirror/fedora/linux/ +http://mirror.szerverem.hu/fedora/linux/ +http://mirror.telepoint.bg/fedora/ +http://mirror.umd.edu/fedora/linux/ +http://mirror.upb.edu.co/fedora/linux/ +http://mirror.us.leaseweb.net/fedora/linux/ +http://mirror.uta.edu.ec/fedora/linux/ +http://mirror.utexas.edu/fedora/linux/ +http://mirror.uv.es/mirror/fedora/linux/ +http://mirror.veriteknik.net.tr/fedora/linux/ +http://mirror.vorboss.net/fedora/linux/ +http://mirror.vpsnet.com/fedora/linux/ +http://mirror.vutbr.cz/fedora/ +http://mirror.yandex.ru/fedora/linux/ +http://mirror2.totbb.net/fedora/linux/ +http://mirrors.cat.pdx.edu/fedora/linux/ +http://mirrors.dotsrc.org/fedora/linux/ +http://mirrors.fedoraproject.org +http://mirrors.ircam.fr/pub/fedora/linux/ +http://mirrors.kernel.org/fedora/ +http://mirrors.lug.mtu.edu/fedora/linux/ +http://mirrors.mit.edu/fedora/linux/ +http://mirrors.n-ix.net/fedora/linux/ +http://mirrors.nav.ro/fedora/linux/ +http://mirrors.netix.net/fedora/linux/ +http://mirrors.nic.cz/fedora/linux/ +http://mirrors.syringanetworks.net/fedora/linux/ +http://mirrors.uni-ruse.bg/fedora/linux/ +http://mirrors.xmission.com/fedora/linux/ +http://mirrors.xtom.de +http://muug.ca/mirror/fedora/linux/ +http://opensource.nchc.org.tw/fedora/linux/ +http://packages.oit.ncsu.edu +http://pubmirror1.math.uh.edu/fedora-buffet/fedora/linux/ +http://pubmirror2.math.uh.edu/fedora-buffet/fedora/linux/ +http://ucmirror.canterbury.ac.nz/linux/fedora/linux/ +http://vesta.informatik.rwth-aachen.de/ftp/pub/Linux/fedora/linux/ +http://www.fedora.is/fedora/linux/ +http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/fedora/linux/ +http://www.nic.funet.fi/pub/mirrors/fedora.redhat.com/pub/fedora/linux/ diff --git a/salt/sys-cacher/init.top b/salt/sys-cacher/init.top new file mode 100644 index 0000000..c09d020 --- /dev/null +++ b/salt/sys-cacher/init.top @@ -0,0 +1,19 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-cacher.create + 'tpl-sys-cacher': + - sys-cacher.install + 'sys-cacher': + - sys-cacher.configure + 'sys-cacher-browser': + - sys-cacher.configure-browser + 'I@qubes:type:template and not P@nodename:host and not P@nodename:whonix.*': + - match: compound + - sys-cacher.install-client diff --git a/salt/sys-cacher/install-client.sls b/salt/sys-cacher/install-client.sls new file mode 100644 index 0000000..f7dadb6 --- /dev/null +++ b/salt/sys-cacher/install-client.sls @@ -0,0 +1,72 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['os_family']|lower == 'debian' -%} +{% if not salt['file.file_exists']('/usr/share/whonix/marker') -%} +{% for repo in salt['file.find']('/etc/apt/sources.list.d/', name='*(list|sources)') -%} + {{ repo }}_baseurl: + file.replace: + - name: {{ repo }} + - pattern: 'https://' + - repl: 'http://HTTPS///' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False + +{% endfor -%} + + /etc/apt/sources.list: + file.replace: + - name: /etc/apt/sources.list + - pattern: 'https:' + - repl: 'http://HTTPS/' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False +{% endif -%} + +{% elif grains['os_family']|lower == 'arch' -%} + pacman: + file.replace: + - names: + - /etc/pacman.d/mirrorlist + - /etc/pacman.d/99-qubes-repository-4.1.conf.disabled + - pattern: 'https:' + - repl: 'http://HTTPS/' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False + +{% elif grains['os_family']|lower == 'redhat' -%} +{% for repo in salt['file.find']('/etc/yum.repos.d/', name='*repo') -%} + {{ repo }}_baseurl: + file.replace: + - name: {{ repo }} + - pattern: 'baseurl(.*)https://' + - repl: 'baseurl\1http://HTTPS///' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False + {{ repo }}_metalink: + file.replace: + - name: {{ repo }} + - pattern: 'metalink=https://(.*)' + - repl: 'metalink=http://HTTPS///\1' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False + +{% endfor -%} +{% for repo in salt['file.find']('/etc/yum.repos.d/', name='rpmfusion*repo*') -%} + {{ repo }}_uncomment: + file.uncomment: + - name: {{ repo }} + - regex : '.*baseurl(.*)' + - backup: False + {{ repo }}_comment: + file.comment: + - name: {{ repo }} + - regex: '^metalink=http(.*)' + - ignore_missing: True + - backup: False + +{% endfor -%} +{% endif -%} diff --git a/salt/sys-cacher/install-client.top b/salt/sys-cacher/install-client.top new file mode 100644 index 0000000..7d76814 --- /dev/null +++ b/salt/sys-cacher/install-client.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'I@qubes:type:template and not P@nodename:host and not P@nodename:whonix.*': + - match: compound + - sys-cacher.install-client diff --git a/salt/sys-cacher/install.sls b/salt/sys-cacher/install.sls new file mode 100644 index 0000000..6076d2f --- /dev/null +++ b/salt/sys-cacher/install.sls @@ -0,0 +1,104 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-allow-testing-repository": + file.uncomment: + - name: /etc/apt/sources.list.d/qubes-r4.list + - regex: ^deb\s.*qubes-os.org.*-testing + - backup: false + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - qubes-app-shutdown-idle + - ca-certificates + - anacron + - apt-cacher-ng + +"{{ slsdotpath }}-disable-apt-cacher-ng": + cmd.run: + - name: systemctl disable apt-cacher-ng + +"{{ slsdotpath }}-mask-apt-cacher-ng": + service.masked: + - name: apt-cacher-ng + - runtime: False + +"{{ slsdotpath }}-install-backends_debian": + file.prepend: + - name: /etc/apt-cacher-ng/backends_debian + - text: https://deb.debian.org/debian + +"{{ slsdotpath }}-update-debian-mirrors": + cmd.run: + - name: cp /usr/lib/apt-cacher-ng/deb_mirrors.gz /etc/apt-cacher-ng/deb_mirrors.gz + - runas: root + +"{{ slsdotpath }}-update-fedora-mirrors": + file.managed: + - name: /etc/apt-cacher-ng/fedora_mirrors + - source: salt://{{ slsdotpath }}/files/server/mirrors/fedora_mirrors + - user: root + - group: root + +"{{ slsdotpath }}-update-arch-mirrors": + file.managed: + - name: /etc/apt-cacher-ng/archlx_mirrors + - source: salt://{{ slsdotpath }}/files/server/mirrors/archlx_mirrors + - user: root + - group: root + +"{{ slsdotpath }}-qubes-bind-dirs": + file.append: + - name: /usr/lib/qubes-bind-dirs.d/30_cron.conf + - text: "binds+=( ' /etc/anacrontab' )" + +"{{ slsdotpath }}-acng.conf": + file.managed: + - name: /etc/apt-cacher-ng/acng.conf + - source: salt://{{ slsdotpath }}/files/server/conf/acng.conf + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-desktop-application-browser": + file.managed: + - name: /usr/share/applications/cacher-browser.desktop + - source: salt://{{ slsdotpath }}/files/server/cacher-browser.desktop + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-desktop-application-open-general": + file.managed: + - name: /usr/share/applications/cacher-browser-general.desktop + - source: salt://{{ slsdotpath }}/files/server/cacher-browser-general.desktop + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-etc-mimeapps.list": + file.managed: + - name: /etc/xdg/mimeapps.list + - source: salt://{{ slsdotpath }}/files/server/mimeapps.list + - mode: '0644' + - user: root + - group: root + - makedirs: True + +{% endif -%} diff --git a/salt/sys-cacher/install.top b/salt/sys-cacher/install.top new file mode 100644 index 0000000..2adfc0b --- /dev/null +++ b/salt/sys-cacher/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-cacher': + - sys-cacher.install diff --git a/salt/sys-cacher/remove-policy.sls b/salt/sys-cacher/remove-policy.sls new file mode 100644 index 0000000..0063e2f --- /dev/null +++ b/salt/sys-cacher/remove-policy.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/policy.sls' import policy_unset with context -%} +{{ policy_unset(sls_path, '75') }} diff --git a/salt/sys-cacher/tag.sls b/salt/sys-cacher/tag.sls new file mode 100644 index 0000000..e4936af --- /dev/null +++ b/salt/sys-cacher/tag.sls @@ -0,0 +1,19 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% set avoid = salt['cmd.shell']('qvm-ls --no-spinner --raw-list --tags whonix-updatevm') -%} + +{% set exclude = salt['cmd.shell']('for qube in ' ~ avoid ~ '; do exclude="$exclude --exclude $qube"; done; echo "$exclude"') -%} + +{% set wanted = salt['cmd.shell']('qvm-ls --no-spinner --raw-data --fields=NAME,CLASS --all ' ~ exclude ~ ' | awk -F "|" "/|TemplateVM|/{print $1}"') -%} + +{% for tpl in wanted -%} +"{{ tpl }}-cacher-tag": + qvm.tags: + - name: {{ tpl }} + - add: + - sys-cacher-updatevm +{% endfor -%} diff --git a/salt/sys-cacher/tag.top b/salt/sys-cacher/tag.top new file mode 100644 index 0000000..d5708e0 --- /dev/null +++ b/salt/sys-cacher/tag.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-cacher.tag diff --git a/salt/sys-cacher/uninstall-client.sls b/salt/sys-cacher/uninstall-client.sls new file mode 100644 index 0000000..0ea8d52 --- /dev/null +++ b/salt/sys-cacher/uninstall-client.sls @@ -0,0 +1,57 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['os_family']|lower == 'debian' -%} +{% for repo in salt['file.find']('/etc/apt/sources.list.d/', name='*(list|sources)') -%} + {{ repo }}_baseurl: + file.replace: + - name: {{ repo }} + - pattern: 'http://HTTPS/' + - repl: 'https:' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False +{% endfor -%} + + /etc/apt/sources.list: + file.replace: + - name: /etc/apt/sources.list + - pattern: 'http://HTTPS/' + - repl: 'https:' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False + +{% elif grains['os_family']|lower == 'arch' -%} + pacman: + file.replace: + - names: + - /etc/pacman.d/mirrorlist + - /etc/pacman.d/99-qubes-repository-4.1.conf.disabled + - pattern: 'http://HTTPS///' + - repl: 'https://' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False + + +{% elif grains['os_family']|lower == 'redhat' -%} +{% for repo in salt['file.find']('/etc/yum.repos.d/', name='*repo*') -%} +{{ repo }}_baseurl: + file.replace: + - name: {{ repo }} + - pattern: 'baseurl(.*)http://HTTPS/' + - repl: 'baseurl\1https:' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False + +{{ repo }}_metalink: + file.replace: + - name: {{ repo }} + - pattern: 'metalink=http://HTTPS///(.*)' + - repl: 'metalink=https://\1' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + - backup: False + +{% endfor -%} +{% endif -%} diff --git a/salt/sys-cacher/uninstall-client.top b/salt/sys-cacher/uninstall-client.top new file mode 100644 index 0000000..0843f46 --- /dev/null +++ b/salt/sys-cacher/uninstall-client.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'qubes:type:template': + - match: pillar + - sys-cacher.uninstall-client diff --git a/salt/sys-cacher/untag.sls b/salt/sys-cacher/untag.sls new file mode 100644 index 0000000..ab93716 --- /dev/null +++ b/salt/sys-cacher/untag.sls @@ -0,0 +1,15 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% set wanted = salt['cmd.shell']('qvm-ls --no-spinner --raw-list') -%} + +{% for tpl in wanted.replace(",", " ") -%} +"{{ tpl }}-cacher-untag": + qvm.tags: + - name: {{ tpl }} + - del: + - sys-cacher-updatevm +{% endfor -%} diff --git a/salt/sys-cacher/untag.top b/salt/sys-cacher/untag.top new file mode 100644 index 0000000..9a5d08d --- /dev/null +++ b/salt/sys-cacher/untag.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-cacher.untag diff --git a/salt/sys-firewall/README.md b/salt/sys-firewall/README.md new file mode 100644 index 0000000..9651ab9 --- /dev/null +++ b/salt/sys-firewall/README.md @@ -0,0 +1,50 @@ +# sys-firewall + +Firewall in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Creates firewall qube, an App qube "sys-firewall" and a Disposable qube +"disp-sys-firewall". By default, "sys-firewall" will be the "updatevm" and the +"default_netvm", but you can configure "disp-sys-firewall" to take on these +roles if you prefer, later instructed in the installation section below. + +If you want an easy to configure firewall with ad blocking, checkout +sys-pihole instead. + +## Installation + +- Top: +```sh +qubesctl top.enable sys-firewall +qubesctl --targets=tpl-sys-firewall state.apply +qubesctl top.disable sys-firewall +qubesctl state.apply sys-firewall.prefs +``` + +- State: + +```sh +qubesctl state.apply sys-firewall.create +qubesctl --skip-dom0 --targets=tpl-sys-firewall state.apply sys-firewall.install +qubesctl state.apply sys-firewall.prefs +``` + + +Alternatively, if you prefer to have a disposable firewall: +```sh +qubesctl state.apply sys-firewall.prefs-disp +``` + +## Usage + +You should use this qube for handling updates and firewall downstream/client +qubes, in other words, enforce network policy to qubes that have +`sys-firewall` as its `netvm`. Read [upstream firewall +documentation](https://www.qubes-os.org/doc/firewall/). diff --git a/salt/sys-firewall/clone.sls b/salt/sys-firewall/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-firewall/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-firewall/clone.top b/salt/sys-firewall/clone.top new file mode 100644 index 0000000..49bfa23 --- /dev/null +++ b/salt/sys-firewall/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-firewall.clone diff --git a/salt/sys-firewall/create.sls b/salt/sys-firewall/create.sls new file mode 100644 index 0000000..d2d4eb5 --- /dev/null +++ b/salt/sys-firewall/create.sls @@ -0,0 +1,101 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +# Use the netvm of the default_netvm. +{% set default_netvm = salt['cmd.shell']('qubes-prefs default_netvm') -%} +{% set netvm = salt['cmd.shell']('qvm-prefs ' + default_netvm + ' netvm') -%} +# If netvm is empty, user's default_netvm is the uplink (sys-net). +{% if netvm == '' %} + {% set netvm = default_netvm %} +{% endif -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: orange +prefs: +- template: tpl-{{ slsdotpath }} +- label: orange +- memory: 300 +- maxmem: 400 +- netvm: {{ netvm }} +- vcpus: 1 +- provides-network: True +- include_in_backups: False +features: +- enable: + - servicevm + - service.qubes-firewall +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: dvm-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: orange +prefs: +- template: tpl-{{ slsdotpath }} +- label: orange +- netvm: {{ netvm }} +- memory: 300 +- maxmem: 400 +- vcpus: 1 +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - servicevm +- disable: + - appmenus-dispvm + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: disp-{{ slsdotpath }} +force: True +require: +- qvm: dvm-{{ slsdotpath }} +present: +- template: dvm-{{ slsdotpath }} +- label: orange +- class: DispVM +prefs: +- template: dvm-{{ slsdotpath }} +- label: orange +- netvm: {{ netvm }} +- memory: 300 +- maxmem: 400 +- vcpus: 1 +- provides-network: True +- autostart: False +- include_in_backups: False +features: +- enable: + - servicevm + - service.qubes-firewall +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} diff --git a/salt/sys-firewall/create.top b/salt/sys-firewall/create.top new file mode 100644 index 0000000..6674c54 --- /dev/null +++ b/salt/sys-firewall/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-firewall.create diff --git a/salt/sys-firewall/init.top b/salt/sys-firewall/init.top new file mode 100644 index 0000000..1e5e7e6 --- /dev/null +++ b/salt/sys-firewall/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-firewall.create + 'tpl-sys-firewall': + - sys-firewall.install diff --git a/salt/sys-firewall/install.sls b/salt/sys-firewall/install.sls new file mode 100644 index 0000000..ace12de --- /dev/null +++ b/salt/sys-firewall/install.sls @@ -0,0 +1,27 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - sys-net.install-debug + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-dom0-updates + - qubes-core-agent-networking + - ca-certificates + - iproute2 + +{% endif -%} diff --git a/salt/sys-firewall/install.top b/salt/sys-firewall/install.top new file mode 100644 index 0000000..24e16e6 --- /dev/null +++ b/salt/sys-firewall/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-firewall': + - sys-firewall.install diff --git a/salt/sys-firewall/prefs-disp.sls b/salt/sys-firewall/prefs-disp.sls new file mode 100644 index 0000000..dbe916f --- /dev/null +++ b/salt/sys-firewall/prefs-disp.sls @@ -0,0 +1,20 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - .create + +"{{ slsdotpath }}-qubes-prefs-updatevm": + cmd.run: + - require: + - sls: {{ slsdotpath }}.clone + - name: qubes-prefs updatevm disp-{{ slsdotpath }} + +"{{ slsdotpath }}-qubes-prefs-default_netvm": + cmd.run: + - require: + - sls: {{ slsdotpath }}.clone + - name: qubes-prefs default_netvm disp-{{ slsdotpath }} diff --git a/salt/sys-firewall/prefs-disp.top b/salt/sys-firewall/prefs-disp.top new file mode 100644 index 0000000..bf31296 --- /dev/null +++ b/salt/sys-firewall/prefs-disp.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-firewall.prefs-disp diff --git a/salt/sys-firewall/prefs.sls b/salt/sys-firewall/prefs.sls new file mode 100644 index 0000000..b4db316 --- /dev/null +++ b/salt/sys-firewall/prefs.sls @@ -0,0 +1,20 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - .create + +"{{ slsdotpath }}-qubes-prefs-updatevm": + cmd.run: + - require: + - sls: {{ slsdotpath }}.create + - name: qubes-prefs updatevm {{ slsdotpath }} + +"{{ slsdotpath }}-qubes-prefs-default_netvm": + cmd.run: + - require: + - sls: {{ slsdotpath }}.create + - name: qubes-prefs default_netvm {{ slsdotpath }} diff --git a/salt/sys-firewall/prefs.top b/salt/sys-firewall/prefs.top new file mode 100644 index 0000000..abe6bd2 --- /dev/null +++ b/salt/sys-firewall/prefs.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-firewall.prefs diff --git a/salt/sys-git/README.md b/salt/sys-git/README.md new file mode 100644 index 0000000..3ca136a --- /dev/null +++ b/salt/sys-git/README.md @@ -0,0 +1,172 @@ +# sys-git + +Git operations through Qrexec in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Alternatives comparison](#alternatives-comparison) +* [Installation](#installation) +* [Access control](#access-control) +* [Usage](#usage) + * [Initialize the server repository](#initialize-the-server-repository) + * [Prepare the client](#prepare-the-client) +* [Credits](#credits) + +## Description + +Setup a Git server called "sys-git", an offline Git Server that can be +accessed from client qubes via Qrexec. Access control via Qrexec policy can +restrict access to certain repositories, set of git actions for Fetch, Push +and Init. This is an implementation of split-git. + +## Alternatives comparison + +The following alternatives will be compared against each other and this +implementation: + +- [Rudd-O/git-remote-qubes](https://github.com/Rudd-O/git-remote-qubes) +- [QubesOS-contrib/qubes-app-split-git](https://github.com/QubesOS-contrib/qubes-app-split-git) +- [qubes-os.org/doc/development-workflow/#git-connection-between-vms](https://www.qubes-os.org/doc/development-workflow/#git-connection-between-vms) + +| | sys-git | git-remote-qubes | qubes-app-split-git | git-connection-between-vms | +| :--- | :---: | :---: | :---: | :---: | +| Codebase Size | Small | Large | Large | Small | +| Custom Protocol | True | True | True | False | +| Path | Repository | Absolute | Repository | Repository | +| Repository restriction | True | False | True | True | +| No hanging | True | True | True | False | +| Fetch | True | True | True (only tags) | True | +| Push | True | True | False | True | +| Init | True | False | False | False | +| Validates Git communication | False | False | True | False | +| Verifies tag signature | False | False | True | False | + +## Installation + +- Top +```sh +qubesctl top.enable sys-git +qubesctl --targets=tpl-sys-git,sys-git state.apply +qubesctl top.disable sys-git +``` + +- State + +```sh +qubesctl state.apply sys-git.create +qubesctl --skip-dom0 --targets=tpl-sys-git state.apply sys-git.install +qubesctl --skip-dom0 --targets=sys-git state.apply sys-git.configure +``` + + +Installation on the client template: +```sh +qubesctl --skip-dom0 --targets=tpl-dev state.apply sys-git.install-client +``` + +## Access control + +_Default policy_: `any qube` can `ask` via the `@default` target if you allow +it to `Fetch` from, `Push` to and `Init` on `sys-git`. + +__Recommended usage__: + +- __Init__: Argument useful when allowing a qube to always create a + repository on the server. +- __Fetch__: Fetch can be allowed by less trusted qubes. +- __Push__: Push should only be made by trusted qubes. + +Allow qube `dev` to `Fetch` from `sys-git`, but ask to `Push` and `Init`: +```qrexecpolicy +qusal.GitFetch * dev @default allow target=sys-git +qusal.GitPush * dev @default ask target=sys-git default_target=sys-git +qusal.GitInit * dev @default ask target=sys-git default_target=sys-git +qusal.GitFetch * dev @anyvm deny +qusal.GitPush * dev @anyvm deny +qusal.GitInit * dev @anyvm deny +``` + +Allow qube `untrusted` to `Fetch` `repo` if using target name `sys-git` but +deny `Push` and `Init` to any other qube: +```qrexecpolicy +qusal.GitFetch +repo untrusted sys-git ask target=sys-git default_target=sys-git +qusal.GitFetch * untrusted @anyvm deny +qusal.GitPush * untrusted @anyvm deny +qusal.GitInit * untrusted @anyvm deny +``` + +Deny `Fetch`, `Push` and `Init` from any qube to any other qube: +```qrexecpolicy +qusal.GitFetch * @anyvm @anyvm deny +qusal.GitPush * @anyvm @anyvm deny +qusal.GitInit * @anyvm @anyvm deny +``` + +## Usage + +### Initialize the server repository + +There are a few constraints regarding repositories: + +- Must be created under `/home/user/src` in `sys-git`; +- Names must have only letters, numbers, hyphen, underscore and dot. Must not + begin or end with dot, hyphen and underscore. + +In `sys-git`, create bare repositories under `/home/user/src`. + +From the `server`: +```sh +git init --bare ~/src/X.git +``` +You must use the `.git` prefix to indicate a bare repository. + +Or from the `client`, if the `qusal.GitInit` policy allows: +```sh +cd ~/path/to/repo +git init-qrexec +``` + +### Prepare the client + +Qrexec protocol is supported with the following URL format: +`qrexec:///`, where the `` field can be a literal name or +token and the `` field is the name of the repository that exists on +`sys-git` under `/home/user/src`. + +Clone an existing repository: +```sh +git clone qrexec://@default/qubes-doc +``` + +Or Initialize a new repository: +```sh +git init qubes-doc +cd qubes-doc +``` + +Add a remote using the Qrexec protocol: +```sh +git remote add sg qrexec://@default/qubes-doc +``` + +Test fetching from the newly added remote: +```sh +git fetch sg +``` + +Make changes to the git repository as you normally would on any system. + +Push to the server and set it as the default upstream: +```sh +git push -u sg main +``` + +Following pushes will be simpler: +```sh +git push +``` + +## Credits + +- [Unman](https://github.com/unman/shaker/tree/main/git) diff --git a/salt/sys-git/clone.sls b/salt/sys-git/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-git/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-git/clone.top b/salt/sys-git/clone.top new file mode 100644 index 0000000..b5240c9 --- /dev/null +++ b/salt/sys-git/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-git.clone diff --git a/salt/sys-git/configure.sls b/salt/sys-git/configure.sls new file mode 100644 index 0000000..948fc4b --- /dev/null +++ b/salt/sys-git/configure.sls @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dev.home-cleanup + - dotfiles.copy-git + +{% endif -%} diff --git a/salt/sys-git/configure.top b/salt/sys-git/configure.top new file mode 100644 index 0000000..04152aa --- /dev/null +++ b/salt/sys-git/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-git': + - sys-git.configure diff --git a/salt/sys-git/create.sls b/salt/sys-git/create.sls new file mode 100644 index 0000000..103bc25 --- /dev/null +++ b/salt/sys-git/create.sls @@ -0,0 +1,46 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: gray +prefs: +- template: tpl-{{ slsdotpath }} +- label: gray +- netvm: "" +- vcpus: 1 +- memory: 200 +- maxmem: 300 +features: +- enable: + - servicevm +- disable: + - service.cups + - service.cups-browsed +# tags: +# - add: +# - split-gpg2-client +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-resize-private-volume": + cmd.run: + - name: qvm-volume resize {{ slsdotpath }}:private 20Gi + - require: + - qvm: {{ slsdotpath }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-git/create.top b/salt/sys-git/create.top new file mode 100644 index 0000000..34c9f7b --- /dev/null +++ b/salt/sys-git/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-git.create diff --git a/salt/sys-git/files/admin/policy/default.policy b/salt/sys-git/files/admin/policy/default.policy new file mode 100644 index 0000000..5891be8 --- /dev/null +++ b/salt/sys-git/files/admin/policy/default.policy @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qusal.GitFetch * @anyvm @default ask target={{ sls_path }} default_target={{ sls_path }} +qusal.GitPush * @anyvm @default ask target={{ sls_path }} default_target={{ sls_path }} +qusal.GitInit * @anyvm @default ask target={{ sls_path }} default_target={{ sls_path }} +qusal.GitFetch * @anyvm @anyvm deny +qusal.GitPush * @anyvm @anyvm deny +qusal.GitInit * @anyvm @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/sys-git/files/client/git-core/git-init-qrexec b/salt/sys-git/files/client/git-core/git-init-qrexec new file mode 100755 index 0000000..468ed55 --- /dev/null +++ b/salt/sys-git/files/client/git-core/git-init-qrexec @@ -0,0 +1,53 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +usage(){ + echo "Usage: ${helper} [] []" + echo "Note: qube defaults to '@default' and repository to the current repository" + exit 1 +} + +is_git_repo(){ + if ! git rev-parse --show-toplevel >/dev/null 2>&1; then + echo "Error: Either run from inside a git repository or provide it as an argument" >&2 + usage + fi +} + +helper="${0##*/git-}" +case "${1-}" in + -h|--?help) usage;; + "") qube="@default";; + *) qube="${1}";; +esac +case "${2-}" in + "") is_git_repo; repo="$(basename "$(git rev-parse --show-toplevel)")";; + *) repo="${2}";; +esac + +rpc="GitInit" +vendor="qusal" +default_qube="sys-git" +rpc_cmd="${vendor}.${rpc}+${repo}" + +if command -v qrexec-client-vm >/dev/null; then + exec qrexec-client-vm -- "${qube}" "${rpc_cmd}" +elif command -v qrexec-client >/dev/null; then + qubes_version="$(awk -F '=' '/^VERSION_ID=/{print $2}' /etc/os-release)" + if test "$(echo "${qubes_version}" | tr -d ".")" -le 41; then + if test "${qube}" = "@default"; then + qube="${default_qube}" + fi + else + policy="$(qrexec-policy --assume-yes-for-ask dom0 "${qube}" "${rpc_cmd}")" + qube="$(echo "${policy}" | awk -F '=' '/^target=/{print $2}')" + fi + exec qrexec-client -d "${qube}" -- "DEFAULT:QUBESRPC ${rpc_cmd} dom0" +else + die "Qrexec programs not found: qrexec-client-vm, qrexec-client" +fi diff --git a/salt/sys-git/files/client/git-core/git-remote-qrexec b/salt/sys-git/files/client/git-core/git-remote-qrexec new file mode 100755 index 0000000..96a88ac --- /dev/null +++ b/salt/sys-git/files/client/git-core/git-remote-qrexec @@ -0,0 +1,107 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Portable git-remote-helper. +## Rename this helper to git-remote-. +## Valid URL format: :///. +## Supported commands: capabilities, connect. +## Capabilities commands are sent to git-remote--. +set -eu + +usage(){ + echo "Usage: ${helper} [${scheme}:///]" >&2 +} + +die(){ + usage + echo "Error: ${1}" >&2 + exit 1 +} + +## Validate URL and return it without the scheme. +validate_url(){ + url_valid="" + url_check="${1?}" + scheme_user_url="$(echo "${url_check}" | sed "s|://.*||")" + + ## Scheme must be the same as the one in the name of this script. + ## Checks if Authority and Path exist, but not if they are valid, this is + ## implementation specific and should be checked by the connect helper. + case "${url_check}" in + "${scheme}"://*?/*?) url_valid="$(echo "${url_check}" | sed "s|.*://||")";; + "${scheme}"://*?) die "URL has no path to resource: '${url_check}'";; + "${scheme}"://) die "URL has no authority: '${url_check}'";; + *?://*) die "URL has unsupported scheme: '${scheme_user_url}'";; + *) die "URL has no scheme: '${url_check}'";; + esac + + echo "${url_valid}" +} + +## Send capabilities to remote helper specific for that capability. +send_cap(){ + exec_path="$(git --exec-path)" + test -n "${exec_path}" || die "Couldn't locate Git's executables path" + + cap="${1}" + shift + cap_file="${script}-${cap}" + cap_path="${exec_path}/${cap_file}" + + test -e "${cap_path}" || die "Git's exec path missing: '${cap_file}'" + test -x "${cap_path}" || die "Git script is not executable: '${cap_file}'" + + "${cap_path}" "${@}" +} + +## Basic requirements. +command -v git >/dev/null || die "Command not found: 'git'" +script="${0##*/}" +helper="${script##git-}" +scheme="${helper##remote-}" +if test "${script}" != "git-remote-${scheme}" || test -z "${scheme}"; then + die "Script must be named with the format: git-remote-" +fi + +## Get remote name or show usage. +case "${1-}" in + -h|--?help|"") usage; exit 1;; + *) remote="${1}";; +esac + +## Get URL and Push URL (fallback to URL) +case "${2-}" in + "") + ## Happens when 'remote-qrexec' is called directly from the command-line. + url="$(git remote get-url "${remote}" || true)" + pushurl="$(git remote get-url --push "${remote}" || true)" + ;; + *) url="${2}"; pushurl="${2}";; +esac + +test -n "${url}" || die "Remote URL is unset" +test -n "${pushurl}" || die "Remote Push URL is unset" + +url="$(validate_url "${url}")" +pushurl="$(validate_url "${pushurl}")" + +## Communicate with the git-remote-helpers protocol. +while read -r cmd arg; do + case "${cmd}" in + "") exit 0;; + "capabilities") printf "connect\n\n";; + "connect") + printf "\n"; + case "${arg}" in + git-upload-pack) send_cap "${cmd}" "${arg}" "${url}";; + git-receive-pack) send_cap "${cmd}" "${arg}" "${pushurl}";; + "") die "Argument can't be empty";; + *) die "Unsupported argument: '${arg}'";; + esac + ;; + *) die "Unsupported command: '${cmd}'";; + esac +done diff --git a/salt/sys-git/files/client/git-core/git-remote-qrexec-connect b/salt/sys-git/files/client/git-core/git-remote-qrexec-connect new file mode 100755 index 0000000..2b46f0a --- /dev/null +++ b/salt/sys-git/files/client/git-core/git-remote-qrexec-connect @@ -0,0 +1,62 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Should be called by git-remote-qrexec. +set -eu + +usage(){ + echo "Usage: ${helper} git-upload-pack|git-receive-pack /" + echo "Note: ${helper} is supposed to be called by ${parent_helper}" + exit 1 +} + +die(){ + echo "Error: ${1}" >&2 + exit 1 +} + +helper="${0##*/git-}" +parent_helper="${helper%-*}" + +case "${1-}" in + -h|--?help|"") usage;; + *) arg="${1}";; +esac +case "${2-}" in + "") usage;; + *) url="${2}";; +esac + +case "${arg}" in + git-upload-pack) rpc=GitFetch;; + git-receive-pack) rpc=GitPush;; + "") die "Argument can't be empty";; + *) die "Unsupported argument: '${arg}'";; +esac + +qube="$(echo "${url}" | cut -d "/" -f1)" +repo="$(echo "${url}" | cut -d "/" -f2-)" +test -n "${repo}" || die "Repository name can't be empty" +vendor="qusal" +default_qube="sys-git" +rpc_cmd="${vendor}.${rpc}+${repo}" + +if command -v qrexec-client-vm >/dev/null; then + exec qrexec-client-vm -- "${qube}" "${rpc_cmd}" +elif command -v qrexec-client >/dev/null; then + qubes_version="$(awk -F '=' '/^VERSION_ID=/{print $2}' /etc/os-release)" + if test "$(echo "${qubes_version}" | tr -d ".")" -le 41; then + if test "${qube}" = "@default"; then + qube="${default_qube}" + fi + else + policy="$(qrexec-policy --assume-yes-for-ask dom0 "${qube}" "${rpc_cmd}")" + qube="$(echo "${policy}" | awk -F '=' '/^target=/{print $2}')" + fi + exec qrexec-client -d "${qube}" -- "DEFAULT:QUBESRPC ${rpc_cmd} dom0" +else + die "Qrexec programs not found: qrexec-client-vm, qrexec-client" +fi diff --git a/salt/sys-git/files/server/rpc/qusal.GitFetch b/salt/sys-git/files/server/rpc/qusal.GitFetch new file mode 120000 index 0000000..9de77df --- /dev/null +++ b/salt/sys-git/files/server/rpc/qusal.GitFetch @@ -0,0 +1 @@ +qusal.GitInit \ No newline at end of file diff --git a/salt/sys-git/files/server/rpc/qusal.GitInit b/salt/sys-git/files/server/rpc/qusal.GitInit new file mode 100644 index 0000000..4a1bb82 --- /dev/null +++ b/salt/sys-git/files/server/rpc/qusal.GitInit @@ -0,0 +1,58 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +base_path="$HOME/src" +repo="$QREXEC_SERVICE_ARGUMENT" +#origin="$QREXEC_REMOTE_DOMAIN" + +die(){ + echo "error: $1" >&2 + exit 1 +} + +fail_invalid_name(){ + if ! (echo "$repo" | grep -q "^[A-Za-z0-9][A-Za-z0-9_.-]\+$"); then + die "Invalid repository. Allowed chars: letters, numbers, hyphen, underscore and dot. It cannot begin with hyphen, underscore or dot." + fi +} + +if ! command -v git >/dev/null; then + die "Command not found: git" +fi + +fail_invalid_name +case "$repo" in + *".git") ;; + *) repo="$repo.git";; +esac + +path="$base_path/$repo" +action="${0##*.Git}" + +case "$action" in + Fetch) service=git-upload-pack;; + Push) service=git-receive-pack;; + Init) service="git init --bare";; + *) die "Invalid RPC name: ${0##*/}";; +esac + +if test "$action" != "Init"; then + test -d "$path" || die "Directory doesn't exist: $repo" + git -C "$path" rev-parse >/dev/null 2>&1 || die "Not a git repository: $repo" + is_bare="$(git -C "$path" rev-parse --is-bare-repository)" + test "${is_bare}" = "true" || die "Not a bare repository: $repo" +fi + +if ! test -d "$base_path"; then + # shellcheck disable=SC2174 + mkdir -m 0700 -p "$base_path" >/dev/null 2>&1 || + die "Cannot create directory: $base_path" +fi + +# shellcheck disable=SC2086 +exec $service -- "$path" diff --git a/salt/sys-git/files/server/rpc/qusal.GitPush b/salt/sys-git/files/server/rpc/qusal.GitPush new file mode 120000 index 0000000..9de77df --- /dev/null +++ b/salt/sys-git/files/server/rpc/qusal.GitPush @@ -0,0 +1 @@ +qusal.GitInit \ No newline at end of file diff --git a/salt/sys-git/init.top b/salt/sys-git/init.top new file mode 100644 index 0000000..82b8018 --- /dev/null +++ b/salt/sys-git/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-git.create + 'tpl-sys-git': + - sys-git.install + 'sys-git': + - sys-git.configure diff --git a/salt/sys-git/install-client.sls b/salt/sys-git/install-client.sls new file mode 100644 index 0000000..6dc4e62 --- /dev/null +++ b/salt/sys-git/install-client.sls @@ -0,0 +1,48 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - dotfiles.copy-git + - dotfiles.copy-sh + - dotfiles.copy-x11 + - sys-pgp.install-client + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - git + +{% set git = { + 'Debian': { + 'exec_path': '/usr/lib/git-core', + }, + 'RedHat': { + 'exec_path': '/usr/libexec/git-core', + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-install-client-git-core-dir": + file.recurse: + - require: + - pkg: {{ slsdotpath }}-installed + - source: salt://{{ slsdotpath }}/files/client/git-core + - name: {{ git.exec_path }} + - file_mode: '0755' + - dir_mode: '0755' + - user: root + - group: root + - makedirs: True + - recurse: + - mode + - user + - group diff --git a/salt/sys-git/install-client.top b/salt/sys-git/install-client.top new file mode 100644 index 0000000..7629c06 --- /dev/null +++ b/salt/sys-git/install-client.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - sys-git.install-client diff --git a/salt/sys-git/install.sls b/salt/sys-git/install.sls new file mode 100644 index 0000000..6c7ffed --- /dev/null +++ b/salt/sys-git/install.sls @@ -0,0 +1,46 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dotfiles.copy-git + - dotfiles.copy-sh + - dotfiles.copy-x11 + - sys-pgp.install-client + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - git + +"{{ slsdotpath }}-rpc": + file.recurse: + - name: /etc/qubes-rpc/ + - source: salt://{{ slsdotpath }}/files/server/rpc + - user: root + - group: root + - file_mode: '0755' + - dir_mode: '0755' + - keep_symlinks: True + - force_symlinks: True + +"{{ slsdotpath }}-skel-repository-directory": + file.directory: + - name: /etc/skel/src + - user: root + - group: root + - mode: '0755' + - makedirs: True + +{% endif -%} diff --git a/salt/sys-git/install.top b/salt/sys-git/install.top new file mode 100644 index 0000000..d0b8c0d --- /dev/null +++ b/salt/sys-git/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-git': + - sys-git.install diff --git a/salt/sys-mirage-firewall/README.md b/salt/sys-mirage-firewall/README.md new file mode 100644 index 0000000..61fb2f4 --- /dev/null +++ b/salt/sys-mirage-firewall/README.md @@ -0,0 +1,60 @@ +# sys-mirage-firewall + +Mirage Firewall in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) +* [Credits](#credits) + +## Description + +Creates a Mirage Firewall qube named "sys-mirage-firewall". It is an OCaml +program compiled to run as an operating system kernel, in this case, a +MirageOS unikernel replacement for the default firewall (sys-firewall). It +pulls in just the code it needs as libraries. + +Contrary to a standard Linux Firewall, Mirage Firewall doesn't need a full +system to run an excessive resources. + +You can't use Mirage Firewall to be the updatevm, use another qube instead. + +## Installation + +We have built the Unikernel locally and verified that the upstream checksum +and local checksum matched when comparing the same release. + +- Top +```sh +qubesctl top.enable sys-mirage-firewall +qubesctl state.apply +qubesctl top.disable sys-mirage-firewall +``` + +- State + +```sh +qubesctl state.apply sys-mirage-firewall.create +``` + + +## Usage + +As a started, set qubes `netvm` to `sys-mirage-firewall`: +```sh +qvm-prefs --set QUBE netvm sys-mirage-firewall +``` + +To test the firewall, apply rules with `qvm-firewall`. + +For monitoring, inspect the Unikernel console: +```sh +sudo xl console sys-mirage-firewall +``` +Exit the console with `Ctrl-]`. + +## Credits + +- [Unman](https://github.com/unman/shaker/tree/main/mirage) diff --git a/salt/sys-mirage-firewall/create.sls b/salt/sys-mirage-firewall/create.sls new file mode 100644 index 0000000..52e1625 --- /dev/null +++ b/salt/sys-mirage-firewall/create.sls @@ -0,0 +1,72 @@ +{# +SPDX-FileCopyrightText: 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +{# Use the netvm of the default_netvm. #} +{% set default_netvm = salt['cmd.shell']('qubes-prefs default_netvm') -%} +{% set netvm = salt['cmd.shell']('qvm-prefs ' + default_netvm + ' netvm') -%} +{# +If netvm of default_netvm is empty, user's default_netvm is the first in +the chain (sys-net). +#} +{% if netvm == '' %} + {% set netvm = default_netvm %} +{% endif %} + +"sys-mirage-firewall-create-vm-kernels-dir": + file.directory: + - name: /var/lib/qubes/vm-kernels/mirage-firewall + - mode: '0755' + - user: root + - group: root + - makedirs: True + +"sys-mirage-firewall-extract-to-vm-kernels": + archive.extracted: + - name: /var/lib/qubes/vm-kernels/ + - require: + - file: sys-mirage-firewall-create-vm-kernels-dir + - source: salt://sys-mirage-firewall/files/admin/mirage-firewall.tar.bz2 + - source_hash: salt://sys-mirage-firewall/files/admin/mirage-firewall.sha256 + - archive_format: tar + - options: -j + +"sys-mirage-firewall-save-version": + file.managed: + - name: /var/lib/qubes/vm-kernels/mirage-firewall/version.txt + - source: salt://sys-mirage-firewall/files/admin/version.txt + - mode: '0644' + - user: root + - group: root + - makedirs: True + +{% load_yaml as defaults -%} +name: sys-mirage-firewall +force: True +require: + - file: sys-mirage-firewall-save-version +present: +- class: StandaloneVM +- label: orange +- virt_mode: pvh +prefs: +- label: orange +- netvm: {{ netvm }} +- memory: 64 +- maxmem: 64 +- vcpus: 1 +- provides-network: True +- default_dispvm: "" +- kernel: mirage-firewall +- kernelopts: '' +features: +- enable: + - service.qubes-firewall + - no-default-kernelopts +{%- endload %} +{{ load(defaults) }} diff --git a/salt/sys-mirage-firewall/create.top b/salt/sys-mirage-firewall/create.top new file mode 100644 index 0000000..98466a4 --- /dev/null +++ b/salt/sys-mirage-firewall/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-mirage-firewall.create diff --git a/salt/sys-mirage-firewall/init.top b/salt/sys-mirage-firewall/init.top new file mode 100644 index 0000000..98466a4 --- /dev/null +++ b/salt/sys-mirage-firewall/init.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-mirage-firewall.create diff --git a/salt/sys-net/README.md b/salt/sys-net/README.md new file mode 100644 index 0000000..c9a7fdb --- /dev/null +++ b/salt/sys-net/README.md @@ -0,0 +1,61 @@ +# sys-net + +PCI handler of Network devices in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Creates and configure qubes for handling the network devices. Qubes OS +provides the state "qvm.sys-net", but it will create only "sys-net", which can +be a disposable or not. This package takes a different approach, it will +create an AppVM "sys-net" and a DispVM "disp-sys-net". + +By default, the chosen one is "sys-net", but you can choose which qube type +becomes the upstream net qube "default_netvm", the "clockvm" and the fallback +target for the "qubes.UpdatesProxy" service in case no rule matched before. + +## Installation + +Before installation, rename your current `sys-net` to another name such as +`sys-net-old`, the old qube will be used to install packages require for the +template. After successful installation and testing the new net qube +capabilities, you can remove the old one. If you want the default net qube +back, just set `sys-net` template to the full template you are using, such as +Debian or Fedora. + +- Top: +```sh +qubesctl top.enable sys-net +qubesctl --targets=tpl-sys-net state.apply +qubesctl top.disable sys-net +qubesctl state.apply sys-net.prefs +``` + +- State: + +```sh +qubesctl state.apply sys-net.create +qubesctl --skip-dom0 --targets=tpl-sys-net state.apply sys-net.install +qubesctl state.apply sys-net.prefs +``` + + +Alternatively, if you prefer to have a disposable net qube: +```sh +qubesctl state.apply sys-net.prefs-disp +``` + +You might need to install some firmware on the template for your network +drivers. Check files/admin/firmware.txt. + +## Usage + +A network manager is provided in `sys-net`, from there you can manager Wi-Fi +or Ethernet cable connections. You can also use it for network monitoring. It +should be relied on to hold firewall rules for other qubes, use +`sys-firewall`, `sys-pihole` or `sys-mirage-firewall` for that purpose. diff --git a/salt/sys-net/clone.sls b/salt/sys-net/clone.sls new file mode 100644 index 0000000..e7c08d4 --- /dev/null +++ b/salt/sys-net/clone.sls @@ -0,0 +1,11 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian', sls_path) }} diff --git a/salt/sys-net/clone.top b/salt/sys-net/clone.top new file mode 100644 index 0000000..ae4bcda --- /dev/null +++ b/salt/sys-net/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-net.clone diff --git a/salt/sys-net/create.sls b/salt/sys-net/create.sls new file mode 100644 index 0000000..816a670 --- /dev/null +++ b/salt/sys-net/create.sls @@ -0,0 +1,107 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +{% set net_pcidevs = salt['grains.get']('pci_net_devs', []) -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: red +prefs: +- template: tpl-{{ slsdotpath }} +- label: red +- netvm: "" +- memory: 400 +- maxmem: 0 +- vcpus: 1 +- virt_mode: hvm +- autostart: False +- provides-network: True +- pcidevs: {{ net_pcidevs|yaml }} +- pci_strictreset: False +- include_in_backups: False +features: +- enable: + - servicevm + - service.qubes-updates-proxy + - service.clocksync +- disable: + - service.cups + - service.cups-browsed + - service.meminfo-writer +{%- endload %} +{{ load(defaults) }} + +{% 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: 400 +- maxmem: 0 +- vcpus: 1 +- virt_mode: hvm +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - servicevm + - service.qubes-updates-proxy + - service.clocksync +- disable: + - appmenus-dispvm + - service.cups + - service.cups-browsed + - service.meminfo-writer +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: disp-{{ slsdotpath }} +force: True +require: +- qvm: dvm-{{ slsdotpath }} +present: +- template: dvm-{{ slsdotpath }} +- label: red +- class: DispVM +prefs: +- template: dvm-{{ slsdotpath }} +- label: red +- netvm: "" +- autostart: False +- provides-network: True +- pcidevs: {{ net_pcidevs|yaml }} +- pci_strictreset: False +- include_in_backups: False +features: +- enable: + - servicevm + - service.qubes-updates-proxy + - service.clocksync +- disable: + - appmenus-dispvm + - service.cups + - service.cups-browsed + - service.meminfo-writer +{%- endload %} +{{ load(defaults) }} diff --git a/salt/sys-net/create.top b/salt/sys-net/create.top new file mode 100644 index 0000000..fba45b4 --- /dev/null +++ b/salt/sys-net/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-net.create diff --git a/salt/sys-net/files/admin/firmware.txt b/salt/sys-net/files/admin/firmware.txt new file mode 100644 index 0000000..e1d99d7 --- /dev/null +++ b/salt/sys-net/files/admin/firmware.txt @@ -0,0 +1,17 @@ +# vim: ft=conf +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: MIT + +atmel-firmware +firmware-ath9k-htc +firmware-atheros +firmware-b43-installer +firmware-brcm80211 +firmware-intelwimax +firmware-ipw2x00 +firmware-iwlwifi +firmware-misc-nonfree +firmware-ralink +firmware-realtek +firmware-zd1211 diff --git a/salt/sys-net/files/admin/policy/default.policy b/salt/sys-net/files/admin/policy/default.policy new file mode 100644 index 0000000..be4b82c --- /dev/null +++ b/salt/sys-net/files/admin/policy/default.policy @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qubes.UpdatesProxy * @tag:whonix-updatevm @default allow target=sys-whonix +qubes.UpdatesProxy * @tag:whonix-updatevm @anyvm deny +qubes.UpdatesProxy * @type:TemplateVM @default allow target=disp-{{ sls_path }} +qubes.UpdatesProxy * @type:TemplateVM @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/sys-net/init.top b/salt/sys-net/init.top new file mode 100644 index 0000000..beb2b94 --- /dev/null +++ b/salt/sys-net/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-net.create + 'tpl-sys-net': + - sys-net.install diff --git a/salt/sys-net/install-debug.sls b/salt/sys-net/install-debug.sls new file mode 100644 index 0000000..1ac4107 --- /dev/null +++ b/salt/sys-net/install-debug.sls @@ -0,0 +1,27 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - pciutils + - net-tools + - wireless-tools + - socat + - ncat + - nmap + - tcpdump + +{% endif -%} diff --git a/salt/sys-net/install-debug.top b/salt/sys-net/install-debug.top new file mode 100644 index 0000000..64d8db4 --- /dev/null +++ b/salt/sys-net/install-debug.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-net': + - sys-net.install-debug diff --git a/salt/sys-net/install.sls b/salt/sys-net/install.sls new file mode 100644 index 0000000..c387fe5 --- /dev/null +++ b/salt/sys-net/install.sls @@ -0,0 +1,28 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-debug + - dotfiles.copy-x11 + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-network-manager + - wpasupplicant + - gnome-keyring + - notification-daemon + +{% endif -%} diff --git a/salt/sys-net/install.top b/salt/sys-net/install.top new file mode 100644 index 0000000..8472aad --- /dev/null +++ b/salt/sys-net/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-net': + - sys-net.install diff --git a/salt/sys-net/prefs-disp.sls b/salt/sys-net/prefs-disp.sls new file mode 100644 index 0000000..14c671f --- /dev/null +++ b/salt/sys-net/prefs-disp.sls @@ -0,0 +1,26 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - .create + +{% set default_netvm = salt['cmd.shell']('qubes-prefs default_netvm') -%} +"default_netvm-netvm-disp-{{ slsdotpath }}": + qvm.vm: + - require: + - qvm: disp-{{ slsdotpath }} + - name: {{ default_netvm }} + - prefs: + - netvm: disp-{{ slsdotpath }} + +"clockvm-disp-{{ slsdotpath }}": + cmd.run: + - require: + - qvm: disp-{{ slsdotpath }} + - name: qubes-prefs clockvm disp-{{ slsdotpath }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-net/prefs-disp.top b/salt/sys-net/prefs-disp.top new file mode 100644 index 0000000..f999754 --- /dev/null +++ b/salt/sys-net/prefs-disp.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-net.prefs-disp diff --git a/salt/sys-net/prefs.sls b/salt/sys-net/prefs.sls new file mode 100644 index 0000000..153acb2 --- /dev/null +++ b/salt/sys-net/prefs.sls @@ -0,0 +1,26 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - .create + +{% set default_netvm = salt['cmd.shell']('qubes-prefs default_netvm') -%} +"default_netvm-netvm-{{ slsdotpath }}": + qvm.vm: + - require: + - qvm: {{ slsdotpath }} + - name: {{ default_netvm }} + - prefs: + - netvm: {{ slsdotpath }} + +"clockvm-{{ slsdotpath }}": + cmd.run: + - require: + - qvm: {{ slsdotpath }} + - name: qubes-prefs clockvm {{ slsdotpath }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-net/prefs.top b/salt/sys-net/prefs.top new file mode 100644 index 0000000..f4a8e11 --- /dev/null +++ b/salt/sys-net/prefs.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-net.prefs diff --git a/salt/sys-pgp/README.md b/salt/sys-pgp/README.md new file mode 100644 index 0000000..3f4fffa --- /dev/null +++ b/salt/sys-pgp/README.md @@ -0,0 +1,65 @@ +# sys-pgp + +PGP operations through Qrexec in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Access Control](#access-control) +* [Usage](#usage) + +## Description + +Creates a PGP key holder named "sys-pgp", it will be the default target for +split-gpg and split-gpg2 calls for all qubes. Keys are stored in "sys-pgp", +and access to them is made from the client through Qrexec. + +## Installation + +- Top: +```sh +qubesctl top.enable sys-pgp +qubesctl --targets=tpl-sys-pgp,sys-pgp state.apply +qubesctl top.disable sys-pgp +``` + +- State: + +```sh +qubesctl state.apply sys-pgp.create +qubesctl --skip-dom0 --targets=tpl-sys-pgp state.apply sys-pgp.install +qubesctl --skip-dom0 --targets=sys-pgp state.apply sys-pgp.configure +``` + + +Install on the client template: +```sh +qubesctl --skip-dom0 --targets=tpl-qubes-builder,tpl-dev state.apply sys-pgp.install-client +``` + +The client qube requires the split GPG client service to be enabled: +```sh +qvm-features QUBE service.split-gpg2-client +``` + +## Access Control + +_Default policy_: `any qube` can `ask` via the `@default` target if you allow +it to use split-gpg in `sys-pgp`. + +Allow the `work` qubes to access `sys-pgp`, but not other qubes: +```qrexecpolicy +qubes.Gpg2 * work sys-pgp ask default_target=sys-pgp +qubes.Gpg2 * work @default ask target=sys-pgp default_target=sys-pgp +qubes.Gpg2 * @anyvm @anyvm deny + +qubes.Gpg * work sys-pgp ask default_target=sys-pgp +qubes.Gpg * work @default ask target=sys-pgp default_target=sys-pgp +qubes.Gpg * @anyvm @anyvm deny +``` + +## Usage + +Consult [upstream documentation](https://www.qubes-os.org/doc/split-gpg/) on +how to use split-gpg. diff --git a/salt/sys-pgp/clone.sls b/salt/sys-pgp/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-pgp/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-pgp/clone.top b/salt/sys-pgp/clone.top new file mode 100644 index 0000000..eb6a60f --- /dev/null +++ b/salt/sys-pgp/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-pgp.clone diff --git a/salt/sys-pgp/configure.sls b/salt/sys-pgp/configure.sls new file mode 100644 index 0000000..69058e7 --- /dev/null +++ b/salt/sys-pgp/configure.sls @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dev.home-cleanup + - dotfiles.copy-pgp + +{% endif -%} diff --git a/salt/sys-pgp/configure.top b/salt/sys-pgp/configure.top new file mode 100644 index 0000000..1146e2b --- /dev/null +++ b/salt/sys-pgp/configure.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-pgp': + - match: nodegroup + - sys-pgp.configure diff --git a/salt/sys-pgp/create.sls b/salt/sys-pgp/create.sls new file mode 100644 index 0000000..2e0424d --- /dev/null +++ b/salt/sys-pgp/create.sls @@ -0,0 +1,36 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: gray +prefs: +- template: tpl-{{ slsdotpath }} +- netvm: "" +- memory: 200 +- maxmem: 300 +- vcpus: 1 +features: +- enable: + - servicevm +- disable: + - service.cups + - service.cups-browsed +{%- endload %} +{{ load(defaults) }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-pgp/create.top b/salt/sys-pgp/create.top new file mode 100644 index 0000000..2c6e38b --- /dev/null +++ b/salt/sys-pgp/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-pgp.create diff --git a/salt/sys-pgp/files/admin/policy/default.policy b/salt/sys-pgp/files/admin/policy/default.policy new file mode 100644 index 0000000..d31c00e --- /dev/null +++ b/salt/sys-pgp/files/admin/policy/default.policy @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qubes.Gpg2 * @anyvm @default ask target={{ sls_path }} default_target={{ sls_path }} +qubes.Gpg2 * @anyvm @anyvm deny +qubes.Gpg * @anyvm @default ask target={{ sls_path }} default_target={{ sls_path }} +qubes.Gpg * @anyvm @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/sys-pgp/init.top b/salt/sys-pgp/init.top new file mode 100644 index 0000000..b34254f --- /dev/null +++ b/salt/sys-pgp/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-pgp.create + 'tpl-sys-pgp': + - sys-pgp.install + 'sys-pgp': + - sys-pgp.configure diff --git a/salt/sys-pgp/install-client.sls b/salt/sys-pgp/install-client.sls new file mode 100644 index 0000000..88f42c6 --- /dev/null +++ b/salt/sys-pgp/install-client.sls @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install + +{% endif -%} diff --git a/salt/sys-pgp/install-client.top b/salt/sys-pgp/install-client.top new file mode 100644 index 0000000..78af79f --- /dev/null +++ b/salt/sys-pgp/install-client.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - match: list + - sys-pgp.install-client diff --git a/salt/sys-pgp/install.sls b/salt/sys-pgp/install.sls new file mode 100644 index 0000000..db67206 --- /dev/null +++ b/salt/sys-pgp/install.sls @@ -0,0 +1,42 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dotfiles.copy-pgp + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - split-gpg2 + - qubes-gpg-split + - gnupg2 + +{% set pkg = { + 'Debian': { + 'pkg': ['sq'], + }, + 'RedHat': { + 'pkg': ['sequoia-sq'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-installed-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +{% endif -%} diff --git a/salt/sys-pgp/install.top b/salt/sys-pgp/install.top new file mode 100644 index 0000000..f41921c --- /dev/null +++ b/salt/sys-pgp/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-pgp': + - sys-pgp.install diff --git a/salt/sys-pihole/README.md b/salt/sys-pihole/README.md new file mode 100644 index 0000000..792afcf --- /dev/null +++ b/salt/sys-pihole/README.md @@ -0,0 +1,101 @@ +# sys-pihole + +Pi-hole DNS Sinkhole in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) +* [Credits](#credits) + +## Description + +The package will create a standalone qube "sys-pihole". It blocks +advertisements and internet trackers by providing a DNS sinkhole. It is a drop +in replacement for sys-firewall. + +The qube will be attached to the "netvm" of the "default_netvm", in other +words, if you are using Qubes OS default setup, it will use "sys-net" as the +"netvm", else it will try to figure out what is your upstream link and attach +to it. + +## Installation + +Pi-Hole commits and tags are not signed by individuals, but as they are done +through the web interface, they have GitHub Web-Flow signature. This is the +best verification we can get for Pi-Hole. If you don't trust the hosting +provider however, don't install this package. + +- Top: +```sh +qubesctl top.enable sys-pihole browser +qubesctl --targets=tpl-browser,sys-pihole,sys-pihole-browser state.apply +qubesctl top.disable sys-pihole browser +qubesctl state.apply sys-pihole.appmenus +``` + +- State: + +```sh +qubesctl state.apply sys-pihole.create +qubesctl --skip-dom0 --targets=tpl-browser state.apply browser.install +qubesctl --skip-dom0 --targets=sys-pihole state.apply sys-pihole.install +qubesctl --skip-dom0 --targets=sys-pihole-browser state.apply sys-pihole.configure-browser +qubesctl state.apply sys-pihole.appmenus +``` + + +If you want to change the global preferences `updatevm` and `default_netvm` +and the per-qube preference `netvm` of all qubes from `sys-firewall` to +`sys-pihole`, run: +```sh +qubesctl state.apply sys-pihole.prefs +``` + +## Usage + +Pi-hole will be installed with these default settings: + +- The DNS provider is Quad9 (filtered, DNSSEC) +- Steven Black's Unified Hosts List is included +- Query logging is enabled to show everything. + +You can change these settings via the admin interface: +- URL: http://localhost/admin +- default password: `UpSNQsy4` + +You should change this password on first use by running in `sys-pihole`: +```sh +pihole -a -p +``` + +If you want to view statistics or manage the server through a GUI, open +`sys-pihole` or `sys-pihole-browser` desktop file `pihole-browser.desktop` +from Dom0. Addresses starting with `http` or `https` will be redirected +to `sys-pihole-browser`. + +The browser separation from the server is to avoid browsing malicious sites +and exposing the browser to direct network on the same machine the server is +running. The browser qube is offline and only has access to the admin +interface. In other words, it has control over the server functions, if the +browser is compromised, it can compromise the server. + +You can clone `sys-pihole`. If you do, you must manually change the IP address +of the clone. + +If you want to combine Pi-Hole with Tor, then you should reconfigure your +netvm chaining (will break tor's client stream isolation) as such: + +- qube -> sys-pihole -> Tor-gateway -> sys-firewall -> sys-net + +If you encounter problems with DNS after having upstream netvm route changes, +restart Pi-Hole DNS from `sys-pihole`: +```sh +pihole restartdns +``` + +## Credits + +- [Patrizio Tufarolo](https://blog.tufarolo.eu/how-to-configure-pihole-in-qubesos-proxyvm/) +- [Unman](https://github.com/unman/shaker/tree/main/pihole) diff --git a/salt/sys-pihole/appmenus.sls b/salt/sys-pihole/appmenus.sls new file mode 100644 index 0000000..8908c9a --- /dev/null +++ b/salt/sys-pihole/appmenus.sls @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - browser.appmenus + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus(sls_path) }} + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus(sls_path ~ '-browser') }} diff --git a/salt/sys-pihole/appmenus.top b/salt/sys-pihole/appmenus.top new file mode 100644 index 0000000..95aa935 --- /dev/null +++ b/salt/sys-pihole/appmenus.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-pihole.appmenus diff --git a/salt/sys-pihole/configure-browser.sls b/salt/sys-pihole/configure-browser.sls new file mode 100644 index 0000000..c1c0a00 --- /dev/null +++ b/salt/sys-pihole/configure-browser.sls @@ -0,0 +1,24 @@ +{# +SPDX-FileCopyrightText: 2022 - 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' %} + +"{{ slsdotpath }}-browser-rc.local": + file.append: + - name: /rw/config/rc.local + - text: "qvm-connect-tcp 80:@default:80" + +"{{ slsdotpath }}-browser-desktop-application": + file.managed: + - name: /home/user/.local/share/applications/pihole-browser.desktop + - source: salt://{{ slsdotpath }}/files/browser/pihole-browser.desktop + - mode: '0644' + - user: user + - group: user + - makedirs: True + +{% endif -%} diff --git a/salt/sys-pihole/configure-browser.top b/salt/sys-pihole/configure-browser.top new file mode 100644 index 0000000..ad77cbb --- /dev/null +++ b/salt/sys-pihole/configure-browser.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-pihole-browser': + - sys-pihole.configure-browser diff --git a/salt/sys-pihole/create.sls b/salt/sys-pihole/create.sls new file mode 100644 index 0000000..5b59d23 --- /dev/null +++ b/salt/sys-pihole/create.sls @@ -0,0 +1,91 @@ +{# +SPDX-FileCopyrightText: 2022 - 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +{%- import "debian-minimal/template.jinja" as template -%} + +{# Use the netvm of the default_netvm. #} +{% set default_netvm = salt['cmd.shell']('qubes-prefs default_netvm') -%} +{% set netvm = salt['cmd.shell']('qvm-prefs ' + default_netvm + ' netvm') -%} +{# +If netvm of default_netvm is empty, user's default_netvm is the first in +the chain (sys-net). +#} +{% if netvm == '' %} + {% set netvm = default_netvm %} +{% endif %} + +include: + - debian-minimal.create + - browser.create + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ template.template_clean }}.create +present: +- template: {{ template.template }} +- label: orange +- class: StandaloneVM +prefs: +- label: orange +- memory: 300 +- maxmem: 400 +- vcpus: 1 +- netvm: {{ netvm }} +- provides-network: true +features: +- enable: + - servicevm + - service.updates-proxy-setup + - service.qubes-firewall +- disable: + - service.cups + - service.cups-browsed + - service.tracker + - service.evolution-data-server +- set: + - menu-items: "pihole-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }}-browser +force: True +require: +- sls: browser.create +present: +- template: tpl-browser +- label: orange +prefs: +- label: orange +- memory: 300 +- maxmem: 600 +- vcpus: 1 +- netvm: "" +- include_in_backups: False +features: +- disable: + - service.cups + - service.cups-browsed + - service.tracker + - service.evolution-data-server +- set: + - menu-items: "pihole-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-resize-private-volume": + cmd.run: + - name: qvm-volume resize {{ slsdotpath }}:private 20Gi + - require: + - qvm: {{ slsdotpath }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-pihole/create.top b/salt/sys-pihole/create.top new file mode 100644 index 0000000..8ed7ce0 --- /dev/null +++ b/salt/sys-pihole/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-pihole.create diff --git a/salt/sys-pihole/files/admin/policy/default.policy b/salt/sys-pihole/files/admin/policy/default.policy new file mode 100644 index 0000000..df243a9 --- /dev/null +++ b/salt/sys-pihole/files/admin/policy/default.policy @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qubes.OpenURL * {{ sls_path }} @default allow target={{ sls_path }}-browser +qubes.OpenURL * {{ sls_path }} @anyvm deny +qubes.ConnectTCP +80 {{ sls_path }}-browser @default allow target={{ sls_path }} +qubes.ConnectTCP * {{ sls_path }}-browser @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/sys-pihole/files/admin/prefs.sh b/salt/sys-pihole/files/admin/prefs.sh new file mode 100755 index 0000000..7c846bc --- /dev/null +++ b/salt/sys-pihole/files/admin/prefs.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2022 - 2023 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +qvm-start --skip-if-running sys-pihole && sleep 5 + +if qubes-prefs updatevm | grep -q sys-firewall; then + qubes-prefs updatevm sys-pihole +fi + +if qubes-prefs default_netvm | grep -q sys-firewall; then + qubes-prefs default_netvm sys-pihole +fi + +for qube in $(qvm-ls --raw-data --fields=NAME,NETVM | + awk -F '|' '/sys-firewall$/{print $1}') +do + ## Avoid overwriting netvm to sys-pihole when instead it should use the + ## default_netvm, so better to prevent overwriting user choices. + qvm-prefs "$qube" | grep -q "^netvm[[:space:]]\+D" && continue + ## Set netvm for qubes that were using sys-firewall to sys-pihole. + qvm-prefs "$qube" netvm sys-pihole +done + +exit 0 diff --git a/salt/sys-pihole/files/browser/pihole-browser.desktop b/salt/sys-pihole/files/browser/pihole-browser.desktop new file mode 100644 index 0000000..37660e1 --- /dev/null +++ b/salt/sys-pihole/files/browser/pihole-browser.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Pi-Hole Browser +Exec=xdg-open http://127.0.0.1:80/admin +Icon=web-browser +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=synchronization;interface; +Categories=Network;WebBrowser;FileTransfer;P2P; diff --git a/salt/sys-pihole/files/server/firewall/flush b/salt/sys-pihole/files/server/firewall/flush new file mode 100644 index 0000000..ff3b00b --- /dev/null +++ b/salt/sys-pihole/files/server/firewall/flush @@ -0,0 +1,9 @@ +#!/usr/sbin/nft -f + +# SPDX-FileCopyrightText: 2022 - 2023 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +flush chain nat PR-QBS +insert rule nat PR-QBS iifname "vif*" tcp dport 53 dnat to 127.0.0.1 +insert rule nat PR-QBS iifname "vif*" udp dport 53 dnat to 127.0.0.1 diff --git a/salt/sys-pihole/files/server/firewall/flush.sh b/salt/sys-pihole/files/server/firewall/flush.sh new file mode 100644 index 0000000..2e44451 --- /dev/null +++ b/salt/sys-pihole/files/server/firewall/flush.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2022 - 2023 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +nft -f /rw/config/network-hooks.d/flush diff --git a/salt/sys-pihole/files/server/firewall/internalise.sh b/salt/sys-pihole/files/server/firewall/internalise.sh new file mode 100644 index 0000000..0f4e658 --- /dev/null +++ b/salt/sys-pihole/files/server/firewall/internalise.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2022 - 2023 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +for vif in /proc/sys/net/ipv4/conf/vif*; do + test -d "${vif}" || continue + test -f "${vif}/route_localnet" || continue + test -w "${vif}/route_localnet" || continue + echo 1 | tee "${vif}/route_localnet" +done diff --git a/salt/sys-pihole/files/server/firewall/update_nft.sh b/salt/sys-pihole/files/server/firewall/update_nft.sh new file mode 100644 index 0000000..d7cf100 --- /dev/null +++ b/salt/sys-pihole/files/server/firewall/update_nft.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2022 - 2023 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +get_handle(){ + my_handle=$(nft -a list table "$1" | + awk 'BEGIN{c0} /related,established/{c++; if (c==1) print $NF}') + echo "$my_handle" +} + +nft insert rule filter FORWARD tcp dport 53 drop +nft insert rule filter FORWARD udp dport 53 drop + +handle=$(get_handle filter) +nft add rule filter INPUT position "$handle" iifname "vif*" tcp dport 53 accept +nft add rule filter INPUT position "$handle" iifname "vif*" udp dport 53 accept diff --git a/salt/sys-pihole/files/server/keys/5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23.asc b/salt/sys-pihole/files/server/keys/5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23.asc new file mode 100644 index 0000000..e7794c4 --- /dev/null +++ b/salt/sys-pihole/files/server/keys/5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23.asc @@ -0,0 +1,33 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +xsBNBFmUaEEBCACzXTDt6ZnyaVtueZASBzgnAmK13q9Urgch+sKYeIhdymjuMQta +x15OklctmrZtqre5kwPUosG3/B2/ikuPYElcHgGPL4uL5Em6S5C/oozfkYzhwRrT +SQzvYjsE4I34To4UdE9KA97wrQjGoz2Bx72WDLyWwctD3DKQtYeHXswXXtXwKfjQ +7Fy4+Bf5IPh76dA8NJ6UtjjLIDlKqdxLW4atHe6xWFaJ+XdLUtsAroZcXBeWDCPa +buXCDscJcLJRKZVc62gOZXXtPfoHqvUPp3nuLA4YjH9bphbrMWMf810Wxz9JTd3v +yWgGqNY0zbBqeZoGv+TuExlRHT8ASGFS9SVDABEBAAHNNUdpdEh1YiAod2ViLWZs +b3cgY29tbWl0IHNpZ25pbmcpIDxub3JlcGx5QGdpdGh1Yi5jb20+wsBiBBMBCAAW +BQJZlGhBCRBK7hj4Ov3rIwIbAwIZAQAAmQEIACATWFmi2oxlBh3wAsySNCNV4IPf +DDMeh6j80WT7cgoX7V7xqJOxrfrqPEthQ3hgHIm7b5MPQlUr2q+UPL22t/I+ESF6 +9b0QWLFSMJbMSk+BXkvSjH9q8jAO0986/pShPV5DU2sMxnx4LfLfHNhTzjXKokws ++8ptJ8uhMNIDXfXuzkZHIxoXk3rNcjDN5c5X+sK8UBRH092BIJWCOfaQt7v7wig5 +4Ra28pM9GbHKXVNxmdLpCFyzvyMuCmINYYADsC848QQFFwnd4EQnupo6QvhEVx1O +j7wDwvuH5dCrLuLwtwXaQh0onG4583p0LGms2Mf5F+Ick6o/4peOlBoZz48= +=HXDP +-----END PGP PUBLIC KEY BLOCK----------BEGIN PGP PUBLIC KEY BLOCK----- + +xsBNBFmUaEEBCACzXTDt6ZnyaVtueZASBzgnAmK13q9Urgch+sKYeIhdymjuMQta +x15OklctmrZtqre5kwPUosG3/B2/ikuPYElcHgGPL4uL5Em6S5C/oozfkYzhwRrT +SQzvYjsE4I34To4UdE9KA97wrQjGoz2Bx72WDLyWwctD3DKQtYeHXswXXtXwKfjQ +7Fy4+Bf5IPh76dA8NJ6UtjjLIDlKqdxLW4atHe6xWFaJ+XdLUtsAroZcXBeWDCPa +buXCDscJcLJRKZVc62gOZXXtPfoHqvUPp3nuLA4YjH9bphbrMWMf810Wxz9JTd3v +yWgGqNY0zbBqeZoGv+TuExlRHT8ASGFS9SVDABEBAAHNNUdpdEh1YiAod2ViLWZs +b3cgY29tbWl0IHNpZ25pbmcpIDxub3JlcGx5QGdpdGh1Yi5jb20+wsBiBBMBCAAW +BQJZlGhBCRBK7hj4Ov3rIwIbAwIZAQAAmQEIACATWFmi2oxlBh3wAsySNCNV4IPf +DDMeh6j80WT7cgoX7V7xqJOxrfrqPEthQ3hgHIm7b5MPQlUr2q+UPL22t/I+ESF6 +9b0QWLFSMJbMSk+BXkvSjH9q8jAO0986/pShPV5DU2sMxnx4LfLfHNhTzjXKokws ++8ptJ8uhMNIDXfXuzkZHIxoXk3rNcjDN5c5X+sK8UBRH092BIJWCOfaQt7v7wig5 +4Ra28pM9GbHKXVNxmdLpCFyzvyMuCmINYYADsC848QQFFwnd4EQnupo6QvhEVx1O +j7wDwvuH5dCrLuLwtwXaQh0onG4583p0LGms2Mf5F+Ick6o/4peOlBoZz48= +=HXDP +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/sys-pihole/files/server/keys/otrust.txt b/salt/sys-pihole/files/server/keys/otrust.txt new file mode 100644 index 0000000..28d9d10 --- /dev/null +++ b/salt/sys-pihole/files/server/keys/otrust.txt @@ -0,0 +1,3 @@ +# List of assigned trustvalues, created Thu 02 Nov 2023 09:43:48 PM UTC +# (Use "gpg --import-ownertrust" to restore them) +5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23:6: diff --git a/salt/sys-pihole/files/server/keys/pubring.kbx b/salt/sys-pihole/files/server/keys/pubring.kbx new file mode 100644 index 0000000..25df668 Binary files /dev/null and b/salt/sys-pihole/files/server/keys/pubring.kbx differ diff --git a/salt/sys-pihole/files/server/keys/trustdb.gpg b/salt/sys-pihole/files/server/keys/trustdb.gpg new file mode 100644 index 0000000..e08b410 Binary files /dev/null and b/salt/sys-pihole/files/server/keys/trustdb.gpg differ diff --git a/salt/sys-pihole/files/server/mimeapps.list b/salt/sys-pihole/files/server/mimeapps.list new file mode 100644 index 0000000..8b24927 --- /dev/null +++ b/salt/sys-pihole/files/server/mimeapps.list @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2023 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Default Applications] +x-scheme-handler/http=pihole-browser-general.desktop +x-scheme-handler/https=pihole-browser-general.desktop diff --git a/salt/sys-pihole/files/server/network/50-pihole.conf b/salt/sys-pihole/files/server/network/50-pihole.conf new file mode 100644 index 0000000..b98cc78 --- /dev/null +++ b/salt/sys-pihole/files/server/network/50-pihole.conf @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +$HTTP["remoteip"] !~ "127.0.0.1" { + $HTTP["url"] =~ "^/admin/" { + url.access-deny = ( "" ) + } +} + +# vim: ft=apache diff --git a/salt/sys-pihole/files/server/network/eth0 b/salt/sys-pihole/files/server/network/eth0 new file mode 100644 index 0000000..bd6e8d3 --- /dev/null +++ b/salt/sys-pihole/files/server/network/eth0 @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: 2022 - 2023 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +auto eth0 +iface eth0 inet static +address +netmask 255.0.0.0 +gateway diff --git a/salt/sys-pihole/files/server/network/setupVars.conf b/salt/sys-pihole/files/server/network/setupVars.conf new file mode 100644 index 0000000..f5a3383 --- /dev/null +++ b/salt/sys-pihole/files/server/network/setupVars.conf @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2022 - 2023 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +PIHOLE_INTERFACE=eth0 +PIHOLE_DNS_1=9.9.9.9 +PIHOLE_DNS_2=149.112.112.112 +QUERY_LOGGING=true +INSTALL_WEB_SERVER=true +INSTALL_WEB_INTERFACE=true +LIGHTTPD_ENABLED=true +CACHE_SIZE=10000 +DNS_FQDN_REQUIRED=true +DNS_BOGUS_PRIV=true +DNSMASQ_LISTENING=local +WEBPASSWORD=1832d74a8cd6d9b8cb0f9db646500f1ac9733d104ebbf9f9be157391fb051bfb +BLOCKING_ENABLED=true +WEBTHEME=default-dark diff --git a/salt/sys-pihole/files/server/pihole-browser-general.desktop b/salt/sys-pihole/files/server/pihole-browser-general.desktop new file mode 100644 index 0000000..def4de0 --- /dev/null +++ b/salt/sys-pihole/files/server/pihole-browser-general.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Pi-Hole Browser URL Forwarder +Exec=qvm-open-in-vm -- @default %u +Icon=web-browser +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=synchronization;interface; +Categories=Network;WebBrowser;FileTransfer;P2P; diff --git a/salt/sys-pihole/files/server/pihole-browser.desktop b/salt/sys-pihole/files/server/pihole-browser.desktop new file mode 100644 index 0000000..c25cfb7 --- /dev/null +++ b/salt/sys-pihole/files/server/pihole-browser.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Pi-Hole Browser +Exec=qvm-open-in-vm -- @default http://127.0.0.1:80/admin +Icon=web-browser +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=synchronization;interface; +Categories=Network;WebBrowser; diff --git a/salt/sys-pihole/init.top b/salt/sys-pihole/init.top new file mode 100644 index 0000000..f9a6137 --- /dev/null +++ b/salt/sys-pihole/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-pihole.create + 'sys-pihole': + - sys-pihole.install + 'sys-pihole-browser': + - sys-pihole.configure-browser diff --git a/salt/sys-pihole/install.sls b/salt/sys-pihole/install.sls new file mode 100644 index 0000000..f0787a8 --- /dev/null +++ b/salt/sys-pihole/install.sls @@ -0,0 +1,230 @@ +{# +SPDX-FileCopyrightText: 2022 - 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' %} + +{% set pihole_tag = 'v5.17.2' -%} + +include: + - dotfiles.copy-x11 + +{% set qubes_ip = salt['cmd.shell']('qubesdb-read /qubes-ip') %} +{% set qubes_gateway = salt['cmd.shell']('qubesdb-read /qubes-gateway') %} + +"{{ slsdotpath }}-set-eth0-interface": + file.managed: + - name: /etc/network/interfaces.d/eth0 + - source: salt://{{ slsdotpath }}/files/server/network/eth0 + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-set-ip": + file.line: + - name: /etc/network/interfaces.d/eth0 + - match: address + - mode: replace + - content: "address {{ qubes_ip }}" + +"{{ slsdotpath }}-set-gateway": + file.line: + - name: /etc/network/interfaces.d/eth0 + - match: gateway + - mode: replace + - content: "gateway {{ qubes_gateway }}" + +"{{ slsdotpath }}-restart-networking": + cmd.run: + - name: systemctl restart networking + - runas: root + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-passwordless-root + - qubes-core-agent-dom0-updates + - qubes-core-agent-networking + - ca-certificates + - curl + - dnsutils + - git + - idn2 + - lighttpd + - netcat-openbsd + - php-cgi + - php-common + - php-intl + - php-json + - php-sqlite3 + - php-xml + - unzip + +"{{ slsdotpath }}-disable-external-admin-interface": + file.managed: + - name: /etc/lighttpd/conf-available/50-pihole.conf + - source: salt://{{ slsdotpath }}/files/server/network/50-pihole.conf + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-disable-external-admin-interface-symlink": + file.symlink: + - name: /etc/lighttpd/conf-available/50-pihole.conf + - target: /etc/lighttpd/conf-enabled/50-pihole.conf + - force: True + +"{{ slsdotpath }}-disable-systemd-resolved": + service.disabled: + - name: systemd-resolved + +"{{ slsdotpath }}-setupVars.conf": + file.managed: + - name: /etc/pihole/setupVars.conf + - source: salt://{{ slsdotpath }}/files/server/network/setupVars.conf + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-git-clone": + git.latest: + - name: https://github.com/pi-hole/pi-hole.git + - user: root + - target: /root/pi-hole + - force_fetch: True + +"{{ slsdotpath }}-gnupg-home-for-pihole": + file.directory: + - name: /root/.gnupg/pihole + - user: root + - group: root + - mode: '0700' + - makedirs: True + +"{{ slsdotpath }}-keyring-and-trustdb": + file.managed: + - user: root + - group: root + - mode: '0600' + - names: + - /root/.gnupg/pihole/pubring.kbx: + - source: salt://{{ slsdotpath }}/files/server/keys/pubring.kbx + - /root/.gnupg/pihole/trustdb.gpg: + - source: salt://{{ slsdotpath }}/files/server/keys/trustdb.gpg + +## The tag is annotated, using verify-commit instead. +"{{ slsdotpath }}-git-verify-tag-pihole": + cmd.run: + - require: + - git: "{{ slsdotpath }}-git-clone" + - name: GNUPGHOME="$HOME/.gnupg/pihole" git verify-commit {{ pihole_tag }} + - cwd: /root/pi-hole + - runas: root + +"{{ slsdotpath }}-git-checkout-tag-{{ pihole_tag }}": + cmd.run: + - name: git checkout {{ pihole_tag }} + - require: + - cmd: "{{ slsdotpath }}-git-verify-tag-pihole" + - cwd: /root/pi-hole + - runas: root + +"{{ slsdotpath }}-setup": + cmd.run: + - name: ./basic-install.sh --unattended + - require: + - cmd: "{{ slsdotpath }}-git-checkout-tag-{{ pihole_tag }}" + - cwd: '/root/pi-hole/automated install' + - runas: root + +"{{ slsdotpath }}-qubes-firewall-user-script": + file.append: + - name: /rw/config/qubes-firewall-user-script + - text: + - nft flush chain nat PR-QBS + - nft insert rule nat PR-QBS iifname "vif*" tcp dport 53 dnat to 127.0.0.1 + - nft insert rule nat PR-QBS iifname "vif*" udp dport 53 dnat to 127.0.0.1 + +"{{ slsdotpath }}-firewall-update-nft-rules": + file.managed: + - name: /rw/config/qubes-firewall.d/update_nft.sh + - source: salt://{{ slsdotpath }}/files/server/firewall/update_nft.sh + - user: root + - group: root + - makedirs: True + - mode: '0755' + +"{{ slsdotpath }}-firewall-route-localnet": + file.managed: + - name: /rw/config/network-hooks.d/internalise.sh + - source: salt://{{ slsdotpath }}/files/server/firewall/internalise.sh + - user: root + - group: root + - makedirs: True + - mode: '0755' + +"{{ slsdotpath }}-firewall-flush": + file.managed: + - name: /rw/config/network-hooks.d/flush.sh + - source: salt://{{ slsdotpath }}/files/server/firewall/flush.sh + - user: root + - group: root + - makedirs: True + - mode: '0755' + +"{{ slsdotpath }}-firewall-flush-rules": + file.managed: + - name: /rw/config/network-hooks.d/flush + - source: salt://{{ slsdotpath }}/files/server/firewall/flush + - user: root + - group: root + - makedirs: True + - mode: '0755' + +"{{ slsdotpath }}-dnsmasq": + file.prepend: + - name: /etc/dnsmasq.conf + - text: + - interface=lo + - bind-interfaces + +"{{ slsdotpath }}-desktop-application-browser": + file.managed: + - name: /usr/share/applications/pihole-browser.desktop + - source: salt://{{ slsdotpath }}/files/server/pihole-browser.desktop + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-desktop-application-open-general": + file.managed: + - name: /usr/share/applications/pihole-browser-general.desktop + - source: salt://{{ slsdotpath }}/files/server/pihole-browser-general.desktop + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-etc-mimeapps.list": + file.managed: + - name: /etc/xdg/mimeapps.list + - source: salt://{{ slsdotpath }}/files/server/mimeapps.list + - mode: '0644' + - user: root + - group: root + - makedirs: True + +{% endif -%} diff --git a/salt/sys-pihole/install.top b/salt/sys-pihole/install.top new file mode 100644 index 0000000..e5ae6c7 --- /dev/null +++ b/salt/sys-pihole/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-pihole': + - sys-pihole.install diff --git a/salt/sys-pihole/prefs.sls b/salt/sys-pihole/prefs.sls new file mode 100644 index 0000000..ffa53e8 --- /dev/null +++ b/salt/sys-pihole/prefs.sls @@ -0,0 +1,28 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +"{{ slsdotpath }}-change-prefs": + cmd.script: + - name: prefs.sh + - source: salt://{{ slsdotpath }}/files/admin/prefs.sh + +{# +"{{ slsdotpath }}-start": + qvm.start: + - name: {{ slsdotpath }} + +"{{ slsdotpath }}-qubes-prefs-updatevm": + cmd.run: + - require: + - qvm: "{{ slsdotpath }}-start" + - name: qubes-prefs updatevm {{ slsdotpath }} + +"{{ slsdotpath }}-qubes-prefs-default_netvm": + cmd.run: + - require: + - qvm: "{{ slsdotpath }}-start" + - name: qubes-prefs default_netvm {{ slsdotpath }} +#} diff --git a/salt/sys-pihole/prefs.top b/salt/sys-pihole/prefs.top new file mode 100644 index 0000000..b6b91b1 --- /dev/null +++ b/salt/sys-pihole/prefs.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-pihole.prefs diff --git a/salt/sys-rsync/README.md b/salt/sys-rsync/README.md new file mode 100644 index 0000000..8e6b4fb --- /dev/null +++ b/salt/sys-rsync/README.md @@ -0,0 +1,102 @@ +# sys-rsync + +Rsync over Qrexec in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Access Control](#access-control) +* [Usage](#usage) + * [Server](#server) + * [Client](#client) +* [Credits](#credits) + +## Description + +Creates a Rsync server qube named "sys-rsync" to be a central document +store to which other qubes have access. This is a simple tool that allows +individual qubes read/write access to the store using Rsync, rather than using +`qvm-copy` or `qvm-move`. + +The greatest problem with SSH is that with large file system, it can freeze +or be very slow to navigate the directories (not so much with Qrexec as the +connection does not go over the network) and chroots need to be configured by +the user. + +## Installation + +- Top: +```sh +qubesctl top.enable sys-rsync +qubesctl --targets=tpl-sys-rsync,sys-rsync state.apply +qubesctl top.disable sys-rsync +``` + +- State: + +```sh +qubesctl state.apply sys-rsync.create +qubesctl --skip-dom0 --targets=tpl-sys-rsync state.apply sys-rsync.install +qubesctl --skip-dom0 --targets=sys-rsync state.apply sys-rsync.configure +``` + + +Install on the client template: +```sh +qubesctl --skip-dom0 --targets=TEMPLATE state.apply sys-rsync.install-client +``` + +The client qube requires the Rsync forwarder service to be enabled: +``` +qvm-features QUBE service.rsync-setup 1 +``` + +## Access Control + +A `qusal.Rsync` service is created to allow use of Rsync over Qrexec. The +default policy `asks` if you want to connect with the `sys-rsync` qube. + +If you want to `allow` Rsync between qubes, insert in you user policy file +`/etc/qubes/policy.d/30-user.policy` to allow the service using the following +format: +```qrexecpolicy +qusal.Rsync * SOURCE @default allow target=TARGET +``` + +When the client can change the data on the server, it can also possibly +compromise the server or at least make it hold malicious files and propagate +the malicious data with client it is connected to. + +## Usage + +### Server + +The default setting is to have a **read/write** store at `/home/user/shared`, +and a **read-only** directory at `/home/user/archive`. All the usual Rsync +configuration options are available and you can create other shared +directories at will. Additional configuration can be made by editing `.conf` +files in `/usr/local/etc/rsync.d/*.conf`. Because access appears to come from +localhost, host control directives will not work. + +If you have more than one rsync server qube, you can use +[bind-dirs](https://www.qubes-os.org/doc/bind-dirs/) to change the available +folders on each server qube. + +### Client + +The Rsync connection is available with the socket `localhost:1839`. + +Rsync the server `shared` read/write directory: +```sh +rsync --port=1839 localhost::shared /LOCAL/PATH/TO/RSYNC +``` + +Rsync the server `archive` read-only directory: +```sh +rsync --port=1839 localhost::archive /LOCAL/PATH/TO/RSYNC +``` + +## Credits + +- [Unman](https://github.com/unman/qubes-sync) diff --git a/salt/sys-rsync/clone.sls b/salt/sys-rsync/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-rsync/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-rsync/clone.top b/salt/sys-rsync/clone.top new file mode 100644 index 0000000..8d36c14 --- /dev/null +++ b/salt/sys-rsync/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-rsync.clone diff --git a/salt/sys-rsync/configure.sls b/salt/sys-rsync/configure.sls new file mode 100644 index 0000000..dcf440c --- /dev/null +++ b/salt/sys-rsync/configure.sls @@ -0,0 +1,38 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - dev.home-cleanup + +"{{ slsdotpath }}-start-rsync-on-boot": + file.append: + - name: /rw/config/rc.local + - source: salt://{{ slsdotpath }}/files/server/rc.local + +"{{ slsdotpath }}-creates-local-rsync-configuration-dir": + file.directory: + - name: /usr/local/etc/rsync.d + - mode: '0755' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-creates-archive-dir": + file.directory: + - name: /home/user/archive + - mode: '0777' + - user: user + - group: user + - makedirs: True + +"{{ slsdotpath }}-creates-shared-dir": + file.directory: + - name: /home/user/shared + - mode: '0777' + - user: user + - group: user + - makedirs: True diff --git a/salt/sys-rsync/configure.top b/salt/sys-rsync/configure.top new file mode 100644 index 0000000..4dce6a7 --- /dev/null +++ b/salt/sys-rsync/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-rsync': + - sys-rsync.configure diff --git a/salt/sys-rsync/create.sls b/salt/sys-rsync/create.sls new file mode 100644 index 0000000..5685340 --- /dev/null +++ b/salt/sys-rsync/create.sls @@ -0,0 +1,48 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: yellow +prefs: +- template: tpl-{{ slsdotpath }} +- label: yellow +- netvm: "" +- vcpus: 1 +- memory: 300 +- maxmem: 600 +- autostart: False +- include_in_backups: True +features: +- enable: + - servicevm +- disable: + - service.cups + - service.cups-browsed +- set: + - menu-items: "qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-resize-private-volume": + cmd.run: + - name: qvm-volume extend {{ slsdotpath }}:private 40Gi + - require: + - qvm: {{ slsdotpath }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-rsync/create.top b/salt/sys-rsync/create.top new file mode 100644 index 0000000..08de41a --- /dev/null +++ b/salt/sys-rsync/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-rsync.create diff --git a/salt/sys-rsync/files/admin/policy/default.policy b/salt/sys-rsync/files/admin/policy/default.policy new file mode 100644 index 0000000..0885743 --- /dev/null +++ b/salt/sys-rsync/files/admin/policy/default.policy @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qusal.Rsync * @anyvm @default ask target={{ sls_path }} default_target={{ sls_path }} +qusal.Rsync * @anyvm @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/sys-rsync/files/client/systemd/qubes-rsync-forwarder.socket b/salt/sys-rsync/files/client/systemd/qubes-rsync-forwarder.socket new file mode 100644 index 0000000..6e5b60d --- /dev/null +++ b/salt/sys-rsync/files/client/systemd/qubes-rsync-forwarder.socket @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +exec socat STDIO TCP:localhost:873 diff --git a/salt/sys-rsync/files/server/rsync/rsyncd.conf b/salt/sys-rsync/files/server/rsync/rsyncd.conf new file mode 100644 index 0000000..51b2234 --- /dev/null +++ b/salt/sys-rsync/files/server/rsync/rsyncd.conf @@ -0,0 +1,36 @@ +# rsyncd.conf configuration file +# vim: ft=toml + +# SPDX-FileCopyrightText: 2020 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-rsync.create + 'tpl-sys-rsync': + - sys-rsync.install + 'sys-rsync': + - sys-rsync.configure diff --git a/salt/sys-rsync/install-client.sls b/salt/sys-rsync/install-client.sls new file mode 100644 index 0000000..e4997ee --- /dev/null +++ b/salt/sys-rsync/install-client.sls @@ -0,0 +1,36 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated-client": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-client": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - rsync + +"{{ slsdotpath }}-client-systemd": + file.recurse: + - name: /usr/lib/systemd/system/ + - source: salt://{{ slsdotpath }}/files/client/systemd/ + - dir_mode: '0755' + - file_mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-client-systemd-start-qubes-rsync-forwarder.socket": + service.enabled: + - name: qubes-rsync-forwarder.socket + +{% endif -%} diff --git a/salt/sys-rsync/install-client.top b/salt/sys-rsync/install-client.top new file mode 100644 index 0000000..c1be226 --- /dev/null +++ b/salt/sys-rsync/install-client.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - sys-rsync.install-client diff --git a/salt/sys-rsync/install.sls b/salt/sys-rsync/install.sls new file mode 100644 index 0000000..2aa5101 --- /dev/null +++ b/salt/sys-rsync/install.sls @@ -0,0 +1,54 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - rsync + - socat + +"{{ slsdotpath }}-stop-rsync": + service.dead: + - name: rsync + +"{{ slsdotpath }}-disable-rsync": + service.disabled: + - name: rsync + +"{{ slsdotpath }}-mask-rsync": + service.masked: + - name: rsync + +"{{ slsdotpath }}-set-rsyncd.conf": + file.managed: + - name: /etc/rsyncd.conf + - source: salt://{{ slsdotpath }}/files/server/rsync/rsyncd.conf + - mode: '0755' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-set-rpc-services": + file.recurse: + - name: /etc/qubes-rpc/ + - source: salt://{{ slsdotpath }}/files/server/rpc/ + - dir_mode: '0755' + - file_mode: '0755' + - user: root + - group: root + - makedirs: True + +{% endif -%} diff --git a/salt/sys-rsync/install.top b/salt/sys-rsync/install.top new file mode 100644 index 0000000..195e624 --- /dev/null +++ b/salt/sys-rsync/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-rsync': + - sys-rsync.install diff --git a/salt/sys-ssh-agent/README.md b/salt/sys-ssh-agent/README.md new file mode 100644 index 0000000..ffae6e1 --- /dev/null +++ b/salt/sys-ssh-agent/README.md @@ -0,0 +1,233 @@ +# sys-ssh-agent + +SSH Agent through Qrexec in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Security](#security) +* [Installation](#installation) +* [Access Control](#access-control) +* [Usage](#usage) + * [Server](#server) + * [Generate keys](#generate-keys) + * [Limit key usage](#limit-key-usage) + * [Reload agent](#reload-agent) + * [Debug Agent side](#debug-agent-side) + * [Client](#client) + * [Enable and Start the service](#enable-and-start-the-service) + * [Single agent per client](#single-agent-per-client) + * [Multiple agents per client](#multiple-agents-per-client) +* [Credits](#credits) + +## Description + +The key pairs are stored on the offline ssh-agent server named +"sys-ssh-agent", and requests are passed from clients to the server via +Qrexec. Clients may access the same ssh-agent of a qube, or access different +agents. In other words, this is an implementation of split-ssh-agent. + +The client does not know the identity of the ssh-agent server, nor are keys +kept in memory in the client. This method is ideal for cases where you have a +number of key pairs, which are used by different qubes. + +A centralized SSH server is very useful not only for keeping your private keys +safe, but also for keeping your workflow organized. You can delete qubes that +are SSH clients without loosing access to your remote server, because the +authentication keys are on the sys-ssh-agent server, your client qube should +only hold the SSH configuration, which can be reconstructed. + +## Security + +The private keys are never stored in the client qube, not even in memory, but +certain attack scenarios are still possible because there is no filtering +proxy, in fact the client controls the agent in the server it is connecting +to. + +A rogue client has full control of the allowed agent, therefore it can: + +1. Use the keys for as long as the client runs; +2. Lock the agent with `ssh-add -X`; and +3. Delete keys from memory by issuing `ssh-add -D` + +## Installation + +- Top: +```sh +qubesctl top.enable sys-ssh-agent +qubesctl --targets=tpl-sys-ssh-agent,sys-ssh-agent state.apply +qubesctl top.disable sys-ssh-agent +``` + +- State: + +```sh +qubesctl state.apply sys-ssh-agent.create +qubesctl --skip-dom0 --targets=tpl-sys-ssh-agent state.apply sys-ssh-agent.install +qubesctl --skip-dom0 --targets=sys-ssh-agent state.apply sys-ssh-agent.configure +``` + + +Installation on the client template: +```sh +qubesctl --skip-dom0 --targets=TEMPLATE state.apply sys-ssh-agent.install-client +``` + +## Access Control + +_Default policy_: `deny` `all` requests requesting to use the +`qusal.SshAgent` RPC service. + +As the default policy does not configure any allow rule, you are responsible +for doing so. + +Allow access to the specified agent based on the qube tag: +```qrexecpolicy +qusal.SshAgent +work @tag:work @default allow target=sys-ssh-agent +qusal.SshAgent +work @anyvm @anyvm deny +qusal.SshAgent +personal @tag:personal @default ask target=sys-ssh-agent default_target=sys-ssh-agent +qusal.SshAgent +personal @anyvm @anyvm deny +``` + +Ask access from `untrusted` qubes to the untrusted agent: +```qrexecpolicy +qusal.SshAgent +untrusted untrusted @default ask target=sys-ssh-agent default_target=sys-ssh-agent +qusal.SshAgent +untrusted @anyvm @anyvm deny +``` + +Ask access from `trusted` to use the agent `trusted` on the alternative qube agent named `sys-ssh-agent-trusted`: +```qrexecpolicy +qusal.SshAgent +trusted trusted @default ask target=sys-ssh-agent-trusted default_target=sys-ssh-agent-trusted +qusal.SshAgent +trusted @anyvm @anyvm deny +``` + +Always recommended to end with an explicit deny rule: +```qrexecpolicy +qusal.SshAgent * @anyvm @anyvm deny +``` + +## Usage + +### Server + +#### Generate keys + +Keys can be selectively allocated to different ssh-agents by adding them to +different directories under `~/.ssh/identities.d/`, where the `` +directory should have the same name as the agent itself. Example: +`~/.ssh/identities.d/work`. + +Import preexisting keys to the agent directory or generate keys for a specific +agent: +```sh +mkdir -m 0700 -p ~/.ssh/identities.d/ +ssh-keygen -t ed25519 -f ~/.ssh/identities.d//id_example +``` + +You would do the following for the `work` agent: +```sh +mkdir -m 0700 -p ~/.ssh/identities.d/work +ssh-keygen -t ed25519 -f ~/.ssh/identities.d/work/id_example +``` + +#### Limit key usage + +For exceptionally valuable keys you may want to limit the time that they are +available and the agent forwarding permission to different hosts. + +You can set custom options by writing them to a file on the same path of the +private key, but ending with the suffix `.ssh-add-option`. If the key is named +`id_ed25519`, the option file should be named `id_ed25519.ssh-add-option`. +The `.ssh-add-option` file has the following format: +```sh +# id_ed25519.ssh-add-option +-q -t 600 +-h "perseus@cetus.example.org" -h "scylla.example.org" +-h "scylla.example.org>medea@charybdis.example.org" +``` + +Or you can manually add the key to the agent which are not located under the +`~/.ssh/identities.d` directory so they aren't automatically added (substitute +AGENT, SECS, and LIFE for their appropriate values): +```sh +SSH_AUTH_SOCK="/run/user/1000/qubes-ssh-agent/.sock" ssh-add -t -f +``` + +#### Reload agent + +The keys are added to the agent on the first call to that specific agent. +If you have added keys to the correct agent directory but haven't rebooted +yet, you will have to add the keys by executing: +```sh +qvm-ssh-agent reload +qvm-ssh-agent reload work +``` + +#### Debug Agent side + +You can list agents and their keys with: +```sh +qvm-ssh-agent ls +``` + +Follow SSH agents journal: +```sh +journalctl --user -fu qubes-ssh-agent@*.service +``` + +### Client + +#### Enable and Start the service + +Enable and start the connection to the SSH Agent via Qrexec for specified +``: +```sh +sudo systemctl --no-block restart qubes-ssh-agent-forwarder@.service +sudo systemctl --no-block restart qubes-ssh-agent-forwarder@personal.service +``` +You can start the service on boot if you place the above line +`/rw/config/rc.local` of the client. + +The ssh-agent socket will be at `/tmp/qubes-ssh-agent-forwarder/.sock`. + +You can test the connection is working with: +```sh +SSH_AUTH_SOCK="/tmp/qubes-ssh-agent-forwarder/personal.sock" ssh-add -l +``` + +#### Single agent per client + +You might want to set the `SSH_AUTH_SOCK` and `SSH_AGENT_PID` environment +variables to point to the `work` agent so every connection will use the same +agent: +```sh +echo 'export SSH_AUTH_SOCK=/tmp/qubes-ssh-agent-forwarder/work.sock; +SSH_AGENT_PID="$(pgrep -f "/tmp/qubes-ssh-agent-forwarder/work.sock")"; +' | tee -a ~/.profile +``` + +#### Multiple agents per client + +In case you have multiple agents that you want to use in the same client, +messing with the environment every time you want to make a connection to a +different agent is not an alternative. Instead, use SSH client native method, +the `IdentityAgent` option. + +You can control the SSH agent via SSH command-line option: +```sh +ssh -o IdentityAgent=/tmp/qubes-ssh-agent-forwarder/personal.sock personal-site.com +ssh -o IdentityAgent=/tmp/qubes-ssh-agent-forwarder/work.sock work-site.com +``` +You can control the SSH agent via SSH configuration: +```sshconfig +Host personal + IdentityAgent /tmp/qubes-ssh-agent-forwarder/personal.sock + ... +Host work + IdentityAgent /tmp/qubes-ssh-agent-forwarder/work.sock + ... +``` + +## Credits + +- [Unman](https://github.com/unman/qubes-ssh-agent) diff --git a/salt/sys-ssh-agent/clone.sls b/salt/sys-ssh-agent/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-ssh-agent/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-ssh-agent/clone.top b/salt/sys-ssh-agent/clone.top new file mode 100644 index 0000000..52a99b5 --- /dev/null +++ b/salt/sys-ssh-agent/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-ssh-agent.clone diff --git a/salt/sys-ssh-agent/configure.sls b/salt/sys-ssh-agent/configure.sls new file mode 100644 index 0000000..1caa5e5 --- /dev/null +++ b/salt/sys-ssh-agent/configure.sls @@ -0,0 +1,29 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dev.home-cleanup + - dotfiles.copy-x11 + +"{{ slsdotpath }}-create-ssh-directory": + file.directory: + - name: /home/user/.ssh + - mode: '0700' + - user: user + - group: user + - makedirs: True + +"{{ slsdotpath }}-create-keys-directory": + file.directory: + - name: /home/user/.ssh/identities.d + - mode: '0700' + - user: user + - group: user + - makedirs: True + +{% endif %} diff --git a/salt/sys-ssh-agent/configure.top b/salt/sys-ssh-agent/configure.top new file mode 100644 index 0000000..3a8a6bb --- /dev/null +++ b/salt/sys-ssh-agent/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-ssh-agent': + - sys-ssh-agent.configure diff --git a/salt/sys-ssh-agent/create.sls b/salt/sys-ssh-agent/create.sls new file mode 100644 index 0000000..1c33726 --- /dev/null +++ b/salt/sys-ssh-agent/create.sls @@ -0,0 +1,38 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: gray +prefs: +- template: tpl-{{ slsdotpath }} +- label: gray +- netvm: "" +- memory: 200 +- maxmem: 300 +- vcpus: 1 +features: +- enable: + - servicevm +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy +{%- endload %} +{{ load(defaults) }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-ssh-agent/create.top b/salt/sys-ssh-agent/create.top new file mode 100644 index 0000000..1cf7a8f --- /dev/null +++ b/salt/sys-ssh-agent/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-ssh-agent.create diff --git a/salt/sys-ssh-agent/files/admin/policy/default.policy b/salt/sys-ssh-agent/files/admin/policy/default.policy new file mode 100644 index 0000000..e1c1676 --- /dev/null +++ b/salt/sys-ssh-agent/files/admin/policy/default.policy @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qusal.SshAgent * @anyvm @default ask target={{ sls_path }} default_target={{ sls_path }} +qusal.SshAgent * @anyvm @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/sys-ssh-agent/files/client/systemd/qubes-ssh-agent-forwarder@.service b/salt/sys-ssh-agent/files/client/systemd/qubes-ssh-agent-forwarder@.service new file mode 100644 index 0000000..dddc67f --- /dev/null +++ b/salt/sys-ssh-agent/files/client/systemd/qubes-ssh-agent-forwarder@.service @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Unit] +Description=SSH Agent Forwarder to Qrexec SSH Agent %i + +[Service] +User=user +Group=user +Type=simple +UMask=0177 +ExecStartPre=/usr/bin/mkdir -m 700 -p %T/%p +ExecStartPre=/usr/bin/ssh-agent -a %T/%p/%i.sock +ExecStart=/usr/bin/socat UNIX-LISTEN:"%T/%p/%i.sock,unlink-early,reuseaddr,fork" EXEC:"qrexec-client-vm -- @default qusal.SshAgent+%i" + +[Install] +WantedBy=default.target diff --git a/salt/sys-ssh-agent/files/server/bin/qvm-ssh-agent b/salt/sys-ssh-agent/files/server/bin/qvm-ssh-agent new file mode 100755 index 0000000..edbfd1b --- /dev/null +++ b/salt/sys-ssh-agent/files/server/bin/qvm-ssh-agent @@ -0,0 +1,76 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +service="qubes-ssh-agent" + +usage(){ + echo "Usage: ${0##*/} [ls|add] + ls: list agent(s) + add: add keys to agent(s) + reload: reload/readd keys from agent(s) +Example: + ${0##*/} ls work # list the work agent keys + ${0##*/} add work # add keys to the work agent + ${0##*/} reload work # reload/readd keys from the work agent" + exit 1 +} + +ls_agent(){ + socket="/tmp/${service}/$agent.sock" + test -S "$socket" || return 1 + agent="$(echo "$socket" | sed "s|.*${service}/||;s/\.sock//")" + echo "Agent: ($agent) $socket" + SSH_AUTH_SOCK="$socket" ssh-add -l || true +} + +add_agent(){ + # shellcheck disable=SC2174 + mkdir -m 0700 -p "/tmp/${service}" + dir="$HOME/.ssh/identities.d/${agent}" + if ! test -d "$dir"; then + echo "Directory not found: $dir" >&2 + return 1 + fi + dir="${dir##*/}" + socket="/tmp/${service}/${dir}.sock" + if ! test -S "$socket"; then + reload_agent=1 + ssh-agent -a "/tmp/${service}/${agent}.sock" + fi + if ! test "${reload_agent}" = "1"; then + return + fi + keys="$(grep -sl -- "-----BEGIN OPENSSH PRIVATE KEY-----" \ + "$HOME/.ssh/identities.d/$dir"/* || true)" + if test -z "$keys"; then + echo "Directory has no key: $dir" >&2 + return 1 + fi + SSH_AUTH_SOCK="$socket" ssh-add -D 2>/dev/null || true + for k in $(printf '%s\n' "$keys"); do + test -f "$k" || continue + ssh_add_option="" + if test -f "$k.ssh-add-option"; then + ssh_add_option="$(cat "$k.ssh-add-option")" + fi + # shellcheck disable=SC2086 + SSH_AUTH_SOCK="$socket" ssh-add $ssh_add_option "$k" + done +} + +test -z "${2-}" && usage +action="${1-}" +agent="${2-}" +reload_agent="" + +case "$action" in + ls) ls_agent;; + add) add_agent;; + reload) reload_agent="1"; add_agent;; + *) usage;; +esac diff --git a/salt/sys-ssh-agent/files/server/rpc/qusal.SshAgent b/salt/sys-ssh-agent/files/server/rpc/qusal.SshAgent new file mode 100644 index 0000000..3219348 --- /dev/null +++ b/salt/sys-ssh-agent/files/server/rpc/qusal.SshAgent @@ -0,0 +1,14 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +#origin="$QREXEC_REMOTE_DOMAIN" +agent="$QREXEC_SERVICE_ARGUMENT" +socket="/tmp/qubes-ssh-agent/${agent}.sock" + +qvm-ssh-agent add "${agent}" >/dev/null +exec socat STDIO UNIX-CLIENT:"$socket" diff --git a/salt/sys-ssh-agent/init.top b/salt/sys-ssh-agent/init.top new file mode 100644 index 0000000..c01cca5 --- /dev/null +++ b/salt/sys-ssh-agent/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-ssh-agent.create + 'tpl-sys-ssh-agent': + - sys-ssh-agent.install + 'sys-ssh-agent': + - sys-ssh-agent.configure diff --git a/salt/sys-ssh-agent/install-client.sls b/salt/sys-ssh-agent/install-client.sls new file mode 100644 index 0000000..6b26df6 --- /dev/null +++ b/salt/sys-ssh-agent/install-client.sls @@ -0,0 +1,53 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - ssh.install + - dev.home-cleanup + - dotfiles.copy-sh + - dotfiles.copy-ssh + - dotfiles.copy-x11 + +"{{ slsdotpath }}-client-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-client-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - socat + +{% set pkg = { + 'Debian': { + 'pkg': ['procps'], + }, + 'RedHat': { + 'pkg': ['procps-ng'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-client-installed-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +"{{ slsdotpath }}-client-system-systemd-dir": + file.recurse: + - source: salt://{{ slsdotpath }}/files/client/systemd/ + - name: /usr/lib/systemd/system/ + - dir_mode: '0755' + - file_mode: '0644' + - user: root + - group: root + +{% endif %} diff --git a/salt/sys-ssh-agent/install-client.top b/salt/sys-ssh-agent/install-client.top new file mode 100644 index 0000000..b1b5eea --- /dev/null +++ b/salt/sys-ssh-agent/install-client.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - sys-ssh-agent.install-client diff --git a/salt/sys-ssh-agent/install.sls b/salt/sys-ssh-agent/install.sls new file mode 100644 index 0000000..0226960 --- /dev/null +++ b/salt/sys-ssh-agent/install.sls @@ -0,0 +1,61 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - ssh.install + - dev.home-cleanup + - dotfiles.copy-sh + - dotfiles.copy-ssh + - dotfiles.copy-x11 + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - socat + +"{{ slsdotpath }}-agent-bin-dir": + file.recurse: + - source: salt://{{ slsdotpath }}/files/server/bin + - name: /usr/bin + - file_mode: '0755' + - user: root + - group: root + +"{{ slsdotpath }}-install-rpc-service": + file.managed: + - name: /etc/qubes-rpc/qusal.SshAgent + - source: salt://{{ slsdotpath }}/files/server/rpc/qusal.SshAgent + - mode: '0755' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-skel-create-ssh-directory": + file.directory: + - name: /etc/skel/.ssh + - mode: '0700' + - user: user + - group: user + - makedirs: True + +"{{ slsdotpath }}-skel-create-keys-directory": + file.directory: + - name: /etc/skel/.ssh/identities.d + - mode: '0700' + - user: root + - group: root + - makedirs: True + +{% endif -%} diff --git a/salt/sys-ssh-agent/install.top b/salt/sys-ssh-agent/install.top new file mode 100644 index 0000000..0b7aa8b --- /dev/null +++ b/salt/sys-ssh-agent/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-ssh-agent': + - sys-ssh-agent.install diff --git a/salt/sys-ssh-agent/map.jinja b/salt/sys-ssh-agent/map.jinja new file mode 100644 index 0000000..e69de29 diff --git a/salt/sys-ssh/README.md b/salt/sys-ssh/README.md new file mode 100644 index 0000000..c63403d --- /dev/null +++ b/salt/sys-ssh/README.md @@ -0,0 +1,96 @@ +# sys-ssh + +SSH over Qrexec in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Access Control](#access-control) +* [Usage](#usage) + * [Server](#server) + * [Client](#client) +* [Credits](#credits) + +## Description + +Creates a SSH server qube named "sys-ssh" to be a central document +store to which other qubes have access with SSH File Transfer Protocol, using +the tool sshfs. This is a simple tool that allows individual qubes to mount a +another qube's filesystem rather than using `qvm-copy` or `qvm-move`. + +The greatest problem with the Rsync solution is that it makes copies of the +files or directories. This may be fine with a small amount of data, but with +large files, or large numbers of files, there's a significant overhead. SSH +File Transfer Protocol provides a way for clients to access files on the +server qube directly. + +## Installation + +- Top: +```sh +qubesctl top.enable sys-ssh +qubesctl --targets=tpl-sys-ssh,sys-ssh state.apply +qubesctl top.disable sys-ssh +``` + +- State: + +```sh +qubesctl state.apply sys-ssh.create +qubesctl --skip-dom0 --targets=tpl-sys-ssh state.apply sys-ssh.install +qubesctl --skip-dom0 --targets=sys-ssh state.apply sys-ssh.configure +``` + + +Install on the client template: +```sh +qubesctl --skip-dom0 --targets=TEMPLATE state.apply sys-ssh.install-client +``` + +The client qube requires the SSH forwarder service to be enabled: +``` +qvm-features QUBE service.ssh-setup 1 +``` + +## Access Control + +A `qusal.Ssh` service is created to allow use of SSH over Qrexec. The default +policy `asks` if you want to connect with the `sys-ssh` qube. + +If you want to `allow` SSH between qubes, insert in you user policy +file `/etc/qubes/policy.d/30-user.policy` to allow the service using the +following format: +```qrexecpolicy +qusal.Ssh * SOURCE @default allow target=TARGET +``` + +When the client can change the data on the server, it can also possibly +compromise the server or at least make it hold malicious files and propagate +the malicious data with clients it is connected to. + +## Usage + +### Server + +It is possible to constrain access to files on the server, using (e.g) SSH +chroots and access control mechanisms. This is left for the user to configure. + +Passwordless login through empty passwords are allowed when the host matches +127.0.0.1, it makes no sense to restrict the access if the Qrexec call was +already permitted. + +### Client + +The SSH connection is available with the socket `localhost:1840`. + +From the client, mount the server `/home/user` directory as a SSH File System +in the client `/home/user/sshfs` directory: +```sh +mkdir ~/sshfs +sshfs -p 1840 localhost:/home/user /home/user/sshfs +``` + +## Credits + +- [Unman](https://github.com/unman/qubes-sync) diff --git a/salt/sys-ssh/clone.sls b/salt/sys-ssh/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-ssh/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-ssh/clone.top b/salt/sys-ssh/clone.top new file mode 100644 index 0000000..aa50089 --- /dev/null +++ b/salt/sys-ssh/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-ssh.clone diff --git a/salt/sys-ssh/configure.sls b/salt/sys-ssh/configure.sls new file mode 100644 index 0000000..1785c7c --- /dev/null +++ b/salt/sys-ssh/configure.sls @@ -0,0 +1,26 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dev.home-cleanup + +"{{ slsdotpath }}-start-ssh-on-boot": + file.append: + - name: /rw/config/rc.local + - source: salt://{{ slsdotpath }}/files/server/rc.local + +"{{ slsdotpath }}-creates-home-ssh-dir": + file.directory: + - name: /home/user/.ssh + - mode: '0700' + - user: user + - group: user + - makedirs: True + +{% endif -%} diff --git a/salt/sys-ssh/configure.top b/salt/sys-ssh/configure.top new file mode 100644 index 0000000..5dc5060 --- /dev/null +++ b/salt/sys-ssh/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-ssh': + - sys-ssh.configure diff --git a/salt/sys-ssh/create.sls b/salt/sys-ssh/create.sls new file mode 100644 index 0000000..5685340 --- /dev/null +++ b/salt/sys-ssh/create.sls @@ -0,0 +1,48 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: yellow +prefs: +- template: tpl-{{ slsdotpath }} +- label: yellow +- netvm: "" +- vcpus: 1 +- memory: 300 +- maxmem: 600 +- autostart: False +- include_in_backups: True +features: +- enable: + - servicevm +- disable: + - service.cups + - service.cups-browsed +- set: + - menu-items: "qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-resize-private-volume": + cmd.run: + - name: qvm-volume extend {{ slsdotpath }}:private 40Gi + - require: + - qvm: {{ slsdotpath }} + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-ssh/create.top b/salt/sys-ssh/create.top new file mode 100644 index 0000000..9a3388f --- /dev/null +++ b/salt/sys-ssh/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-ssh.create diff --git a/salt/sys-ssh/files/admin/policy/default.policy b/salt/sys-ssh/files/admin/policy/default.policy new file mode 100644 index 0000000..bfcf781 --- /dev/null +++ b/salt/sys-ssh/files/admin/policy/default.policy @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qusal.Ssh * @anyvm @default ask target={{ sls_path }} default_target={{ sls_path }} +qusal.Ssh * @anyvm @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/sys-ssh/files/client/systemd/qubes-ssh-forwarder.socket b/salt/sys-ssh/files/client/systemd/qubes-ssh-forwarder.socket new file mode 100644 index 0000000..dd02fe6 --- /dev/null +++ b/salt/sys-ssh/files/client/systemd/qubes-ssh-forwarder.socket @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +exec socat STDIO TCP:localhost:22 diff --git a/salt/sys-ssh/files/server/sshd_config.d/sys-ssh.conf b/salt/sys-ssh/files/server/sshd_config.d/sys-ssh.conf new file mode 100644 index 0000000..7d686b9 --- /dev/null +++ b/salt/sys-ssh/files/server/sshd_config.d/sys-ssh.conf @@ -0,0 +1,9 @@ +# vim: ft=sshdconfig + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +Match User user Host 127.0.0.1 + PermitEmptyPasswords yes + AuthenticationMethods none diff --git a/salt/sys-ssh/init.top b/salt/sys-ssh/init.top new file mode 100644 index 0000000..581c2b0 --- /dev/null +++ b/salt/sys-ssh/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-ssh.create + 'tpl-sys-ssh': + - sys-ssh.install + 'sys-ssh': + - sys-ssh.configure diff --git a/salt/sys-ssh/install-client.sls b/salt/sys-ssh/install-client.sls new file mode 100644 index 0000000..c573491 --- /dev/null +++ b/salt/sys-ssh/install-client.sls @@ -0,0 +1,47 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - sys-ssh-agent.install-client + +"{{ slsdotpath }}-updated-client": + pkg.uptodate: + - refresh: True + +{% set pkg = { + 'Debian': { + 'pkg': ['sshfs'], + }, + 'RedHat': { + 'pkg': ['fuse-sshfs'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-installed-client-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +"{{ slsdotpath }}-client-systemd": + file.recurse: + - name: /usr/lib/systemd/system/ + - source: salt://{{ slsdotpath }}/files/client/systemd/ + - dir_mode: '0755' + - file_mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-client-systemd-start-qubes-ssh-forwarder.socket": + service.enabled: + - name: qubes-ssh-forwarder.socket + +{% endif -%} diff --git a/salt/sys-ssh/install-client.top b/salt/sys-ssh/install-client.top new file mode 100644 index 0000000..cb376d2 --- /dev/null +++ b/salt/sys-ssh/install-client.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - sys-ssh.install-client diff --git a/salt/sys-ssh/install.sls b/salt/sys-ssh/install.sls new file mode 100644 index 0000000..4934534 --- /dev/null +++ b/salt/sys-ssh/install.sls @@ -0,0 +1,54 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - openssh-server + - socat + +"{{ slsdotpath }}-stop-ssh": + service.dead: + - name: ssh + +"{{ slsdotpath }}-disable-ssh": + service.disabled: + - name: ssh + +"{{ slsdotpath }}-mask-ssh": + service.masked: + - name: ssh + +"{{ slsdotpath }}-set-rpc-services": + file.recurse: + - name: /etc/qubes-rpc/ + - source: salt://{{ slsdotpath }}/files/server/rpc/ + - dir_mode: '0755' + - file_mode: '0755' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-sshd-config": + file.managed: + - name: /etc/ssh/sshd_config.d/{{ slsdotpath }}.conf + - source: salt://{{ slsdotpath }}/files/server/ssh_config.d/{{ slsdotpath }}.conf + - mode: '0755' + - user: root + - group: root + - makedirs: True + +{% endif -%} diff --git a/salt/sys-ssh/install.top b/salt/sys-ssh/install.top new file mode 100644 index 0000000..8182441 --- /dev/null +++ b/salt/sys-ssh/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-ssh': + - sys-ssh.install diff --git a/salt/sys-syncthing/README.md b/salt/sys-syncthing/README.md new file mode 100644 index 0000000..0827364 --- /dev/null +++ b/salt/sys-syncthing/README.md @@ -0,0 +1,129 @@ +# sys-syncthing + +Syncthing through Qrexec in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Access Control](#access-control) +* [Usage](#usage) +* [Debugging](#debugging) +* [Uninstallation](#uninstallation) +* [Credits](#credits) + +## Description + +Creates a Syncthing qube named "sys-syncthing", it will be attached to the +"default_netvm". It makes no sense to run this with "sys-syncthing" attached +to a VPN or Tor proxy. + +This package opens up the qubes-firewall, so that the "sys-syncthing" qube is +accessible externally. + +## Installation + +- Top: +```sh +qubesctl top.enable sys-syncthing browser +qubesctl --targets=tpl-browser,tpl-sys-syncthing,sys-syncthing,sys-syncthing-browser state.apply +qubesctl top.disable sys-syncthing browser +qubesctl state.apply sys-syncthing.appmenus +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh -a -p add sys-syncthing tcp 22000 +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh -a -p add sys-syncthing udp 22000 +``` + +- State: + +```sh +qubesctl state.apply sys-syncthing.create +qubesctl --skip-dom0 --targets=tpl-browser state.apply browser.install +qubesctl --skip-dom0 --targets=tpl-sys-syncthing state.apply sys-syncthing.install +qubesctl --skip-dom0 --targets=sys-syncthing state.apply sys-syncthing.configure +qubesctl --skip-dom0 --targets=sys-syncthing-browser state.apply sys-syncthing.configure-browser +qubesctl state.apply sys-syncthing.appmenus +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh -a -p add sys-syncthing tcp 22000 +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh -a -p add sys-syncthing udp 22000 +``` + + +Install Syncthing on the client template: +```sh +qubesctl --skip-dom0 --targets=TEMPLATE state.apply sys-syncthing.install-client +``` + +The client qube requires the split Syncthing service to be enabled: +```sh +qvm-features QUBE service.syncthing-setup 1 +``` + +## Access Control + +A `qusal.Syncthing` service is created to allow use of Syncthing over +Qrexec. The default policy `asks` if you want to sync with the `sys-syncthing` +qube. + +If you want to `allow` Syncthing between qubes, insert in you user policy file +`/etc/qubes/policy.d/30-user.policy` to allow the service using the following +format: +```qrexecpolicy +qusal.Syncthing * SOURCE @default allow target=DESTINATION default_target=DEFAULT_DESTINATION +``` + +## Usage + +The Syncthing address is `http://127.0.0.1:8384`. + +If you want to view statistics or manage the server through a GUI, open +`sys-syncthing` or `sys-syncthing-browser` desktop file +`syncthing-browser.desktop` from Dom0 or run `syncthing -browser-only` from +`sys-syncthing`. Addresses starting with `http` or `https` will be redirected +to `sys-syncthing-browser`. + +The browser separation from the server is to avoid browsing malicious sites +and exposing the browser to direct network on the same machine the server is +running. The browser qube is offline and only has access to the admin +interface. In other words, it has control over the server functions, if the +browser is compromised, it can compromise the server. + +To use the service, from the client, add a Remote Device, and copy the +`DeviceID` from the server qube. On the Advanced tab, under Addresses, change +`dynamic` to `tcp://127.0.0.1:22001` + +If the sender qube has no netvm set, under `Settings`, disable `Enable NAT +traversal`, `Local Discovery`, `Global Discovery`, and `Enable Relaying` + +## Debugging + +If sys-net has more than one network card the first external interface will +be used by default. +If this is incorrect, you must change it manually. In Dom0 run: +```sh +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh delete sys-syncthing tcp 22000 -a -p +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh delete sys-syncthing udp 22000 -a -p +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh add sys-syncthing tcp 22000 -p +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh add sys-syncthing udp 22000 -p +``` +This will let you choose the NIC. + +## Uninstallation + +The `sys-syncthing` qube will not be removed, but the Syncthing service on +that qube will be stopped. The firewall rules will be reverted so the qube +will not be accessible externally. Note: If you have manually set rules you +must manually revert them. The Qrexec policy will be reverted to stop +Syncthing between qubes. + +Uninstallation procedure: + +```sh +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh -a -p delete sys-syncthing tcp 22000 +/srv/salt/qusal/sys-syncthing/files/admin/firewall/in.sh -a -p delete sys-syncthing udp 22000 +qubesctl --skip-dom0 --targets=sys-syncthing state.apply sys-syncthing.cancel +qubesctl state.apply sys-syncthing.clean +``` + + +## Credits + +- [Unman](https://github.com/unman/shaker/tree/main/syncthing) diff --git a/salt/sys-syncthing/appmenus.sls b/salt/sys-syncthing/appmenus.sls new file mode 100644 index 0000000..0d056d5 --- /dev/null +++ b/salt/sys-syncthing/appmenus.sls @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - browser.appmenus + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus('tpl-' ~ sls_path) }} + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus(sls_path ~ '-browser') }} diff --git a/salt/sys-syncthing/appmenus.top b/salt/sys-syncthing/appmenus.top new file mode 100644 index 0000000..42faf7d --- /dev/null +++ b/salt/sys-syncthing/appmenus.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-syncthing.appmenus diff --git a/salt/sys-syncthing/cancel.sls b/salt/sys-syncthing/cancel.sls new file mode 100644 index 0000000..9605e38 --- /dev/null +++ b/salt/sys-syncthing/cancel.sls @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2022 unman + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +"{{ slsdotpath }}-remove-service-from-rc.local": + file.replace: + - name: /rw/config/rc.local + - pattern: 'systemctl.*unmask.*syncthing@user.service' + - repl: '' + - backup: False diff --git a/salt/sys-syncthing/cancel.top b/salt/sys-syncthing/cancel.top new file mode 100644 index 0000000..4aaf91c --- /dev/null +++ b/salt/sys-syncthing/cancel.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-syncthing': + - sys-syncthing.configure diff --git a/salt/sys-syncthing/clean.sls b/salt/sys-syncthing/clean.sls new file mode 100644 index 0000000..ac5b631 --- /dev/null +++ b/salt/sys-syncthing/clean.sls @@ -0,0 +1,15 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +"{{ slsdotpath }}-shutdown": + qvm.shutdown: + - name: {{ slsdotpath }} + - flags: + - force + +{% from 'utils/macros/policy.sls' import policy_unset with context -%} +{{ policy_unset(sls_path, '80') }} diff --git a/salt/sys-syncthing/clone.sls b/salt/sys-syncthing/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-syncthing/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-syncthing/clone.top b/salt/sys-syncthing/clone.top new file mode 100644 index 0000000..d32c025 --- /dev/null +++ b/salt/sys-syncthing/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-syncthing.clone diff --git a/salt/sys-syncthing/configure-browser.sls b/salt/sys-syncthing/configure-browser.sls new file mode 100644 index 0000000..9ff3cb9 --- /dev/null +++ b/salt/sys-syncthing/configure-browser.sls @@ -0,0 +1,23 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' %} + +"{{ slsdotpath }}-browser-rc.local": + file.append: + - name: /rw/config/rc.local + - text: "qvm-connect-tcp 8384:@default:8384" + +"{{ slsdotpath }}-browser-desktop-application": + file.managed: + - name: /home/user/.local/share/applications/syncthing-browser.desktop + - source: salt://{{ slsdotpath }}/files/browser/syncthing-browser.desktop + - mode: '0644' + - user: user + - group: user + - makedirs: True + +{% endif -%} diff --git a/salt/sys-syncthing/configure-browser.top b/salt/sys-syncthing/configure-browser.top new file mode 100644 index 0000000..48d60a5 --- /dev/null +++ b/salt/sys-syncthing/configure-browser.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-syncthing-browser': + - sys-syncthing.configure-browser diff --git a/salt/sys-syncthing/configure.sls b/salt/sys-syncthing/configure.sls new file mode 100644 index 0000000..84f3092 --- /dev/null +++ b/salt/sys-syncthing/configure.sls @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +"{{ slsdotpath }}-append-to-rc.local": + file.append: + - name: /rw/config/rc.local + - text: | + systemctl unmask syncthing@user.service + systemctl --no-block restart syncthing@user.service diff --git a/salt/sys-syncthing/configure.top b/salt/sys-syncthing/configure.top new file mode 100644 index 0000000..4aaf91c --- /dev/null +++ b/salt/sys-syncthing/configure.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-syncthing': + - sys-syncthing.configure diff --git a/salt/sys-syncthing/create.sls b/salt/sys-syncthing/create.sls new file mode 100644 index 0000000..417ac43 --- /dev/null +++ b/salt/sys-syncthing/create.sls @@ -0,0 +1,99 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + - browser.create + +{% load_yaml as defaults -%} +name: tpl-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +prefs: +- vcpus: 1 +- memory: 300 +- maxmem: 700 +- autostart: False +- include_in_backups: False +features: +- disable: + - service.cups + - service.cups-browsed + - service.tracker + - service.evolution-data-server +- set: + - menu-items: "syncthing-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" + - default-menu-items: "syncthing-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: yellow +prefs: +- template: tpl-{{ slsdotpath }} +- label: yellow +- vcpus: 1 +- memory: 300 +- maxmem: 700 +- autostart: False +- include_in_backups: True +features: +- enable: + - servicevm +- disable: + - service.cups + - service.cups-browsed +- set: + - menu-items: "syncthing-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }}-browser +force: true +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-browser +- label: yellow +prefs: +- template: tpl-browser +- label: yellow +- vcpus: 1 +- netvm: "" +- memory: 300 +- maxmem: 600 +- autostart: False +- include_in_backups: False +features: +- disable: + - service.cups + - service.cups-browsed + - service.tracker + - service.evolution-data-server +- set: + - menu-items: "syncthing-browser.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +"{{ slsdotpath }}-resize-private-volume": + cmd.run: + - require: + - qvm: {{ slsdotpath }} + - name: qvm-volume extend {{ slsdotpath }}:private 50Gi + +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} diff --git a/salt/sys-syncthing/create.top b/salt/sys-syncthing/create.top new file mode 100644 index 0000000..6d4cef9 --- /dev/null +++ b/salt/sys-syncthing/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-syncthing.create diff --git a/salt/sys-syncthing/files/admin/firewall/in.sh b/salt/sys-syncthing/files/admin/firewall/in.sh new file mode 100644 index 0000000..ae885a5 --- /dev/null +++ b/salt/sys-syncthing/files/admin/firewall/in.sh @@ -0,0 +1,311 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: 2022 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Credits: https://github.com/unman/shaker/blob/main/i2p/in.sh +## Recursively open ports through the firewall to allow remote access to a qube. + +## TODO: remove iptables in favor of nft. It doesn't work if the upstream net +## qubes are disposables, instead, the rule should be applied on the +## disposable template. This would work well if users used our project that +## creates a template per service, but if user is using a default diposable +## template for that, such as debian-XX-dvm, the firewall would allow many +## qubes to be exposed. + +me="${0##*/}" + +usage(){ +cat </dev/null)" + if test -z "$found"; then + qvm-run -q -u root "${my_netvms[$i]}" -- "iptables -I QBS-FORWARD -i $iface -p $proto --dport $portnum_target -d ${my_ips[$i-1]} -j ACCEPT" + qvm-run -q -u root "${my_netvms[$i]}" -- "iptables -t nat -I PR-QBS-SERVICES -i $iface -p $proto --dport $portnum_used -j DNAT --to-destination ${my_ips[$i-1]}:$portnum_target" + if test "$permanent" = "1"; then + qvm-run -q -u root "${my_netvms[$i]}" -- "echo iptables -I QBS-FORWARD -i $iface -p $proto --dport $portnum_target -d ${my_ips[$i-1]} -j ACCEPT >> /rw/config/rc.local" + qvm-run -q -u root "${my_netvms[$i]}" -- "echo iptables -t nat -I PR-QBS-SERVICES -i $iface -p $proto --dport $portnum_used -j DNAT --to-destination ${my_ips[$i-1]}:$portnum_target >> /rw/config/rc.local" + fi + else + qvm-run -q -u root "${my_netvms[$i]}" -- nft insert rule nat PR-QBS-SERVICES meta iifname "$iface" "$proto" dport "$portnum_used" dnat to "${my_ips[$i-1]}:$portnum_target" + qvm-run -q -u root "${my_netvms[$i]}" -- nft insert rule filter QBS-FORWARD meta iifname "$iface" ip daddr "${my_ips[$i-1]}" "$proto" dport "$portnum_target" ct state new accept + if test "$permanent" = "1"; then + qvm-run -q -u root "${my_netvms[$i]}" -- "echo nft insert rule nat PR-QBS-SERVICES meta iifname $iface $proto dport $portnum_used dnat to ${my_ips[$i-1]}:$portnum_target >> /rw/config/rc.local" + qvm-run -q -u root "${my_netvms[$i]}" -- "echo nft insert rule filter QBS-FORWARD meta iifname $iface ip daddr ${my_ips[$i-1]} $proto dport $portnum_target ct state new accept >> /rw/config/rc.local" + fi + fi + ((i++)) + done +} + + +## Teardown from top netvm down +teardown(){ + declare -a my_netvms=("${!1}") + declare -a my_ips=("${!2}") + declare -i numhops + numhops=${#my_ips[@]} + numhops=$((numhops-1)) + local i=$numhops + iface="eth0" + echo "Removing firewall rules" + while [ $i -gt 0 ]; do + if [ $i -eq 1 ]; then + portnum_used=$external_portnum + portnum_target=$portnum + else + portnum_used=$external_portnum + portnum_target=$external_portnum + fi + # Is it nft or iptables? + echo "${my_netvms[$i]}" + local found + found="$( qvm-run -p -q -u root "${my_netvms[$i]}" -- "nft list table nat 2>/dev/null" )" + if test -z "$found"; then + qvm-run -q -u root "${my_netvms[$i]}" -- "iptables -D QBS-FORWARD -i $iface -p $proto --dport $portnum_target -d ${my_ips[$i-1]} -j ACCEPT" + qvm-run -q -u root "${my_netvms[$i]}" -- "iptables -t nat -D PR-QBS-SERVICES -i $iface -p $proto --dport $external_portnum -j DNAT --to-destination ${my_ips[$i-1]}:$portnum_target" + if [ "$permanent" -eq 1 ]; then + qvm-run -q -u root "${my_netvms[$i]}" -- "sed -i '/iptables -D QBS-FORWARD -i $iface -p $proto --dport $portnum_target -d ${my_ips[$i-1]} -j ACCEPT/d' /rw/config/rc.local" + qvm-run -q -u root "${my_netvms[$i]}" -- "sed -i '/iptables -t nat -D PR-QBS-SERVICES -i $iface -p $proto --dport $external_portnum -j DNAT --to-destination ${my_ips[$i-1]}:$portnum_target/d' /rw/config/rc.local" + fi + else + local handle + handle="$( get_handle "${my_netvms[$i]}" nat "dport $external_portnum " 1 )" + qvm-run -q -u root "${my_netvms[$i]}" -- "nft delete rule nat PR-QBS-SERVICES handle $handle" + local handle + handle="$( get_handle "${my_netvms[$i]}" filter "dport $external_portnum " 1 )" + qvm-run -q -u root "${my_netvms[$i]}" -- "nft delete rule filter QBS-FORWARD handle $handle" + if [ "$permanent" -eq 1 ]; then + qvm-run -q -u root "${my_netvms[$i]}" -- "sed -i '/nft insert rule nat PR-QBS-SERVICES meta iifname $iface $proto dport $portnum_used dnat to ${my_ips[$i-1]}:$portnum_target/d' /rw/config/rc.local" + qvm-run -q -u root "${my_netvms[$i]}" -- "sed -i '/nft insert rule filter QBS-FORWARD meta iifname $iface ip daddr ${my_ips[$i-1]} $proto dport $portnum_target ct state new accept/d' /rw/config/rc.local" + fi + fi + ((i--)) + done + local found + found="$( qvm-run -p -q -u root "${my_netvms[$i]}" -- nft list table nat 2>/dev/null )" + if test -z "$found"; then + qvm-run -q -u root "${my_netvms[$i]}" " iptables -D INPUT -p $proto --dport $external_portnum -j ACCEPT" + else + handle=$( get_handle "${my_netvms[$i]}" filter "dport $portnum " 1 ) + qvm-run -q -u root "${my_netvms[$i]}" -- nft delete rule filter INPUT handle "$handle" + fi + exit +} + + +list(){ + return +} + + +## Defaults +auto=0 +permanent=0 + +## Get options +optstring=":hap" +while getopts ${optstring} option ; do + case $option in + h) usage;; + a) auto=1;; + p) permanent=1;; + ?) usage;; + esac +done +shift $((OPTIND -1)) + +## Check inputs +test "$#" -lt 4 && usage +if ! qvm-check -q "$2" 2>/dev/null; then + echo "$2 is not the name of any qube" + exit 1 +fi +qube_name="$2" +if test "$3" != "tcp" && test "$3" != "udp"; then + echo "Specify tcp or udp" + exit +fi +proto="$3" +portnum="$(check_port "$3" "$4")" + +if [ $# -eq 5 ]; then + external_portnum="$(check_port "$3" "$5")" +else + external_portnum=$portnum +fi + +## Get all netvms +declare -a netvms +declare -a ips +declare -a external_ips +hop=0 +# shellcheck disable=SC2004 +netvms[${hop}]="$qube_name" +IFS='|' read -r netvms[$hop+1] ips[$hop] <<< "$(qvm-ls "$qube_name" --raw-data -O netvm,IP)" +while [ "${netvms[hop+1]}" != "-" ] +do + ((hop++)) + IFS='|' read -r netvms[$hop+1] ips[$hop] <<< "$(qvm-ls "${netvms[$hop]}" --raw-data -O netvm,IP)" +done + +if test "$1" = "delete"; then + teardown netvms[@] ips[@] +elif test "$1" = "add"; then + if [ "$hop" -eq 0 ]; then + echo "$qube_name is not network connected" + echo "Cannot set up a tunnel" + exit + fi + + # Check last hop has external IP address + readarray -t external_ips < <( qvm-run -p "${netvms[$hop]}" "ip -4 -o a|grep -wv 'lo\|vif[0-9]*.*'"|awk '{print $2,$4}') + #readarray -t external_ips < <( qvm-run -p ${netvms[$hop]} "ip -4 -o a|grep -wv 'vif[0-9]'"|awk '{print $2,$4}') + num_ifs=${#external_ips[@]} + if [ "$num_ifs" -eq 1 ]; then + interface=0 + elif [ $auto -eq 1 ]; then + interface=0 + elif [ "$num_ifs" -gt 1 ]; then + echo "${netvms[$hop]} has more than 1 external interface" + echo "Which one do you want to use?" + for i in $(seq "$num_ifs"); do + echo "$i. ${external_ips[$i-1]}" + done + read -r interface + if ! [ "$interface" -eq "$interface" ] 2> /dev/null; then + echo "No such interface" + exit + elif [ "$interface" -gt "$num_ifs" ] || [ "$interface" -lt 1 ]; then + echo "No such interface" + exit + fi + ((interface--)) + else + echo "${netvms[$hop]} does not have an external interface" + echo "Cannot set up a tunnel" + exit + fi + external_ip="${external_ips[$interface]}" + external_iface="${external_ip%[[:space:]]*}" + ip="${external_ip#*[0-9]}" + ip="${ip%%/*}" + # shellcheck disable=SC2004,SC2034 + ips[$hop]="$ip" + + # Create tunnel + found="$(qvm-run -p -q -u root "$qube_name" -- nft list table nat 2>/dev/null)" + if test -z "$found"; then + found=$(qvm-run -p -u root "$qube_name" "iptables -L -nv | grep -c '.*ACCEPT.*$proto dpt:$portnum' ") + if [ "$found" -gt 0 ]; then + echo "Input rule in $qube_name already exists" + echo "Please check configuration - exiting now." + exit + else + qvm-run -q -u root "$qube_name" "iptables -I INPUT -p $proto --dport $portnum -j ACCEPT " + fi + else + if qvm-run -q -u root "$qube_name" "nft list table filter | grep '$proto dport $portnum accept' " + then + echo "Input rule in $qube_name already exists" + echo "Please check configuration - exiting now." + exit + else + handle="$(get_handle "$qube_name" filter related,established 1)" + qvm-run -q -u root "$qube_name" -- nft add rule filter INPUT position "$handle" iifname eth0 "$proto" dport "$portnum" accept + fi + fi + if ! tunnel netvms[@] ips[@]; then + teardown netvms[@] ips[@] + fi +else + usage +fi diff --git a/salt/sys-syncthing/files/admin/policy/default.policy b/salt/sys-syncthing/files/admin/policy/default.policy new file mode 100644 index 0000000..74f7f7a --- /dev/null +++ b/salt/sys-syncthing/files/admin/policy/default.policy @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qubes.OpenURL * {{ sls_path }} @default allow target={{ sls_path }}-browser +qubes.OpenURL * {{ sls_path }} @anyvm deny +qubes.ConnectTCP +8384 {{ sls_path }}-browser @default allow target={{ sls_path }} +qubes.ConnectTCP * {{ sls_path }}-browser @anyvm deny +qusal.Syncthing * @anyvm @default ask target={{ sls_path }} default_target={{ sls_path }} +qusal.Syncthing * @anyvm @anyvm deny +## vim:ft=qrexecpolicy diff --git a/salt/sys-syncthing/files/browser/syncthing-browser.desktop b/salt/sys-syncthing/files/browser/syncthing-browser.desktop new file mode 100644 index 0000000..51789b4 --- /dev/null +++ b/salt/sys-syncthing/files/browser/syncthing-browser.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Syncthing Browser +Exec=xdg-open http://127.0.0.1:8384 +Icon=web-browser +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=synchronization;interface; +Categories=Network;WebBrowser;FileTransfer;P2P; diff --git a/salt/sys-syncthing/files/client/systemd/qubes-syncthing-forwarder.service b/salt/sys-syncthing/files/client/systemd/qubes-syncthing-forwarder.service new file mode 100644 index 0000000..a62db4d --- /dev/null +++ b/salt/sys-syncthing/files/client/systemd/qubes-syncthing-forwarder.service @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: 2022 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Unit] +Description=Syncthing over Qrexec +After=qubes-qrexec-agent.service +ConditionPathExists=/var/run/qubes-service/syncthing-setup + +[Service] +ExecStart=/usr/bin/socat TCP4-LISTEN:22001,reuseaddr,fork,end-close EXEC:"qrexec-client-vm @default qusal.Syncthing" +Restart=on-failure +RestartSec=3 + +# Hardening +ProtectSystem=full +PrivateTmp=true +SystemCallArchitectures=native +MemoryDenyWriteExecute=true +NoNewPrivileges=true + +[Install] +WantedBy=multi-user.target diff --git a/salt/sys-syncthing/files/repo/syncthing.asc b/salt/sys-syncthing/files/repo/syncthing.asc new file mode 100644 index 0000000..389ae1d --- /dev/null +++ b/salt/sys-syncthing/files/repo/syncthing.asc @@ -0,0 +1,41 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBFShFd8BCADHQq9byO6uehb51iieKKi2KEwudhkbV74r8ZsGp0Q3asmv6cPl +EFLKXCs9vm9f0Qn58up44ikd/782Gu7CQoFBM/DGj1SGXpWRj7fd6nnErA5JUiUz +hpYN/Py0XWSApZE0xXUhBnd1UM1ymnWjGxu6HYb2ZIayr3jisZmUOVIwHJToqjIK +grjt9afTlvDOfBN5GBeLYetByvza3JGt9kwn9z1ryhssyVHur+uXvJq7CuXJzImU +E4QW9fwjeOHFFBQevYMVHhnlVgXGQ/fNmYW+MeXG4GE8viyRuv0asRwMjp+1zpP1 +EvAM/Z8Y9Udv1DvSTjonET3G9fOyNfU3HNcvABEBAAG0NFN5bmN0aGluZyBSZWxl +YXNlIE1hbmFnZW1lbnQgPHJlbGVhc2VAc3luY3RoaW5nLm5ldD6JATgEEwECACIF +AlShFd8CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJENJubtAAZUo+XrsI +AKk9Usgg6R/6/tfohdTjV9gpeMn+BpvP5boTAEWdTDF0azg06aAt0engrVkbwG70 +Nf9KKbDcSDZUJs1kZVq1TJvo3JnR+Dw0a9AcEvY+zDRcGuHmIjdei5QtaMsVB+8b +zR0muX1YRw0MhncHg4bvEzWdrWRHZr71trVKTm2v/xW2Bd1KJmzUv/D2DjML3NL7 +SkbZMHmqTWE9jNoSajlxdIsZRM0QbzREEkC95/INaZvK1n8jY1fobY5qAx2knzp6 +SLx8TamN8RcACAhkV43NnFCdb3hhE6W22xK7BFwDSvoUvm+xi9NJWLg6UWPVSAPt +6Eb/RdtUlXx05awR6HzN/dSJAjMEEAEIAB0WIQSdzCmoMS9cDyYl525J9a7AvOUk +xwUCYUbY6gAKCRBJ9a7AvOUkxykFD/4uGgNwdQ2Blh2FCS6dhMVYW//hmY4q5HvL +dMFbGSXKIGj2b4I2II0cFxwyNLpamu66sfvplqTQCnbeCjW/u6DNtQxkE0/0XlO3 +T/A6mxuU4Coa85KpeHHq1tLYPxC1NgNz2SUcBNFxQJqS38BYwRAfMi+7PHmm4v62 +4NTVS4lDMES5oimm6L41lDwjdn0P+CCcRd9sJWzutfpEtoTdY89WgDqc32BCc62r +4K8SyJNq5FPAqptNr0HaS2HTC5AP7OW+V6/QnjOaLaVpNCvYfi0qZ+2dK1/R9Zu5 +q31fd0RLcVHaIzMvW/rpK52RYqeID9hAY9fkRdzhCnX6+plWO107HbBVmVtqiYZP +1xNZSAgju5ZzIkK/oweor7v1UUbBYGd1+R7issSv8qyYEZlyiRzZtE/OcLoQQnHc +wTE882uBWRSExheN9e2uUF681T715CuZTlH5dBqlit2MRe72vFzZ8jHWIZkVp7a3 +AUJzFtNlWmN2tfCskQiOUClbNmI9ThwSOVPZkWCCWG6I1utce0MmKrZKgbxtc1wg +Ztrbs6vJfH3fsvCvqt7In2oeyv4eyzDla0gV0HBEVNle7f1aSSVAwq9NPjL85Zy2 +yKYw5vf6kGdzx2j1sqBuJeEyB87EX5autx9VKT4KZj89ffWgtJtGPV+24PJ62OQ2 +1CTe26PfO7kBDQRUoRXfAQgAsygA37oLmGCLvQgIWXrRicfH8LwKR5bv4pWiiD+J +cstNfyjolg4MsGfSRbw7GtEsJs0o16+UlhHVzONymZ076Ty/Jc63SqP3mRqT6euP +OXEn9gmHZ/kkCCqSSTBkFziqvNxzwSRj+sf1n8mi86LnmDR/xfa5AtGpA+rlrjUm +Cj3gfcqMzjZ2GQ3BIoG5x6xMufcE51CARGPOrLg0IXTpHcZoYz023Z9De7CYCzLE +FT1i0ezLErTMtIpAPv2h7d7xLgNVnvHcqHF0/u4TKk2mxHzohL2/hjdQaEttuYvZ +VBI6Svlsrq2j88fN8yj5astOhHntOXvDhm1XRr64kDKEBQARAQABiQEfBBgBAgAJ +BQJUoRXfAhsMAAoJENJubtAAZUo+VIcIAL+h+XO8m9MpjkmVgAjr3gWq3OqDhnfr +KZSrjcbaOoj78dhxEz4uePnb6vCljoJBTiyGWL9zBUlEvOQL7ykHp3MipfV4qoPZ +FiYQMt6LGJtj1PCc84q0zK1bp1NEjFrv4fq076f721PklYioqg/iRYVQEcpPtEEj +e5sXHBobBXUgaki2+6Q5rhdsMBZHdhpMv59s2Ed6DBp7/fFf5Pj4iTjRScW2smIe +Ru7dGYTM7fyfnElj6Eb+UdCuwStABRqQQSbm+rD+95WXcvzxWc5YeEPcbG8++243 +9FPGbCGVD2u178bpT9HQcNgWqscMCewuUdEA/xTw7OTeWXjlJHXZl/Y= +=ziMt +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/sys-syncthing/files/repo/syncthing.list b/salt/sys-syncthing/files/repo/syncthing.list new file mode 100644 index 0000000..b0e5a70 --- /dev/null +++ b/salt/sys-syncthing/files/repo/syncthing.list @@ -0,0 +1,2 @@ +deb [signed-by=/usr/share/keyrings/syncthing.asc] http://apt.syncthing.net/ syncthing stable +# vim:ft=debsources diff --git a/salt/sys-syncthing/files/repo/syncthing.sources b/salt/sys-syncthing/files/repo/syncthing.sources new file mode 100644 index 0000000..a389c42 --- /dev/null +++ b/salt/sys-syncthing/files/repo/syncthing.sources @@ -0,0 +1,7 @@ +## NOTE: Syncthing maintainers inverted the Suites with the Components field. +Types: deb +URIs: http://apt.syncthing.net/ +Suites: syncthing +Components: stable +Signed-by: /usr/share/keyrings/syncthing.asc +# vim:ft=debsources diff --git a/salt/sys-syncthing/files/server/mimeapps.list b/salt/sys-syncthing/files/server/mimeapps.list new file mode 100644 index 0000000..9859559 --- /dev/null +++ b/salt/sys-syncthing/files/server/mimeapps.list @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2023 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Default Applications] +x-scheme-handler/http=syncthing-browser-general.desktop +x-scheme-handler/https=syncthing-browser-general.desktop diff --git a/salt/sys-syncthing/files/server/rpc/qusal.Syncthing b/salt/sys-syncthing/files/server/rpc/qusal.Syncthing new file mode 100644 index 0000000..46fda96 --- /dev/null +++ b/salt/sys-syncthing/files/server/rpc/qusal.Syncthing @@ -0,0 +1,7 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2022 unman +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +exec socat STDIO TCP:localhost:22000 diff --git a/salt/sys-syncthing/files/server/syncthing-browser-general.desktop b/salt/sys-syncthing/files/server/syncthing-browser-general.desktop new file mode 100644 index 0000000..ae59dd4 --- /dev/null +++ b/salt/sys-syncthing/files/server/syncthing-browser-general.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Syncthing Browser URL Forwarder +Exec=qvm-open-in-vm -- @default %u +Icon=web-browser +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=synchronization;interface; +Categories=Network;WebBrowser;FileTransfer;P2P; diff --git a/salt/sys-syncthing/files/server/syncthing-browser.desktop b/salt/sys-syncthing/files/server/syncthing-browser.desktop new file mode 100644 index 0000000..c55f861 --- /dev/null +++ b/salt/sys-syncthing/files/server/syncthing-browser.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Syncthing Browser +Exec=qvm-open-in-vm -- @default http://127.0.0.1:8384 +Icon=web-browser +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=synchronization;interface; +Categories=Network;WebBrowser;FileTransfer;P2P; diff --git a/salt/sys-syncthing/init.top b/salt/sys-syncthing/init.top new file mode 100644 index 0000000..9f4b722 --- /dev/null +++ b/salt/sys-syncthing/init.top @@ -0,0 +1,16 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-syncthing.create + 'tpl-sys-syncthing': + - sys-syncthing.install + 'sys-syncthing': + - sys-syncthing.configure + 'sys-syncthing-browser': + - sys-syncthing.configure-browser diff --git a/salt/sys-syncthing/install-client.sls b/salt/sys-syncthing/install-client.sls new file mode 100644 index 0000000..d6b5d6b --- /dev/null +++ b/salt/sys-syncthing/install-client.sls @@ -0,0 +1,51 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - socat + - syncthing + +{% set pkg = { + 'Debian': { + 'pkg': ['libpam-systemd'], + }, + 'RedHat': { + 'pkg': ['systemd-pam'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-installed-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +"{{ slsdotpath }}-set-systemd-qubes-syncthing-forwarder.service": + file.managed: + - name: /usr/lib/systemd/system/qubes-syncthing-forwarder.service + - source: salt://{{ slsdotpath }}/files/client/systemd/qubes-syncthing-forwarder.service + - user: root + - group: root + - mode: '0755' + - makedirs: True + +"{{ slsdotpath }}-enable-qubes-syncthing": + service.enabled: + - name: qubes-syncthing.service + +{% endif -%} diff --git a/salt/sys-syncthing/install-client.top b/salt/sys-syncthing/install-client.top new file mode 100644 index 0000000..99e6881 --- /dev/null +++ b/salt/sys-syncthing/install-client.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - sys-syncthing.install-client diff --git a/salt/sys-syncthing/install.sls b/salt/sys-syncthing/install.sls new file mode 100644 index 0000000..5d69643 --- /dev/null +++ b/salt/sys-syncthing/install.sls @@ -0,0 +1,71 @@ +{# +SPDX-FileCopyrightText: 2022 - 2023 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +{% from 'utils/macros/install-repo.sls' import install_repo -%} +{{ install_repo(sls_path, 'syncthing') }} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - syncthing + - jq + - socat + - qubes-core-agent-thunar + - thunar + +"{{ slsdotpath }}-rpc-service": + file.managed: + - name: /etc/qubes-rpc/qusal.Syncthing + - source: salt://{{ slsdotpath }}/files/server/rpc/qusal.Syncthing + - user: root + - group: root + - mode: '0755' + - makedirs: True + +"{{ slsdotpath }}-mask-syncthing": + service.masked: + - name: syncthing@user.service + - runtime: False + +"{{ slsdotpath }}-desktop-application-browser": + file.managed: + - name: /usr/share/applications/syncthing-browser.desktop + - source: salt://{{ slsdotpath }}/files/server/syncthing-browser.desktop + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-desktop-application-open-general": + file.managed: + - name: /usr/share/applications/syncthing-browser-general.desktop + - source: salt://{{ slsdotpath }}/files/server/syncthing-browser-general.desktop + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ slsdotpath }}-etc-mimeapps.list": + file.managed: + - name: /etc/xdg/mimeapps.list + - source: salt://{{ slsdotpath }}/files/server/mimeapps.list + - mode: '0644' + - user: root + - group: root + - makedirs: True + +{% endif -%} diff --git a/salt/sys-syncthing/install.top b/salt/sys-syncthing/install.top new file mode 100644 index 0000000..ad368be --- /dev/null +++ b/salt/sys-syncthing/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-syncthing': + - sys-syncthing.install diff --git a/salt/sys-usb/README.md b/salt/sys-usb/README.md new file mode 100644 index 0000000..a2ae120 --- /dev/null +++ b/salt/sys-usb/README.md @@ -0,0 +1,60 @@ +# sys-usb + +PCI handler of USB devices in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) +* [Credits](#credits) + +## Description + +Setup named disposables for USB qubes. During creation, it tries to separate +the USB controllers to different qubes is possible. + +## Installation + +- Top: +```sh +qubesctl top.enable sys-usb +qubesctl --targets=tpl-sys-usb state.apply +qubesctl top.disable sys-usb +``` + +- State: + +```sh +qubesctl state.apply sys-usb.create +qubesctl --skip-dom0 --targets=tpl-sys-usb state.apply sys-usb.install +``` + + +If you use an USB keyboard, also run: +```sh +qubesctl state.apply sys-usb.keyboard +``` + +Install the proxy on the client template: +```sh +qubesctl --skip-dom0 --targets=tpl-QUBE state.apply sys-usb.install-client-proxy +``` +If the client requires decrypting a device, install on the client template: +```sh +qubesctl --skip-dom0 --targets=tpl-QUBE state.apply sys-usb.install-client-cryptsetup +``` +If the client requires a FIDO device, install on the client template: +```sh +qubesctl --skip-dom0 --targets=tpl-QUBE state.apply sys-usb.install-client-fido +``` + +## Usage + +Start a USB qube an connect a device to it. USB PCI devices will appear on +the system tray icon `qui-devices`. From there, assign it to the intended +qube. + +## Credits + +- [Unman](https://github.com/unman/shaker/blob/main/sys-usb) diff --git a/salt/sys-usb/clone.sls b/salt/sys-usb/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-usb/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-usb/clone.top b/salt/sys-usb/clone.top new file mode 100644 index 0000000..7ca2d68 --- /dev/null +++ b/salt/sys-usb/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-usb.clone diff --git a/salt/sys-usb/create.sls b/salt/sys-usb/create.sls new file mode 100644 index 0000000..1d4263a --- /dev/null +++ b/salt/sys-usb/create.sls @@ -0,0 +1,145 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{# +"{{ slsdotpath }}-updated-dom0": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-install-dom0-package": + pkg.installed: + - pkgs: + - qubes-ctap-dom0 +#} + +"{{ slsdotpath }}-absent": + qvm.absent: + - names: + - {{ slsdotpath }} + - sys-usb-dock + - sys-usb-left + - dvm-{{ slsdotpath }} + +{% 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: 400 +- maxmem: 0 +- vcpus: 1 +- virt_mode: hvm +- template_for_dispvms: True +- include_in_backups: False +features: +- enable: + - servicevm + - appmenus-dispvm +- disable: + - service.network-manager + - service.cups + - service.cups-browsed + - service.meminfo-writer + - service.qubes-updates-proxy +{%- endload %} +{{ load(defaults) }} + +{% set usb_pcidevs = salt['grains.get']('pci_usb_devs', []) -%} +{% if usb_pcidevs == ['00:14.0', '00:1a.0', '00:1d.0'] -%} + {% set usb_host_model = 'ThinkPad T430' -%} + {% set usbs = ['sys-usb', 'sys-usb-dock', 'sys-usb-left'] -%} +{% else -%} + {% set usb_host_model = 'unknown' -%} + {% set usbs = ['sys-usb'] -%} +{% endif -%} + +{# +TODO: salt jinja best practice +Map different usb controlles to different usb qubes. +Problems: +- Random name generator for qubes would be troublesome for the user + to guess to which qube his usb controller is. Only mapped brands and + models will work. +Questions: +- How to use jinja array to assign a qube per controller? +- How to assign UNCATEGORIZED to unregistered products? +#} +{# +{% set usb_pcidevs = { + 'ThinkPad T430': { + 'qubes': ['sys-usb', 'sys-usb-dock', 'sys-usb-left'], + 'pcidevs': ['00:14.0', '00:1a.0', '00:1d.0'], + 'autostart': False, + }, + 'UNCATEGORIZED': { + 'qubes': ['sys-usb'], + 'pcidevs': {{ usb_pcidevs }}, + 'autostart': True, + }, +}.get(salt['smbios.get']('system-version') -%} + +{% for usb in usb_pcidevs.qubes -%} +pcidevs: {{ usb_pcidevs.pcidevs|sequence|yaml }} +autostart: {{ usb_pcidevs.autostart|sequence|yaml }} +{% endfor -%} +#} + +{% for usb in usbs -%} +{% load_yaml as defaults -%} +name: {{ usb }} +force: True +require: +- qvm: dvm-{{ slsdotpath }} +present: +- template: dvm-{{ slsdotpath }} +- label: red +- class: DispVM +prefs: +- template: dvm-{{ slsdotpath }} +- label: red +- netvm: "" +- memory: 400 +- maxmem: 0 +- include_in_backups: False +- pci_strictreset: False +{% if usb_host_model == 'ThinkPad T430' -%} +- autostart: False +{% if usb == 'sys-usb-left' -%} +- pcidevs: {{ [usb_pcidevs[0]]|yaml }} +{% elif usb == 'sys-usb' -%} +- pcidevs: {{ [usb_pcidevs[1]]|yaml }} +{% elif usb == 'sys-usb-dock' -%} +- pcidevs: {{ [usb_pcidevs[2]]|yaml }} +{% endif -%} +{% else -%} +- autostart: True +- pcidevs: {{ usb_pcidevs|yaml }} +{% endif -%} +features: +- enable: + - servicevm +- disable: + - service.network-manager + - service.cups + - service.cups-browsed + - service.meminfo-writer + - service.qubes-updates-proxy +{%- endload %} +{{ load(defaults) }} +{% endfor -%} diff --git a/salt/sys-usb/create.top b/salt/sys-usb/create.top new file mode 100644 index 0000000..772e033 --- /dev/null +++ b/salt/sys-usb/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-usb.create diff --git a/salt/sys-usb/files/admin/policy/default.policy b/salt/sys-usb/files/admin/policy/default.policy new file mode 100644 index 0000000..4b792dc --- /dev/null +++ b/salt/sys-usb/files/admin/policy/default.policy @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +## Do not modify this file, create a new policy with with a lower number in the +## file name instead. For example `30-user.policy`. +qubes.InputKeyboard * {{ sls_path }} dom0 allow user=root +qubes.InputKeyboard * {{ sls_path }} @anyvm deny + +ctap.ClientPin * @anyvm {{ sls_path }} ask user=root target={{ sls_path }} default_target={{ sls_path }} +ctap.GetInfo * @anyvm {{ sls_path }} ask user=root target={{ sls_path }} default_target={{ sls_path }} +u2f.Authenticate * @anyvm {{ sls_path }} ask user=root target={{ sls_path }} default_target={{ sls_path }} +u2f.Register * @anyvm {{ sls_path }} ask user=root target={{ sls_path }} default_target={{ sls_path }} + +ctap.ClientPin * @anyvm @default ask user=root target={{ sls_path }} default_target={{ sls_path }} +ctap.GetInfo * @anyvm @default ask user=root target={{ sls_path }} default_target={{ sls_path }} +u2f.Authenticate * @anyvm @default ask user=root target={{ sls_path }} default_target={{ sls_path }} +u2f.Register * @anyvm @default ask user=root target={{ sls_path }} default_target={{ sls_path }} + +ctap.GetInfo * @anyvm @anyvm deny +ctap.ClientPin * @anyvm @anyvm deny +u2f.Authenticate * @anyvm @anyvm deny +u2f.Register * @anyvm @anyvm deny +# vim:ft=qrexecpolicy diff --git a/salt/sys-usb/init.top b/salt/sys-usb/init.top new file mode 100644 index 0000000..a21789c --- /dev/null +++ b/salt/sys-usb/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-usb.create + 'tpl-sys-usb': + - sys-usb.install diff --git a/salt/sys-usb/install-client-cryptsetup.sls b/salt/sys-usb/install-client-cryptsetup.sls new file mode 100644 index 0000000..5d8645d --- /dev/null +++ b/salt/sys-usb/install-client-cryptsetup.sls @@ -0,0 +1,24 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-client-proxy + +"{{ slsdotpath }}-updated-cryptsetup": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-cryptsetup": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - cryptsetup + +{% endif -%} diff --git a/salt/sys-usb/install-client-cryptsetup.top b/salt/sys-usb/install-client-cryptsetup.top new file mode 100644 index 0000000..a3fd8b6 --- /dev/null +++ b/salt/sys-usb/install-client-cryptsetup.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - sys-usb.install-client-cryptsetup diff --git a/salt/sys-usb/install-client-fido.sls b/salt/sys-usb/install-client-fido.sls new file mode 100644 index 0000000..123888a --- /dev/null +++ b/salt/sys-usb/install-client-fido.sls @@ -0,0 +1,25 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-client-proxy + +"{{ slsdotpath }}-updated-fido": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-fido": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-u2f + #- qubes-ctap + +{% endif -%} diff --git a/salt/sys-usb/install-client-fido.top b/salt/sys-usb/install-client-fido.top new file mode 100644 index 0000000..0bf0ac6 --- /dev/null +++ b/salt/sys-usb/install-client-fido.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - sys-usb.install-client-fido diff --git a/salt/sys-usb/install-client-proxy.sls b/salt/sys-usb/install-client-proxy.sls new file mode 100644 index 0000000..7c5ed1a --- /dev/null +++ b/salt/sys-usb/install-client-proxy.sls @@ -0,0 +1,21 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated-proxy": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-proxy": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-usb-proxy + +{% endif -%} diff --git a/salt/sys-usb/install-client-proxy.top b/salt/sys-usb/install-client-proxy.top new file mode 100644 index 0000000..11521b8 --- /dev/null +++ b/salt/sys-usb/install-client-proxy.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - sys-usb.install-client-proxy diff --git a/salt/sys-usb/install-client.sls b/salt/sys-usb/install-client.sls new file mode 100644 index 0000000..87a8d97 --- /dev/null +++ b/salt/sys-usb/install-client.sls @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install-client-cryptsetup + - .install-client-fido + +{% endif -%} diff --git a/salt/sys-usb/install-client.top b/salt/sys-usb/install-client.top new file mode 100644 index 0000000..7f7fef2 --- /dev/null +++ b/salt/sys-usb/install-client.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - sys-usb.install-client diff --git a/salt/sys-usb/install.sls b/salt/sys-usb/install.sls new file mode 100644 index 0000000..789f0d0 --- /dev/null +++ b/salt/sys-usb/install.sls @@ -0,0 +1,25 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - pciutils + - qubes-input-proxy-sender + - qubes-usb-proxy + - qubes-u2f + #- qubes-ctap + +{% endif -%} diff --git a/salt/sys-usb/install.top b/salt/sys-usb/install.top new file mode 100644 index 0000000..d4d82ac --- /dev/null +++ b/salt/sys-usb/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-usb': + - sys-usb.install diff --git a/salt/sys-usb/keyboard.sls b/salt/sys-usb/keyboard.sls new file mode 100644 index 0000000..e8b1dbe --- /dev/null +++ b/salt/sys-usb/keyboard.sls @@ -0,0 +1,62 @@ +{# +SPDX-FileCopyrightText: 2018 - 2023 Marmarek Marczykowski-Gorecki +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: GPL-3.0-or-later +#} + +# Based on 'qvm.usb-keyboard', but can't use it because it requires +# 'qvm.sys-usb', which is different from the one we create at create.sls. +# Last known update of 'qvm.usb-keyboard': 2023-08-31 + +include: + - .create + - qvm.hide-usb-from-dom0 + +"{{ slsdotpath }}-updated-dom0": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed-dom0": + pkg.installed: + - pkg: + - qubes-input-proxy + +"{{ slsdotpath }}-input-proxy-keyboard": + file.managed: + - require: + - qvm: {{ slsdotpath }} + - pkg: installed-dom0 + - name: /etc/qubes/policy.d/80-{{ slsdotpath }}.policy + - source: salt://{{ slsdotpath }}/files/policy/default.policy + - user: root + - group: qubes + - mode: '0664' + +{% set uefi_xen_cfg = '/boot/efi/EFI/qubes/xen.cfg' %} +{% if grains['boot_mode'] == 'efi' %} +{% set grub_cfg = '/boot/efi/EFI/qubes/grub.cfg' %} +{% else %} +{% set grub_cfg = '/boot/grub2/grub.cfg' %} +{% endif %} + +"{{ slsdotpath }}-unhide-usb-from-dom0-uefi": + file.replace: + - name: {{ uefi_xen_cfg }} + - pattern: ' rd.qubes.hide_all_usb' + - repl: ' usbcore.authorized_default=0' + - onlyif: test -f {{ uefi_xen_cfg }} + +"{{ slsdotpath }}-unhide-usb-from-dom0-grub": + file.replace: + - name: /etc/default/grub + - pattern: ' rd.qubes.hide_all_usb' + - repl: ' usbcore.authorized_default=0' + - onlyif: test -f /etc/default/grub + +"{{ slsdotpath }}-grub-regenerate-unhide": + cmd.run: + - name: grub2-mkconfig -o {{ grub_cfg }} + - onchanges: + - file: unhide-usb-from-dom0-grub + - onlyif: test -f {{ grub_cfg }} diff --git a/salt/sys-usb/keyboard.top b/salt/sys-usb/keyboard.top new file mode 100644 index 0000000..b8c27d7 --- /dev/null +++ b/salt/sys-usb/keyboard.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-usb.keyboard diff --git a/salt/sys-wireguard/README.md b/salt/sys-wireguard/README.md new file mode 100644 index 0000000..9d8419d --- /dev/null +++ b/salt/sys-wireguard/README.md @@ -0,0 +1,47 @@ +# sys-wireguard + +Wireguard VPN in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) +* [Credits](#credits) + +## Description + +Setup a Wireguard VPN qube named "sys-wireguard" to provide network access to +other qubes through the VPN with fail closed mechanism. + +## Installation + +- Top: +```sh +qubesctl top.enable sys-wireguard +qubesctl --targets=tpl-sys-wireguard,sys-wireguard state.apply +qubesctl top.disable sys-wireguard +``` + +- State: + +```sh +qubesctl state.apply sys-wireguard.create +qubesctl --skip-dom0 --targets=tpl-sys-wireguard state.apply sys-wireguard.install +qubesctl --skip-dom0 --targets=sys-wireguard state.apply sys-wireguard.configure +``` + + +To add the VPN configuration and configure the qubes firewall: +```sh +/srv/salt/qusal/sys-wireguard/files/admin/setup-sys-wireguard.sh +``` + +## Usage + +Use the VPN qube `sys-wireguard` to enforce incoming and outgoing connections +from clients connected to the VPN with a fail safe mechanism. + +## Credits + +- [Unman](https://github.com/unman/shaker/tree/main/mullvad) diff --git a/salt/sys-wireguard/clone.sls b/salt/sys-wireguard/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/sys-wireguard/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/sys-wireguard/clone.top b/salt/sys-wireguard/clone.top new file mode 100644 index 0000000..c740afd --- /dev/null +++ b/salt/sys-wireguard/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-wireguard.clone diff --git a/salt/sys-wireguard/configure.sls b/salt/sys-wireguard/configure.sls new file mode 100644 index 0000000..93cc610 --- /dev/null +++ b/salt/sys-wireguard/configure.sls @@ -0,0 +1,54 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +"{{ slsdotpath }}-config-vpn": + file.directory: + - name: /rw/config/vpn + - user: root + - group: root + - mode: '0755' + - makedirs: True + +"{{ slsdotpath }}-rc.local": + file.append: + - name: /rw/config/rc.local + - text: wg-quick up /rw/config/vpn/wireguard.conf + +"{{ slsdotpath }}-add-config.sh": + file.managed: + - name: /home/user/add-config.sh + - source: salt://{{ slsdotpath }}/files/server/add-config.sh + - user: user + - group: user + - mode: '0755' + - replace: True + +"{{ slsdotpath }}-qubes-firewall-user-script": + file.append: + - name: /rw/config/qubes-firewall-user-script + - text: + - nft insert rule filter FORWARD tcp flags syn tcp option maxseg size set rt mtu + - nft insert rule filter FORWARD oifname eth0 drop + - nft insert rule filter FORWARD iifname eth0 drop + +"{{ slsdotpath }}-firewall-flush": + file.managed: + - name: /rw/config/network-hooks.d/flush.sh + - source: salt://{{ slsdotpath }}/files/server/flush.sh + - user: root + - group: root + - makedirs: True + - mode: '0755' + +"{{ slsdotpath }}-set-firewall-flush-rules": + file.managed: + - name: /rw/config/network-hooks.d/flush + - source: salt://{{ slsdotpath }}/files/server/flush + - user: root + - group: root + - makedirs: True + - mode: '0755' diff --git a/salt/sys-wireguard/configure.top b/salt/sys-wireguard/configure.top new file mode 100644 index 0000000..7ecfeda --- /dev/null +++ b/salt/sys-wireguard/configure.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'sys-wireguard': + - match: nodegroup + - sys-wireguard.configure diff --git a/salt/sys-wireguard/create.sls b/salt/sys-wireguard/create.sls new file mode 100644 index 0000000..d6a43cc --- /dev/null +++ b/salt/sys-wireguard/create.sls @@ -0,0 +1,37 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: + - sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: orange +prefs: +- template: tpl-{{ slsdotpath }} +- label: orange +- provides-network: True +- vcpus: 1 +- memory: 300 +- maxmem: 400 +- autostart: False +- include_in_backups: False +features: +- enable: + - servicevm +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy +{%- endload %} +{{ load(defaults) }} diff --git a/salt/sys-wireguard/create.top b/salt/sys-wireguard/create.top new file mode 100644 index 0000000..c5a9442 --- /dev/null +++ b/salt/sys-wireguard/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-wireguard.create diff --git a/salt/sys-wireguard/files/admin/qubes-setup-sys-wireguard.desktop b/salt/sys-wireguard/files/admin/qubes-setup-sys-wireguard.desktop new file mode 100644 index 0000000..98bd5ed --- /dev/null +++ b/salt/sys-wireguard/files/admin/qubes-setup-sys-wireguard.desktop @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: 2022 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Type=Application +Exec=/usr/bin/setup-sys-wireguard +Icon=qubes-manager +Terminal=false +Name=Setup sys-wireguard +GenericName=Setup sys-wireguard +StartupNotify=false +Categories=Settings;X-XFCE-SettingsDialog diff --git a/salt/sys-wireguard/files/admin/setup-sys-wireguard b/salt/sys-wireguard/files/admin/setup-sys-wireguard new file mode 100755 index 0000000..e55cc7d --- /dev/null +++ b/salt/sys-wireguard/files/admin/setup-sys-wireguard @@ -0,0 +1,47 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2022 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +qube="sys-wireguard" + +if qvm-check -q "$qube" >/dev/null 2>&1; then + echo "Qubes doesn't exist: $qube" >&2 + exit 1 +fi + +qvm-run -p "$qube" '/home/user/set-wg-conf.sh' + +if ! qvm-run -p "$qube" 'test -f /home/user/wireguard.conf'; then + qvm-run -u root "$qube" /home/user/install-sys-wireguard + qvm-run -p "$qube" 'test -f /home/user/wireguard.conf' || exit +fi + +## TOFU +# shellcheck disable=SC2016 +endpoint="$(qvm-run -p "$qube" -- awk '/Endpoint/{print $3}' /home/user/wireguard.conf)" +ip="$(echo "$endpoint" | cut -d ":" -f 1)" +port="$(echo "$endpoint" | cut -d ":" -f 2)" +if test -z "$ip" || test -z "$port";then + echo "Endpoint (server ip:port) not found in /home/user/wireguard.conf" >&2 + exit 1 +fi + +if qvm-check -q --running "$qube" >/dev/null 2>&1; then + qvm-pause "$qube" +fi + +qvm-firewall "$qube" reset +qvm-firewall "$qube" del --rule-no 0 +qvm-firewall "$qube" add accept proto=tcp dstports=53 +qvm-firewall "$qube" add accept proto=udp dstports=53 +qvm-firewall "$qube" add accept dsthost="$ip" proto=udp dstports="$port" +qvm-firewall "$qube" add drop + +if qvm-check -q --paused "$qube" >/dev/null 2>&1; then + qvm-unpause "$qube" +fi diff --git a/salt/sys-wireguard/files/server/qubes-firewall.d/00-vpn.sh b/salt/sys-wireguard/files/server/qubes-firewall.d/00-vpn.sh new file mode 100755 index 0000000..3f580bf --- /dev/null +++ b/salt/sys-wireguard/files/server/qubes-firewall.d/00-vpn.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +echo "define qubes_ip = $(qubesdb-read /qubes-ip)" \ + | tee /rw/config/vpn/qubes-ip.nft >/dev/null + +nft -f /rw/config/vpn/dns-hijack.nft + +## TODO: read https://www.wireguard.com/netns/ diff --git a/salt/sys-wireguard/files/server/set-wg-conf.sh b/salt/sys-wireguard/files/server/set-wg-conf.sh new file mode 100755 index 0000000..2c2cf33 --- /dev/null +++ b/salt/sys-wireguard/files/server/set-wg-conf.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2022 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +target_file="/home/user/wireguard.conf" + +if ! zenity --question \ + --text="Please select the wireguard configuration file you want to use" \ + --ok-label="OK" --cancel-label="No" +then + zenity --error --text="You need a config file\nCheck with Mullvad VPN" + exit 1 +fi + +client_file="$(zenity --file-selection)" + +if test -z "${client_file}"; then + zenity --error --text="No file selected" + exit 1 +fi + +if ! grep -q '^PrivateKey' "$client_file" ; then + zenity --error --text="That doesn't look like a client config file" + exit 1 +fi + +test "$client_file" != "$target_file" && cp "$client_file" "$target_file" +zenity --info --text="Restart this qube. The VPN service will autostart" diff --git a/salt/sys-wireguard/files/server/vpn/dns-hijack.nft b/salt/sys-wireguard/files/server/vpn/dns-hijack.nft new file mode 100755 index 0000000..b535d19 --- /dev/null +++ b/salt/sys-wireguard/files/server/vpn/dns-hijack.nft @@ -0,0 +1,24 @@ +#!/usr/bin/nft -f +# vim: ft=nftables + +# SPDX-FileCopyrightText: 2022 unman +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +include /rw/config/vpn/qubes-ip.nft + +define vpn_dns1 = 10.8.0.1 +define vpn_dns2 = 10.14.0.1 + +chain ip qubes forward '{ policy drop; }' +insert rule ip qubes custom-forward oifgroup 1 drop +insert rule ip qubes custom-forward iifgroup 1 drop + +flush chain ip qubes dnat-dns +flush chain ip6 qubes dnat-dns + +add rule ip qubes dnat-dns iifgroup 2 ip daddr $qubes_ip tcp dport 53 counter dnat to $vpn_dns1 +add rule ip qubes dnat-dns iifgroup 2 ip daddr $qubes_ip tcp dport 53 counter dnat to $vpn_dns1 +add rule ip qubes dnat-dns iifgroup 2 ip daddr $qubes_ip udp dport 53 counter dnat to $vpn_dns2 +add rule ip qubes dnat-dns iifgroup 2 ip daddr $qubes_ip udp dport 53 counter dnat to $vpn_dns2 diff --git a/salt/sys-wireguard/files/server/vpn/tunnel.nft b/salt/sys-wireguard/files/server/vpn/tunnel.nft new file mode 100755 index 0000000..c862a32 --- /dev/null +++ b/salt/sys-wireguard/files/server/vpn/tunnel.nft @@ -0,0 +1,41 @@ +#!/usr/bin/nft -f +# vim: ft=nftables + +# SPDX-FileCopyrightText: 2022 unman +# SPDX-FileCopyrightText: 2023 1cho1ce +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +## TODO: source this ruleset + +## Stop leaks +chain ip qubes forward '{ policy drop; }' +chain ip qubes input '{ policy drop; }' +chain ip qubes output '{ policy drop; }' +chain ip6 qubes forward '{ policy drop; }' +chain ip6 qubes input '{ policy drop; }' +chain ip6 qubes output '{ policy drop; }' +insert rule ip qubes custom-forward oifgroup 1 drop +insert rule ip qubes custom-forward iifgroup 1 drop +insert rule ip6 qubes custom-forward oifgroup 1 drop +insert rule ip6 qubes custom-forward iifgroup 1 drop + +## Accept forward traffic between dowstream vif+ (group 2) and VPN (group9) +insert rule ip qubes custom-forward iifgroup 2 oifgroup 9 accept +insert rule ip qubes custom-forward iifgroup 9 oifgroup 2 accept +insert rule ip6 qubes custom-forward iifgroup 2 oifgroup 9 accept +insert rule ip6 qubes custom-forward iifgroup 9 oifgroup 2 accept + +## Drop ICMP +insert rule ip qubes custom-input meta l4proto icmp drop +insert rule ip qubes output oifgroup 1 meta l4proto icmp drop +insert rule ip6 qubes custom-input meta l4proto icmp drop +insert rule ip6 qubes output oifgroup 1 meta l4proto icmp drop + +## Allow traffic from the `qvpn` group to the uplink interface (eth0); +## Our VPN client will run with group `qvpn`. +insert rule ip qubes output oifname "lo" accept +insert rule ip qubes output oifgroup 1 skgid qvpn accept +insert rule ip6 qubes output oifname "lo" accept +insert rule ip6 qubes output oifgroup 1 skgid "qvpn" accept diff --git a/salt/sys-wireguard/init.top b/salt/sys-wireguard/init.top new file mode 100644 index 0000000..d3c82d5 --- /dev/null +++ b/salt/sys-wireguard/init.top @@ -0,0 +1,14 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-wireguard.create + 'tpl-sys-wireguard': + - sys-wireguard.install + 'sys-wireguard': + - sys-wireguard.configure diff --git a/salt/sys-wireguard/install.sls b/salt/sys-wireguard/install.sls new file mode 100644 index 0000000..aa8989e --- /dev/null +++ b/salt/sys-wireguard/install.sls @@ -0,0 +1,37 @@ +{# +SPDX-FileCopyrightText: 2022 unman +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-qvpn-group": + group.present: + - name: qvpn + - system: True + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - qubes-core-agent-passwordless-root + - ca-certificates + - iproute2 + - libnotify-bin + - mate-notification-daemon + - resolvconf + - unzip + - wireguard + - curl + - zenity + +{% endif -%} diff --git a/salt/sys-wireguard/install.top b/salt/sys-wireguard/install.top new file mode 100644 index 0000000..20084b6 --- /dev/null +++ b/salt/sys-wireguard/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-wireguard': + - sys-wireguard.install diff --git a/salt/terraform/README.md b/salt/terraform/README.md new file mode 100644 index 0000000..a7bb1f9 --- /dev/null +++ b/salt/terraform/README.md @@ -0,0 +1,37 @@ +# terraform + +Terraform installation in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Install Terraform and use it on the "terraform" app qube. + +## Installation + +- Top: +```sh +qubesctl top.enable terraform +qubesctl --targets=tpl-terraform state.apply +qubesctl top.disable terraform +``` + +- State: + +```sh +qubesctl state.apply terraform.create +qubesctl --skip-dom0 --targets=tpl-terraform state.apply terraform.install +``` + + +## Usage + +You will be able to run terraform from the "terraform" qube. As simple as +that. + +When using SSH keys, being a split-ssh-agent will facilitate key management. diff --git a/salt/terraform/clone.sls b/salt/terraform/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/terraform/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/terraform/clone.top b/salt/terraform/clone.top new file mode 100644 index 0000000..faec07d --- /dev/null +++ b/salt/terraform/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - terraform.clone diff --git a/salt/terraform/create.sls b/salt/terraform/create.sls new file mode 100644 index 0000000..d6c1d97 --- /dev/null +++ b/salt/terraform/create.sls @@ -0,0 +1,33 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: purple +prefs: +- template: tpl-{{ slsdotpath }} +- label: purple +- vcpus: 1 +- memory: 400 +- maxmem: 600 +- autostart: False +features: +- disable: + - service.cups + - service.cups-browsed + - service.tinyproxy +{%- endload %} +{{ load(defaults) }} diff --git a/salt/terraform/create.top b/salt/terraform/create.top new file mode 100644 index 0000000..194f498 --- /dev/null +++ b/salt/terraform/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - terraform.create diff --git a/salt/terraform/files/repo/terraform.asc b/salt/terraform/files/repo/terraform.asc new file mode 100644 index 0000000..dcdd81e --- /dev/null +++ b/salt/terraform/files/repo/terraform.asc @@ -0,0 +1,64 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGO9u+MBEADmE9i8rpt8xhRqxbzlBG06z3qe+e1DI+SyjscyVVRcGDrEfo+J +W5UWw0+afey7HFkaKqKqOHVVGSjmh6HO3MskxcpRm/pxRzfni/OcBBuJU2DcGXnG +nuRZ+ltqBncOuONi6Wf00McTWviLKHRrP6oWwWww7sYF/RbZp5xGmMJ2vnsNhtp3 +8LIMOmY2xv9LeKMh++WcxQDpIeRohmSJyknbjJ0MNlhnezTIPajrs1laLh/IVKVz +7/Z73UWX+rWI/5g+6yBSEtj368N7iyq+hUvQ/bL00eyg1Gs8nE1xiCmRHdNjMBLX +lHi0V9fYgg3KVGo6Hi/Is2gUtmip4ZPnThVmB5fD5LzS7Y5joYVjHpwUtMD0V3s1 +HiHAUbTH+OY2JqxZDO9iW8Gl0rCLkfaFDBS2EVLPjo/kq9Sn7vfp2WHffWs1fzeB +HI6iUl2AjCCotK61nyMR33rNuNcbPbp+17NkDEy80YPDRbABdgb+hQe0o8htEB2t +CDA3Ev9t2g9IC3VD/jgncCRnPtKP3vhEhlhMo3fUCnJI7XETgbuGntLRHhmGJpTj +ydudopoMWZAU/H9KxJvwlVXiNoBYFvdoxhV7/N+OBQDLMevB8XtPXNQ8ZOEHl22G +hbL8I1c2SqjEPCa27OIccXwNY+s0A41BseBr44dmu9GoQVhI7TsetpR+qwARAQAB +tFFIYXNoaUNvcnAgU2VjdXJpdHkgKEhhc2hpQ29ycCBQYWNrYWdlIFNpZ25pbmcp +IDxzZWN1cml0eStwYWNrYWdpbmdAaGFzaGljb3JwLmNvbT6JAlQEEwEIAD4CGwMF +CwkIBwIGFQoJCAsCBBYCAwECHgECF4AWIQR5iuxlTlwVQoyOQu6qFvy8piHnAQUC +Y728PQUJCWYB2gAKCRCqFvy8piHnAd16EADeBtTgkdVEvct40TH/9HKkR/Lc/ohM +rer6FFHdKmceJ6Ma8/Qm4nCO5C7c4+EPjsUXdhK5w8DSdC5VbKLJDY1EnDlmU5B1 +wSFkGoYKoB8lUn30E77E33MTu2kfrSuF605vetq269CyBwIJV7oNN6311dW8iQ6z +IytTtlJbVr4YZ7Vst40/uR4myumk9bVBGEd6JhFAPmr/um+BZFhRf9/8xtOryOyB +GF2d+bc9IoAugpxwv0IowHEqkI4RpK2U9hvxG80sTOcmerOuFbmNyPwnEgtJ6CM1 +bc8WAmObJiQcRSLbcgF+a7+2wqrUbCqRE7QoS2wjd1HpUVPmSdJN925c2uaua2A4 +QCbTEg8kV2HiP0HGXypVNhZJt5ouo0YgR6BSbMlsMHniDQaSIP1LgmEz5xD4UAxO +Y/GRR3LWojGzVzBb0T98jpDgPtOu/NpKx3jhSpE2U9h/VRDiL/Pf7gvEIxPUTKuV +5D8VqAiXovlk4wSH13Q05d9dIAjuinSlxb4DVr8IL0lmx9DyHehticmJVooHDyJl +HoA2q2tFnlBBAFbN92662q8Pqi9HbljVRTD1vUjof6ohaoM+5K1C043dmcwZZMTc +7gV1rbCuxh69rILpjwM1stqgI1ONUIkurKVGZHM6N2AatNKqtBRdGEroQo1aL4+4 +u+DKFrMxOqa5b7kCDQRjvbwTARAA0ut7iKLj9sOcp5kRG/5V+T0Ak2k2GSus7w8e +kFh468SVCNUgLJpLzc5hBiXACQX6PEnyhLZa8RAG+ehBfPt03GbxW6cK9nx7HRFQ +GA79H5B4AP3XdEdT1gIL2eaHdQot0mpF2b07GNfADgj99MhpxMCtTdVbBqHY8YEQ +Uq7+E9UCNNs45w5ddq07EDk+o6C3xdJ42fvS2x44uNH6Z6sdApPXLrybeun74C1Z +Oo4Ypre4+xkcw2q2WIhy0Qzeuw+9tn4CYjrhw/+fvvPGUAhtYlFGF6bSebmyua8Q +MTKhwqHqwJxpjftM3ARdgFkhlH1H+PcmpnVutgTNKGcy+9b/lu/Rjq/47JZ+5VkK +ZtYT/zO1oW5zRklHvB6R/OcSlXGdC0mfReIBcNvuNlLhNcBA9frNdOk3hpJgYDzg +f8Ykkc+4z8SZ9gA3g0JmDHY1X3SnSadSPyMas3zH5W+16rq9E+MZztR0RWwmpDtg +Ff1XGMmvc+FVEB8dRLKFWSt/E1eIhsK2CRnaR8uotKW/A/gosao0E3mnIygcyLB4 +fnOM3mnTF3CcRumxJvnTEmSDcoKSOpv0xbFgQkRAnVSn/gHkcbVw/ZnvZbXvvseh +7dstp2ljCs0queKU+Zo22TCzZqXX/AINs/j9Ll67NyIJev445l3+0TWB0kego5Fi +UVuSWkMAEQEAAYkEcgQYAQgAJhYhBHmK7GVOXBVCjI5C7qoW/LymIecBBQJjvbwT +AhsCBQkJZgGAAkAJEKoW/LymIecBwXQgBBkBCAAdFiEE6wr14plJaVlvmYc+cG5m +g2nAhekFAmO9vBMACgkQcG5mg2nAhenPURAAimI0EBZbqpyHpwpbeYq3Pygg1bdo +IlBQUVoutaN1lR7kqGXwYH+BP6G40x79LwVy/fWV8gO7cDX6D1yeKLNbhnJHPBus +FJDmzDPbjTlyWlDqJoWMiPqfAOc1A1cHodsUJDUlA01j1rPTho0S9iALX5R50Wa9 +sIenpfe7RVunDwW5gw6y8me7ncl5trD0LM2HURw6nYnLrxePiTAF1MF90jrAhJDV ++krYqd6IFq5RHKveRtCuTvpL7DlgVCtntmbXLbVC/Fbv6w1xY3A7rXko/03nswAi +AXHKMP14UutVEcLYDBXbDrvgpb2p2ZUJnujs6cNyx9cOPeuxnke8+ACWvpnWxwjL +M5u8OckiqzRRobNxQZ1vLxzdovYTwTlUAG7QjIXVvOk9VNp/ERhh0eviZK+1/ezk +Z8nnPjx+elThQ+r16EM7hD0RDXtOR1VZ0R3OL64AlZYDZz1jEA3lrGhvbjSIfBQk +T6mxKUsCy3YbElcOyuohmPRgT1iVDIZ/1iPL0Q0HGm4+EsWCdH6fAPB7TlHD8z2D +7JCFLihFDWs5lrZyuWMO9nryZiVjJrOLPcStgJYVd/MhRHR4hC6g09bgo25RMJ6f +gyzL4vlEB7aSUih7yjgL9s5DKXP2J71dAhIlF8nnM403R2xEeHyivnyeR/9Ifn7M +PJvUMUuoG+ZANSMkrw//XA31o//TVk9WsLD1Edxt5XZCoR+fS+Vz8ScLwP1d/vQE +OW/EWzeMRG15C0td1lfHvwPKvf2MN+WLenp9TGZ7A1kEHIpjKvY51AIkX2kW5QLu +Y3LBb+HGiZ6j7AaU4uYR3kS1+L79v4kyvhhBOgx/8V+b3+2pQIsVOp79ySGvVwpL +FJ2QUgO15hnlQJrFLRYa0PISKrSWf35KXAy04mjqCYqIGkLsz2qQCY2lGcD5k05z +bBC4TvxwVxv0ftl2C5Bd0ydl/2YM7GfLrmZmTijK067t4OO+2SROT2oYPDsMtZ6S +E8vUXvoGpQ8tf5Nkrn2t0zDG3UDtgZY5UVYnZI+xT7WHsCz//8fY3QMvPXAuc33T +vVdiSfP0aBnZXj6oGs/4Vl1Dmm62XLr13+SMoepMWg2Vt7C8jqKOmhFmSOWyOmRH +UZJR7nKvTpFnL8atSyFDa4o1bk2U3alOscWS8u8xJ/iMcoONEBhItft6olpMVdzP +CTrnCAqMjTSPlQU/9EGtp21KQBed2KdAsJBYuPgwaQeyNIvQEOXmINavl58VD72Y +2T4TFEY8dUiExAYpSodbwBL2fr8DJxOX68WH6e3fF7HwX8LRBjZq0XUwh0KxgHN+ +b9gGXBvgWnJr4NSQGGPiSQVNNHt2ZcBAClYhm+9eC5/VwB+Etg4+1wDmggztiqE= +=FdUF +-----END PGP PUBLIC KEY BLOCK----- diff --git a/salt/terraform/files/repo/terraform.list b/salt/terraform/files/repo/terraform.list new file mode 100644 index 0000000..6ced800 --- /dev/null +++ b/salt/terraform/files/repo/terraform.list @@ -0,0 +1,2 @@ +deb [signed-by=/usr/share/keyrings/terraform.asc] http://apt.releases.hashicorp.com bookworm main +# vim:ft=debsources diff --git a/salt/terraform/files/repo/terraform.sources b/salt/terraform/files/repo/terraform.sources new file mode 100644 index 0000000..c7861a7 --- /dev/null +++ b/salt/terraform/files/repo/terraform.sources @@ -0,0 +1,6 @@ +Types: deb +URIs: http://apt.releases.hashicorp.com +Suites: bookworm +Components: main +Signed-by: /usr/share/keyrings/terraform.asc +# vim:ft=debsources diff --git a/salt/terraform/init.top b/salt/terraform/init.top new file mode 100644 index 0000000..969ba43 --- /dev/null +++ b/salt/terraform/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - terraform.create + 'tpl-terraform': + - terraform.install diff --git a/salt/terraform/install.sls b/salt/terraform/install.sls new file mode 100644 index 0000000..02d2004 --- /dev/null +++ b/salt/terraform/install.sls @@ -0,0 +1,32 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - sys-ssh-agent.install-client + +{% from 'utils/macros/install-repo.sls' import install_repo -%} +{{ install_repo(sls_path, 'terraform') }} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - ca-certificates + - terraform + - terraform-ls + - vim + - man-db + +{% endif -%} diff --git a/salt/terraform/install.top b/salt/terraform/install.top new file mode 100644 index 0000000..ae4b671 --- /dev/null +++ b/salt/terraform/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-terraform': + - terraform.install diff --git a/salt/utils/README.md b/salt/utils/README.md new file mode 100644 index 0000000..b8b3ad7 --- /dev/null +++ b/salt/utils/README.md @@ -0,0 +1,18 @@ +# utils + +Utilities library for Qusal. + +## Table of Contents + +* [Description](#description) +* [Usage](#usage) + +## Description + +Utils is a SaltStack Qubes library for certain operations shared by multiple +projects such as macros and common tools to be installed. + +## Usage + +You are not meant to interact with the utils directly, but through other +states. diff --git a/salt/utils/macros/clone-template.sls b/salt/utils/macros/clone-template.sls new file mode 100644 index 0000000..239809f --- /dev/null +++ b/salt/utils/macros/clone-template.sls @@ -0,0 +1,30 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{# +Usage: +1: Import this template: +{% from 'utils/macros/clone-template.sls' import clone_template -%} + +2: Set template to clone from and the clone name: +{{ clone_template('debian-minimal', sls_path) }} +#} + +{% macro clone_template(source, name) -%} + +{%- import source ~ "/template.jinja" as template -%} + +include: + - {{ source }}.create + +"tpl-{{ name }}-clone": + qvm.clone: + - require: + - sls: {{ source }}.create + - source: {{ template.template }} + - name: tpl-{{ name }} + +{% endmacro -%} diff --git a/salt/utils/macros/install-repo.sls b/salt/utils/macros/install-repo.sls new file mode 100644 index 0000000..ca10f60 --- /dev/null +++ b/salt/utils/macros/install-repo.sls @@ -0,0 +1,77 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{# +Install repositories with ease. + +Usage: +1: Import this template: +{% from 'utils/macros/install-repo.sls' import install_repo -%} + +2: Set template to clone from and the clone name: +{{ install_repo(sls_path, 'chrome') }} + +If sls_path is 'browser', then this would install the repo from: + Source directory: + salt://browser/files/repo/ + + Debian: + chrome.sources -> /etc/apt/sources.list.d/chrome.sources + chrome.asc -> /usr/share/keyrings/chrome.asc + Fedora: + chrome.yum.repo -> /etc/yum.repos.d/chrome.repo + chrome.yum.asc -> /etc/pki/rpm-gpg/RPM-GPG-KEY-chrome +#} + +{% macro install_repo(name, repo) -%} + +{% if grains['os_family']|lower == 'debian' -%} + +"{{ name }}-install-{{ repo }}-keyring": + file.managed: + - name: /usr/share/keyrings/{{ repo }}.asc + - source: salt://{{ name }}/files/repo/{{ repo }}.asc + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ name }}-install-{{ repo }}-repository": + file.managed: + - name: /etc/apt/sources.list.d/{{ repo }}.sources + - source: salt://{{ name }}/files/repo/{{ repo }}.sources + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ name }}-remove-{{ repo }}-old-format": + file.absent: + - name: /etc/apt/sources.list.d/{{ repo }}.list + +{% elif grains['os_family']|lower == 'redhat' -%} + +"{{ name }}-install-{{ repo }}-keyring": + file.managed: + - name: /etc/pki/rpm-gpg/RPM-GPG-KEY-{{ repo }} + - source: salt://{{ name }}/files/repo/{{ repo }}.yum.asc + - mode: '0644' + - user: root + - group: root + - makedirs: True + +"{{ name }}-install-{{ repo }}-repository": + file.managed: + - name: /etc/yum.repos.d/{{ repo }}.repo + - source: salt://{{ name }}/files/repo/{{ repo }}.yum.repo + - mode: '0644' + - user: root + - group: root + - makedirs: True + +{% endif -%} + +{% endmacro -%} diff --git a/salt/utils/macros/policy.sls b/salt/utils/macros/policy.sls new file mode 100644 index 0000000..e99b281 --- /dev/null +++ b/salt/utils/macros/policy.sls @@ -0,0 +1,86 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{# +Qubes RPC Policy Template + +Usage: + +UNSET POLICY: +------------ +{% from 'utils/macros/policy.sls' import policy_unset with context -%} +{{ policy_unset(sls_path, '80') }} + +SET POLICY: +----------- +{% from 'utils/macros/policy.sls' import policy_set with context -%} +{{ policy_set(sls_path, '80') }} + +{% from 'utils/macros/policy.sls' import policy_set_full with context -%} +{{ policy_set_full('project', '/etc/qubes/policy.d/80-project.policy', 'salt://project/files/admin/policy/default.policy') }} + +If you prefer to use 'contents' instead of 'source': +{% from 'utils/macros/policy.sls' import load_policy -%} +{% load_yaml as defaults_policy -%} +name: /etc/qubes/policy.d/80-{{ slsdotpath }}.policy +contents: + - "## Comments need to be quoted." + - qubes.Example * {{ slsdotpath }} @default ask target=sys-test + - qubes.Example * {{ slsdotpath }} sys-test ask +{%- endload %} +{{ load_policy(defaults_policy) }} + +#} + +{% set policy_mode = '0644' -%} +{% set policy_user = 'root' -%} +{% set policy_group = 'qubes' -%} + +{% macro policy_unset(project, number) -%} +"{{ project }}-absent-rpc-policy": + file.absent: + - name: /etc/qubes/policy.d/{{ number ~ '-' ~ project }}.policy +{%- endmacro %} + +{% macro policy_set(project, number) -%} +"{{ project }}-set-rpc-policy": + file.managed: + - name: /etc/qubes/policy.d/{{ number ~ '-' ~ project }}.policy + - source: salt://{{ project }}/files/admin/policy/default.policy + - template: jinja + - context: + sls_path: {{ project }} + - mode: {{ policy_mode }} + - user: {{ policy_user }} + - group: {{ policy_group }} +{% endmacro -%} + +{% macro policy_set_full(project, name, source) -%} +"{{ project }}-set-full-rpc-policy": + file.managed: + - name: {{ name }} + - source: {{ source }} + - template: jinja + - context: + sls_path: {{ project }} + - mode: {{ policy_mode }} + - user: {{ policy_user }} + - group: {{ policy_group }} +{% endmacro -%} + +{% macro state_policy(name, contents) -%} +"{{ name }}-rpc-policy": + file.managed: + - name: {{ name }} + - contents: {{ contents }} + - mode: {{ policy_mode }} + - user: {{ policy_user }} + - group: {{ policy_group }} +{%- endmacro %} + +{% macro load_policy(policy) -%} + {{- state_policy(policy.name, policy.contents) }} +{%- endmacro %} diff --git a/salt/utils/macros/switch-template.sls b/salt/utils/macros/switch-template.sls new file mode 100644 index 0000000..6d2b8df --- /dev/null +++ b/salt/utils/macros/switch-template.sls @@ -0,0 +1,26 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{# +Switch Template to Default Template + +Usage: +1: Import this template: +{% from 'utils/macros/switch-template.sls' import switch_template -%} + +2: Set list of qubes to set default template: +{{ switch_template([sls_path, 'example']) }} +#} + +{% set default_template = salt['cmd.shell']('qubes-prefs default_template') -%} + +{% macro switch_template(qubes) -%} +{% for qube in qubes -%} +"{{ slsdotpath }}-reset-{{ qube }}-template-to-default_template": + cmd.run: + - name: qvm-prefs {{ qube }} template {{ default_template }} +{% endfor -%} +{% endmacro -%} diff --git a/salt/utils/macros/sync-appmenus.sls b/salt/utils/macros/sync-appmenus.sls new file mode 100644 index 0000000..a926677 --- /dev/null +++ b/salt/utils/macros/sync-appmenus.sls @@ -0,0 +1,46 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{# +Qubes Sync Appmenus + +Usage: +1: Import this template: +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} + +2: Set qube to sync the appmenus: +{{ sync_appmenus('tpl-' ~ sls_path) }} +{{ sync_appmenus('tpl-ssh') }} +#} + +{% macro sync_appmenus(qube) -%} + +{% set running = 0 -%} +{% if salt['cmd.shell']('qvm-ls --no-spinner --raw-list --running ' ~ qube) == qube -%} + {% set running = 1 -%} +{% endif -%} + +"{{ qube }}-start": + qvm.start: + - name: {{ qube }} + +{% set gui_user = salt['cmd.shell']('groupmems -l -g qubes') -%} +"{{ qube }}-sync-appmenus": + cmd.run: + - require: + - qvm: {{ qube }}-start + - name: qvm-sync-appmenus {{ qube }} + - runas: {{ gui_user }} + +{% if running == 0 -%} +"{{ qube }}-shutdown": + qvm.shutdown: + - require: + - cmd: {{ qube }}-sync-appmenus + - name: {{ qube }} +{% endif -%} + +{% endmacro -%} diff --git a/salt/utils/tools/builder/README.md b/salt/utils/tools/builder/README.md new file mode 100644 index 0000000..690e3c9 --- /dev/null +++ b/salt/utils/tools/builder/README.md @@ -0,0 +1,29 @@ +# builder + +Build tools for packaging in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +This is not necessary for qubes-builder, it is just a set of useful tools for +building packages in UNIX distributions. + +## Installation + +Install builder tools on templates: +```sh +qubesctl --skip-dom0 --targets=TEMPLATEVMS state.apply utils.tools.builder.core +``` +Install documentation tools on templates: +```sh +qubesctl --skip-dom0 --targets=TEMPLATEVMS state.apply utils.tools.builder.doc +``` + +## Usage + +Standard builder usage, no extra configuration required. diff --git a/salt/utils/tools/builder/core.sls b/salt/utils/tools/builder/core.sls new file mode 100644 index 0000000..bd18073 --- /dev/null +++ b/salt/utils/tools/builder/core.sls @@ -0,0 +1,46 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-core-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-core-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - qubes-core-agent-networking + - qubes-core-agent-passwordless-root + - bash-completion + - make + - rpmlint + - rpm + - licensecheck + - devscripts + +{% set pkg = { + 'Debian': { + 'pkg': ['equivs', 'dctrl-tools', 'build-essential' 'debhelper', 'quilt', + 'lintian', 'mmdebstrap'], + }, + 'RedHat': { + 'pkg': ['rpmdevtools', 'rpm-sign', 'rpm-build', 'fedora-packager', + 'fedora-review'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-core-installed-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +{% endif -%} diff --git a/salt/utils/tools/builder/doc.sls b/salt/utils/tools/builder/doc.sls new file mode 100644 index 0000000..6f90490 --- /dev/null +++ b/salt/utils/tools/builder/doc.sls @@ -0,0 +1,25 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-doc-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-doc-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - pandoc + - ronn + - groff + - man-db + - less + +{% endif -%} diff --git a/salt/utils/tools/zsh/README.md b/salt/utils/tools/zsh/README.md new file mode 100644 index 0000000..3f28a73 --- /dev/null +++ b/salt/utils/tools/zsh/README.md @@ -0,0 +1,35 @@ +# zsh + +Zsh environment in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Install Zsh, setup it to be the user shell and touch ~/.zshrc to avoid +warnings. + +## Installation + +- Top +```sh +qubesctl top.enable utils.tools.zsh +qubesctl --targets=TARGET state.apply +qubesctl top.disable utils.tools.zsh +``` + +- State + +```sh +qubesctl --skip-dom0 --targets=TEMPLATEVMS state.apply utils.tools.zsh.change-shell +qubesctl --skip-dom0 --targets=APPVMS state.apply utils.tools.zsh.touch-zshrc +``` + + +## Usage + +Standard Zsh usage. No extra configuration required. diff --git a/salt/utils/tools/zsh/change-shell.sls b/salt/utils/tools/zsh/change-shell.sls new file mode 100644 index 0000000..d771966 --- /dev/null +++ b/salt/utils/tools/zsh/change-shell.sls @@ -0,0 +1,20 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .install + +## chsh is not in Fedora and usermod covers a wider range. +"{{ slsdotpath }}-change-user-shell-to-zsh": + cmd.run: + - name: usermod -s /bin/zsh user + - runas: root + - require: + - sls: {{ slsdotpath }}.install + +{% endif -%} diff --git a/salt/utils/tools/zsh/change-shell.top b/salt/utils/tools/zsh/change-shell.top new file mode 100644 index 0000000..45f6e3a --- /dev/null +++ b/salt/utils/tools/zsh/change-shell.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - utils.tools.zsh.change-shell diff --git a/salt/utils/tools/zsh/init.sls b/salt/utils/tools/zsh/init.sls new file mode 100644 index 0000000..2b9e6ff --- /dev/null +++ b/salt/utils/tools/zsh/init.sls @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - .install + - .touch-zshrc + - .change-shell diff --git a/salt/utils/tools/zsh/init.top b/salt/utils/tools/zsh/init.top new file mode 100644 index 0000000..802b956 --- /dev/null +++ b/salt/utils/tools/zsh/init.top @@ -0,0 +1,11 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - utils.tools.zsh.touch-zshrc + - utils.tools.zsh.install + - utils.tools.zsh.change-shell diff --git a/salt/utils/tools/zsh/install.sls b/salt/utils/tools/zsh/install.sls new file mode 100644 index 0000000..bd20542 --- /dev/null +++ b/salt/utils/tools/zsh/install.sls @@ -0,0 +1,26 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - .touch-zshrc + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - zsh + - zsh-autosuggestions + - zsh-syntax-highlighting + +{% endif -%} diff --git a/salt/utils/tools/zsh/install.top b/salt/utils/tools/zsh/install.top new file mode 100644 index 0000000..4276dac --- /dev/null +++ b/salt/utils/tools/zsh/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - utils.tools.zsh.install diff --git a/salt/utils/tools/zsh/touch-zshrc.sls b/salt/utils/tools/zsh/touch-zshrc.sls new file mode 100644 index 0000000..c63e3ce --- /dev/null +++ b/salt/utils/tools/zsh/touch-zshrc.sls @@ -0,0 +1,16 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +# zsh complains if there is no .zshrc when. +# Only useful if not using the dotfiles but installing zsh. + +"{{ slsdotpath }}-touch-home-zshrc": + file.touch: + - name: /home/user/.zshrc + +"{{ slsdotpath }}-touch-skel-zshrc": + file.touch: + - name: /etc/skel/.zshrc diff --git a/salt/utils/tools/zsh/touch-zshrc.top b/salt/utils/tools/zsh/touch-zshrc.top new file mode 100644 index 0000000..9f62b6e --- /dev/null +++ b/salt/utils/tools/zsh/touch-zshrc.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + '*': + - utils.tools.zsh.touch-zshrc diff --git a/salt/vault/README.md b/salt/vault/README.md new file mode 100644 index 0000000..9d126ec --- /dev/null +++ b/salt/vault/README.md @@ -0,0 +1,40 @@ +# vault + +Vault environment in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +An offline qube will be created and named "vault", it will have a password +manager for high entropy passwords, PGP and SSH client for creating private +keys. + +## Installation + +- Top: +```sh +qubesctl top.enable vault +qubesctl --targets=tpl-vault state.apply +qubesctl top.disable vault +``` + +- State: + +```sh +qubesctl state.apply vault.create +qubesctl --skip-dom0 --targets=tpl-vault state.apply vault.install +``` + + +## Usage + +The intended usage is to hold passwords and keys. You should copy the keys +generated from the vault to another qube, which can be a split agent +server for SSH, PGP, Pass. A compromise of the client qube can escalate into a +compromise of the qubes it can run RPC services, therefore a separate vault is +appropriate according to your threat model. diff --git a/salt/vault/clone.sls b/salt/vault/clone.sls new file mode 100644 index 0000000..0554d7f --- /dev/null +++ b/salt/vault/clone.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/clone-template.sls' import clone_template -%} +{{ clone_template('debian-minimal', sls_path) }} diff --git a/salt/vault/clone.top b/salt/vault/clone.top new file mode 100644 index 0000000..8893521 --- /dev/null +++ b/salt/vault/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - vault.clone diff --git a/salt/vault/create.sls b/salt/vault/create.sls new file mode 100644 index 0000000..724338f --- /dev/null +++ b/salt/vault/create.sls @@ -0,0 +1,45 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- from "qvm/template.jinja" import load -%} + +include: + - .clone + +{% load_yaml as defaults -%} +name: tpl-{{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +features: +- set: + - menu-items: "org.keepassxc.KeePassXC.desktop qubes-run-terminal.desktop qubes-start.desktop" + - default-menu-items: "org.keepassxc.KeePassXC.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} + +{% load_yaml as defaults -%} +name: {{ slsdotpath }} +force: True +require: +- sls: {{ slsdotpath }}.clone +present: +- template: tpl-{{ slsdotpath }} +- label: black +prefs: +- template: tpl-{{ slsdotpath }} +- label: black +- netvm: "" +- memory: 400 +- maxmem: 600 +- vcpus: 1 +- autostart: False +- include_in_backups: True +features: +- set: + - menu-items: "org.keepassxc.KeePassXC.desktop qubes-run-terminal.desktop qubes-start.desktop" +{%- endload %} +{{ load(defaults) }} diff --git a/salt/vault/create.top b/salt/vault/create.top new file mode 100644 index 0000000..b0e66c5 --- /dev/null +++ b/salt/vault/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - vault.create diff --git a/salt/vault/init.top b/salt/vault/init.top new file mode 100644 index 0000000..a7db04b --- /dev/null +++ b/salt/vault/init.top @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - vault.create + 'tpl-vault': + - vault.install diff --git a/salt/vault/install.sls b/salt/vault/install.sls new file mode 100644 index 0000000..5c07a97 --- /dev/null +++ b/salt/vault/install.sls @@ -0,0 +1,41 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - dev.home-cleanup + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-installed": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - keepassxc + - gnupg2 + +{% set pkg = { + 'Debian': { + 'pkg': ['sq', 'openssh-client'], + }, + 'RedHat': { + 'pkg': ['sequoia-sq', 'openssh-clients'], + }, +}.get(grains.os_family) -%} + +"{{ slsdotpath }}-installed-os-specific": + pkg.installed: + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: {{ pkg.pkg|sequence|yaml }} + +{% endif -%} diff --git a/salt/vault/install.top b/salt/vault/install.top new file mode 100644 index 0000000..287736d --- /dev/null +++ b/salt/vault/install.top @@ -0,0 +1,9 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-vault': + - vault.install diff --git a/salt/whonix/README.md b/salt/whonix/README.md new file mode 100644 index 0000000..dd17563 --- /dev/null +++ b/salt/whonix/README.md @@ -0,0 +1,38 @@ +# whonix + +Whonix Template in Qubes OS. + +## Table of Contents + +* [Description](#description) +* [Installation](#installation) +* [Usage](#usage) + +## Description + +Creates the Whonix Gateway and Workstation templates as well as a Disposable +Template based on it. + +## Installation + +- Top: +```sh +qubesctl top.enable whonix +qubesctl state.apply +qubesctl top.disable whonix +qubesctl state.apply qvm.anon-whonix +qubesctl state.apply qvm.whonix-ws-dvm +``` + +- State: + +```sh +qubesctl state.apply whonix.create +qubesctl state.apply qvm.anon-whonix +qubesctl state.apply qvm.whonix-ws-dvm +``` + + +## Usage + +AppVMs and StandaloneVMs can be based on this template. diff --git a/salt/whonix/clone.sls b/salt/whonix/clone.sls new file mode 100644 index 0000000..f64c802 --- /dev/null +++ b/salt/whonix/clone.sls @@ -0,0 +1,17 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{%- import slsdotpath ~ "/template.jinja" as whonix -%} + +"{{ whonix.whonix_gw_template }}-installed": + qvm.template_installed: + - name: {{ whonix.whonix_gw_template }} + - fromrepo: {{ whonix.whonix_repo }} + +"{{ whonix.whonix_ws_template }}-installed": + qvm.template_installed: + - name: whonix-ws-{{ whonix.whonix_ws_template }} + - fromrepo: {{ whonix.whonix_repo }} diff --git a/salt/whonix/clone.top b/salt/whonix/clone.top new file mode 100644 index 0000000..068810f --- /dev/null +++ b/salt/whonix/clone.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - whonix.clone diff --git a/salt/whonix/create.sls b/salt/whonix/create.sls new file mode 100644 index 0000000..b09fb87 --- /dev/null +++ b/salt/whonix/create.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +include: + - whonix.clone diff --git a/salt/whonix/create.top b/salt/whonix/create.top new file mode 100644 index 0000000..477bc87 --- /dev/null +++ b/salt/whonix/create.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - whonix.create diff --git a/salt/whonix/init.top b/salt/whonix/init.top new file mode 100644 index 0000000..477bc87 --- /dev/null +++ b/salt/whonix/init.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - whonix.create diff --git a/salt/whonix/install.sls b/salt/whonix/install.sls new file mode 100644 index 0000000..41e3943 --- /dev/null +++ b/salt/whonix/install.sls @@ -0,0 +1,13 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +"{{ slsdotpath }}-updated": + pkg.uptodate: + - refresh: True + +{% endif %} diff --git a/salt/whonix/install.top b/salt/whonix/install.top new file mode 100644 index 0000000..f620d0b --- /dev/null +++ b/salt/whonix/install.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - whonix.install diff --git a/salt/whonix/template.jinja b/salt/whonix/template.jinja new file mode 100644 index 0000000..7b98b77 --- /dev/null +++ b/salt/whonix/template.jinja @@ -0,0 +1,12 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% set whonix_version = salt['pillar.get']('qvm:whonix:version', '17') -%} +{% set whonix_repo = salt['pillar.get']('qvm:whonix:repo', 'qubes-templates-community') -%} +{% set whonix_ws_template = 'whonix-ws-' ~ whonix_version -%} +{% set whonix_gw_template = 'whonix-gw-' ~ whonix_version -%} +{% set whonix_ws_clean_template = 'whonix-ws' -%} +{% set whonix_gw_clean_template = 'whonix-gw' -%} diff --git a/scripts/salt-fix.sh b/scripts/salt-fix.sh new file mode 100755 index 0000000..0cb1da3 --- /dev/null +++ b/scripts/salt-fix.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +## SPDX-FileCopyrightText: 2013-2018 Will Thames will@thames.id.au +## SPDX-FileCopyrightText: 2018 Ansible by Red Hat +## SPDX-FileCopyrightText: 2020 - 2023 Warpnet B.V. +## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## +## SPDX-License-Identifier: AGPL-3.0-or-later + +## Credits: https://salt-lint.readthedocs.io/en/latest/#fix-common-issues + +# shellcheck disable=SC2086 +set -eu + +command -v git >/dev/null || + { printf "Missing program: git\n" >&2; exit 1; } +cd "$(git rev-parse --show-toplevel)" || exit 1 + +find_tool="find" +if command -v fd; then + find_tool="fd" +elif command -v fdfind >/dev/null; then + find_tool="fdfind" +fi + +case "${find_tool}" in + fd|fdfind) files="$(${find_tool} . minion.d/ --extension=conf) $(${find_tool} . salt/ --max-depth=2 --type=f --extension=sls)";; + find) files="$(find minion.d/ -type f -name "*.conf") $(find salt/ -maxdepth 2 -type f -name '*.sls')";; +esac + +## 201 - Fix trailing whitespace: +sed -i'' -e's/[[:space:]]*$//' ${files} + +## 206 - Fix spacing around {{ var_name }}, eg. {{env}} --> {{ env }}: +sed -i'' -E "s/\{\{\s?([^}]*[^} ])\s?\}\}/\{\{ \1 \}\}/g" ${files} + +## 207 - Add quotes around numeric values that start with a 0: +sed -i'' -E "s/\b(minute|hour): (0[0-7]?)\$/\1: '\2'/" ${files} + +## 208 - Make dir_mode, file_mode and mode arguments in the desired syntax: +sed -i'' -E "s/\b(dir_|file_|)mode: 0?([0-7]{3})/\1mode: '0\2'/" ${files} diff --git a/scripts/salt-lint.sh b/scripts/salt-lint.sh new file mode 100755 index 0000000..4687d91 --- /dev/null +++ b/scripts/salt-lint.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## +## SPDX-License-Identifier: AGPL-3.0-or-later + +# shellcheck disable=SC2086 +set -eu + +command -v salt-lint >/dev/null || + { printf >&2 "Missing program: salt-lint\n"; exit 1; } +command -v git >/dev/null || + { printf "Missing program: git\n" >&2; exit 1; } +cd "$(git rev-parse --show-toplevel)" || exit 1 + +possible_conf="${PWD}/.salt-lint" +conf="" +test -f "${possible_conf}" && conf="-c ${possible_conf}" + +find_tool="find" +if command -v fd; then + find_tool="fd" +elif command -v fdfind >/dev/null; then + find_tool="fdfind" +fi + +if test -n "${1-}"; then + files="" + for f in "$@"; do + test -f "$f" || continue + extension="$(echo "$f" | awk -F '.' '{print $NF}')" + case "$extension" in + top|sls) files="$files $f";; + *) continue;; + esac + done + test -n "$files" || exit 0 + exec salt-lint ${conf} ${files} +fi + +case "${find_tool}" in + fd|fdfind) files="$(${find_tool} . minion.d/ --extension=conf) $(${find_tool} . salt/ --max-depth=2 --type=f --extension=sls --extension=top)";; + find) files="$(find minion.d/ -type f -name "*.conf") $(find salt/* -maxdepth 2 -type f \( -name '*.sls' -o -name '*.top' \))";; +esac + +exec salt-lint ${conf} ${files} diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..9b46540 --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## +## SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +test "$(hostname)" = "dom0" || { echo "Must be run from dom0" >&2; exit 1; } +test "$(id -u)" = "0" || exec sudo "${0}" + +group="qusal" +file_roots="/srv/salt/${group}" + +## Avoid having extra unwanted files. +rm -rf "${file_roots}" +cp -f minion.d/*.conf /etc/salt/minion.d/ +mkdir -p "${file_roots}" +cp -r salt/* "${file_roots}" diff --git a/scripts/shell-lint.sh b/scripts/shell-lint.sh new file mode 100755 index 0000000..ab099c6 --- /dev/null +++ b/scripts/shell-lint.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +## SPDX-FileCopyrightText: 2018 Andreas Kusalananda +## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## +## SPDX-License-Identifier: AGPL-3.0-or-later + +## Credits: https://unix.stackexchange.com/a/483876 + +# shellcheck disable=SC2086 +set -eu + +command -v shellcheck >/dev/null || + { printf >&2 "Missing program: shellcheck\n"; exit 1; } +command -v file >/dev/null || + { printf >&2 "Missing program: file\n"; exit 1; } +command -v git >/dev/null || + { printf "Missing program: git\n" >&2; exit 1; } +cd "$(git rev-parse --show-toplevel)" || exit 1 + +if command -v fd; then + find_tool="fd" +elif command -v fdfind >/dev/null; then + find_tool="fdfind" +fi + +if test -n "${1-}"; then + files="" + sh_files="" + for f in "$@"; do + test -f "$f" || continue + if test "${f##*/}" = "rc.local"; then + sh_files="$sh_files $f" + continue + fi + case $( file -bi "$f" ) in + (*/x-shellscript*) files="$files $f";; + esac + done + if test -n "$files" || test -n "$sh_files"; then + exit 0 + fi + test -z "$files" || shellcheck ${files} + test -z "$sh_files" || shellcheck -s sh ${sh_files} + exit +fi + +case "${find_tool}" in + fd|fdfind) + # shellcheck disable=2016,2215 + files="$(${find_tool} . scripts/ salt/ --hidden --exclude=zsh --type=f \ + --exec sh -c ' + case $( file -bi "$1" ) in (*/x-shellscript*) + printf "%s\n" "$1";; esac' sh)" + ## No Shebang + sh_files="$(${find_tool} rc.local salt/ --type=f)" + ;; + find) + files="$(find scripts/ salt/ -not \( -path "*/zsh" -prune \) -type f -exec sh -c ' + case $( file -bi "$1" ) in (*/x-shellscript*) exit 0;; esac + exit 1' sh {} \; -print)" + ## No Shebang + sh_files="$(find salt/ -type f -name "rc.local")" + ;; +esac + +files="$(echo "$files" | sort -u)" +sh_files="$(echo "$sh_files" | sort -u)" +shellcheck ${files} +shellcheck -s sh ${sh_files} diff --git a/scripts/spec-build.sh b/scripts/spec-build.sh new file mode 100755 index 0000000..623907b --- /dev/null +++ b/scripts/spec-build.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## +## SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +usage(){ + printf '%s\n' "Usage: ${0##*/} PROJECT [release]" >&2 + exit 1 +} + +case "${1-}" in + ""|-*) usage;; +esac + +release="" +case "${2-}" in + release) release="1";; + "") ;; + *) usage;; +esac + +command -v dnf >/dev/null || + { printf "Missing program: dnf\n" >&2; exit 1; } +command -v rpmlint >/dev/null || + { printf "Missing program: rpmlint\n" >&2; exit 1; } +## command -v rpmdev-setuptree >/dev/null || +## { printf "Missing program: rpmdev-setuptree\n" >&2; exit 1; } +command -v rpmbuild >/dev/null || + { printf "Missing program: rpmbuild\n" >&2; exit 1; } +command -v git >/dev/null || + { printf "Missing program: git\n" >&2; exit 1; } +cd "$(git rev-parse --show-toplevel)" || exit 1 + +project="${1}" +spec_gen="./scripts/spec-gen.sh" +spec_get="./scripts/spec-get.sh" +group="$(${spec_get} "${project}" group)" +spec="rpm_spec/${group}-${project}.spec" + +"${spec_gen}" "${project}" +rpmlint "${spec}" + +if grep -q "^BuildRequires: " "${spec}"; then + sudo dnf build-dep "${spec}" +fi + +if command -v rpmdev-setuptree >/dev/null; then + rpmdev-setuptree +else + mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/BUILDROOT ~/rpmbuild/RPMS + mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/SRPMS +fi + +mkdir ~/rpmbuild/BUILD/"${group}-${project}" +mkdir ~/rpmbuild/SOURCES/"${group}-${project}" + +cp -r "salt/${project}"/* ~/rpmbuild/BUILD/"${group}-${project}"/ +cp -r "salt/${project}"/* ~/rpmbuild/SOURCES/"${group}-${project}"/ + +if test -n "${release}"; then + rpmbuild -ba --sign "${spec}" +else + rpmbuild -ba "${spec}" +fi diff --git a/scripts/spec-gen.sh b/scripts/spec-gen.sh new file mode 100755 index 0000000..12720a3 --- /dev/null +++ b/scripts/spec-gen.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## +## SPDX-License-Identifier: AGPL-3.0-or-later + +set -eu + +usage(){ + echo "Usage: ${0##*/} PROJECT [PROJECT ...]" +} + +# get_scriptlet scriptlet-action +# [pre|post]-[install|upgrade], [pre|post]un-[uninstall|upgrade] +## Get scriptlet command, else fail safe. +get_scriptlet(){ + scriptlet="$1" + sed -n "/^<\!-- pkg:begin:${scriptlet} -->$/,/^<\!-- pkg:end:${scriptlet} -->$/p" "${readme}" \ + | grep -v -e '^```\S*$' -e "^<\!-- " || echo "true" +} + +get_spec(){ + "${spec_get}" "${project}" "${1}" +} + +gen_spec(){ + project="${1}" + + ## Test if a standard option works without error. + get_spec name >/dev/null + + group="$(get_spec group)" + template="rpm_spec/template/template.spec" + target="rpm_spec/${group}-${project}.spec" + + ## Escape multiline strings for sed + escaped_key(){ + echo "${1}" | sed ':a;N;$!ba;s/\n/\\n /g' | sed 's/\$/\\$/' + } + + readme="$(get_spec readme)" + + pre_install="$(escaped_key "$(get_scriptlet pre-install)")" + pre_upgrade="$(escaped_key "$(get_scriptlet pre-upgrade)")" + post_install="$(escaped_key "$(get_scriptlet post-install)")" + post_upgrade="$(escaped_key "$(get_scriptlet post-upgrade)")" + preun_uninstall="$(escaped_key "$(get_scriptlet preun-uninstall)")" + preun_upgrade="$(escaped_key "$(get_scriptlet preun-upgrade)")" + postun_uninstall="$(escaped_key "$(get_scriptlet postun-uninstall)")" + postun_upgrade="$(escaped_key "$(get_scriptlet postun-upgrade)")" + + version="$(get_spec version)" + changelog="$(get_spec changelog)" + requires="$(get_spec requires)" + + sed \ + -e "s/@PRE_INSTALL@/${pre_install}/" \ + -e "s/@PRE_UPGRADE@/${pre_upgrade}/" \ + -e "s/@POST_INSTALL@/${post_install}/" \ + -e "s/@POST_UPGRADE@/${post_upgrade}/" \ + -e "s/@PREUN_UNINSTALL@/${preun_uninstall}/" \ + -e "s/@PREUN_UPGRADE@/${preun_upgrade}/" \ + -e "s/@POSTUN_UNINSTALL@/${postun_uninstall}/" \ + -e "s/@POSTUN_UPGRADE@/${postun_upgrade}/" \ + -e "s/@VERSION@/${version}/" \ + -e "s/@PROJECT@/${project}/" \ + -e "/@CHANGELOG@/d" \ + "${template}" | tee "${target}" >/dev/null + + requires_key="" + for r in $(printf %s"${requires}" | tr " " "\n"); do + requires_key="${requires_key}\nRequires: ${group}-${r}" + done + sed -i "s/@REQUIRES@/${requires_key}/" "${target}" >/dev/null + echo "${changelog}" | tee -a "${target}" >/dev/null +} + +case "${1-}" in + ""|-h|--?help) usage; exit 1;; +esac + +command -v git >/dev/null || + { printf "Missing program: git\n" >&2; exit 1; } +cd "$(git rev-parse --show-toplevel)" + +spec_get="./scripts/spec-get.sh" + +for p in "$@"; do + gen_spec "${p}" +done diff --git a/scripts/spec-get.sh b/scripts/spec-get.sh new file mode 100755 index 0000000..4b4ea51 --- /dev/null +++ b/scripts/spec-get.sh @@ -0,0 +1,137 @@ +#!/bin/sh + +## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## +## SPDX-License-Identifier: AGPL-3.0-or-later + +# shellcheck disable=SC2034 +set -eu + +usage(){ + names="$(find salt/ -maxdepth 1 -type d | cut -d "/" -f2 | tr "\n" " ")" + echo "Usage: ${0##*/} " + echo "Example: ${0##*/} qubes-builder description" + echo "Names: ${names}" + echo "Keys: ${keys}" +} + +block_max_chars(){ + char_key="${1}" + char_value="${2}" + less_than="${3}" + if test "${#char_value}" -ge "${less_than}"; then + echo "Error: ${char_key} is too long. Must be less than ${less_than} chars." >&2 + echo "Key contents: ${char_value}" >&2 + exit 1 + fi +} + +keys="name branch group file_roots requires vendor url version project project_dir changelog readme license_csv license description summary saltfiles" + +case "${1-}" in + "") usage; exit 1;; + -h|--?help) usage; exit 0;; +esac +case "${2-}" in + "") usage; exit 1;; +esac + +command -v reuse >/dev/null || + { printf "Missing program: reuse\n" >&2; exit 1; } +command -v git >/dev/null || + { printf "Missing program: git\n" >&2; exit 1; } +cd "$(git rev-parse --show-toplevel)" || exit 1 + +name="${1}" +key="${2}" +branch="$(git branch --show-current)" +group="qusal" +block_max_chars group "${group}" 70 + +file_roots="/srv/salt/${group}" +vendor="Benjamin Grande" + +url="https://github.com/ben-grande/qusal" +version="1.0" + +project="${group}-${name}" +project_dir="salt/${name}" + +if ! test -d "${project_dir}"; then + echo "Project doesn't exist: ${project_dir}" >&2 + exit 1 +fi + +readme="${project_dir}/README.md" +if ! test -f "${readme}"; then + echo "Project ${name} does not have README.md" >&2 + exit 1 +fi + +license_csv="$(reuse --root "${project_dir}" lint | + awk -F ':' '/^* Used licenses:/{print $2}' | tr -d " ")" +license="$(echo "$license_csv" | sed "s/,/ AND /g")" +#license="$(reuse --root "${project_dir}" lint | +# awk -F ':' '/^* Used licenses:/{print $2}' | sed "s|, | AND |g")" + +## The problem with %autochangelog is that it will print logs of all projects +## and we separate a project per directory. +## The disadvantage of the changelog below is that it doesn't differentiate +## commits per package release. +changelog="$(TZ=UTC0 git log -n 50 --format=format:"* %cd %an <%ae> - %h%n- %s%n%n" --date=format:"%a %b %d %Y" -- "${project_dir}" | sed -re "s/^- +- */- /;/^$/d")" + +#block_max_chars license "${license}" 70 +description="$(sed -n '/^## Description/,/^## /p' "${readme}" | + sed '1d;$d' | sed "1{/^$/d}")" +summary="$(sed -n '3p' "${readme}")" +block_max_chars summary "${summary}" 70 + +saltfiles="$(find "${project_dir}" -maxdepth 1 -name "*.sls")" +# shellcheck disable=SC2086 +if test -n "${saltfiles}"; then + requires="$(sed -n '/^include:$/,/^\s*$/p' ${saltfiles} | sed "/^\s*- \./d;/{/d" | grep "^\s*- " | cut -d "." -f1 | sort -u | sed "s/- //")" + if grep -qrn "{%-\? from \('\|\"\)utils" ${saltfiles}; then + if test -n "${requires}"; then + requires="${requires} utils" + else + requires="utils" + fi + fi +else + requires="" +fi +requires_valid="" +for r in $(printf %s"${requires}" | tr " " "\n"); do + if ! test -d "salt/${r}"; then + continue + fi + requires_valid="${requires_valid} ${r}" +done +requires="${requires_valid}" +unset requires_valid + +if test -z "${key}" || test "$(echo "${key}" | sed "s/ //g")" = ""; then + echo "Key has no value: ${key}" >&2 + exit 1 +fi + +case "${key}" in + "") exit 1;; + branch) echo "${branch}";; + changelog) echo "${changelog}";; + description) echo "${description}";; + file_roots) echo "${file_roots}";; + group) echo "${group}";; + license_csv) echo "${license_csv}";; + license) echo "${license}";; + name) echo "${name}";; + project) echo "${project}";; + project_dir) echo "${project_dir}";; + readme) echo "${readme}";; + requires) echo "${requires}";; + saltfiles) echo "${saltfiles}";; + summary) echo "${summary}";; + url) echo "${url}";; + vendor) echo "${vendor}";; + version) echo "${version}";; +esac diff --git a/scripts/toc-gen.sh b/scripts/toc-gen.sh new file mode 100755 index 0000000..137f7e7 --- /dev/null +++ b/scripts/toc-gen.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## +## SPDX-License-Identifier: AGPL-3.0-or-later + +## Requires: https://github.com/mzlogin/vim-markdown-toc +set -eu + +usage(){ + echo "Usage: ${0##*/} [file ...]" + exit 1 +} + +case "${1-}" in + ""|-h|--help) usage;; +esac + +## vim-markdown-toc deletes lines if they are folded, can't rely on its native +## update on save. +if ! vim -e -c 'setf markdown' -c 'if !exists(":GenTocGFM") | cq | endif' -c q +then + echo "Error: Vim Plugin mzlogin/vim-markdown-toc is not installed." >&2 + exit 1 +fi + + +for f in "$@"; do + if ! test -f "$f"; then + echo "Error: Not a regular file: $f" >&2 + exit 1 + fi + if ! grep -q "^## Table of Contents$" "$f"; then + echo "Could not find table of contents in file: $f, skipping" >&2 + continue + fi + ## This is fragile, the table of contents should have at least one block + ## separated by an empty line before the nest heading, else it will delete + ## the rest of the file. + vim -c 'norm zRgg' -c '/^## Table of Contents$' -c 'norm jd}k' -c ':GenTocGFM' -c 'norm ddgg' -c wq -- "${f}" + echo "Updated TOC in file: $f" +done