Yest you
Aha
You yesah
This commit is contained in:
Ben Grande 2023-11-06 13:30:58 +00:00
parent ae6e79bcf4
commit d4687f6254
No known key found for this signature in database
GPG key ID: 00C64E14F51F9E56
25 changed files with 253 additions and 59 deletions

20
.editorconfig Normal file
View file

@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# 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
[**/git/**/config]
indent_style = tab
indent_size = 8
[*.{md,sh,yaml,yml,toml}]
indent_size = 2

5
.gitattributes vendored Normal file
View file

@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: CC0-1.0
* text=auto eol=lf

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
# vim: nospell
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com> # SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
# #
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0

41
.gitlint Normal file
View file

@ -0,0 +1,41 @@
# vim: ft=toml
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: CC0-1.0
[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,contrib-body-requires-signed-off-by,contrib-allowed-authors
[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

View file

@ -11,8 +11,25 @@ repos:
entry: scripts/salt-lint.sh entry: scripts/salt-lint.sh
language: script language: script
pass_filenames: false pass_filenames: false
description: Lint Salt files
- id: shellcheck - id: shellcheck
name: shellcheck name: shellcheck
entry: scripts/shell-lint.sh entry: scripts/shell-lint.sh
language: script language: script
pass_filenames: false pass_filenames: false
description: Lint Shellscripts
- id: gitlint
name: gitlint
language: python
additional_dependencies: ["./gitlint-core[trusted-deps]"]
entry: gitlint
args: [--staged, --msg-filename]
stages: [commit-msg]
description: Lint Git commits
- id: reuse
name: reuse
entry: reuse
args: ["lint"]
language: python
pass_filenames: false
description: Lint files to comply with the REUSE Specification

View file

@ -1,12 +0,0 @@
# SPDX-FileCopyrightText: 2020 Liferay, Inc. <https://liferay.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
---
- id: reuse
name: reuse
entry: reuse
args: ["lint"]
language: python
pass_filenames: false
description: "Lint the project for compliance with the REUSE Specification"

View file

@ -3,10 +3,14 @@ Upstream-Name: qusal
Upstream-Contact: Benjamin Grande M. S. <ben.grande.b@gmail.com> Upstream-Contact: Benjamin Grande M. S. <ben.grande.b@gmail.com>
Source: https://github.com/ben-grande/qusal Source: https://github.com/ben-grande/qusal
Files: README.md CONTRIBUTING.md */README.md Files: AUTHORS.md CONTRIBUTING.md README.md */README.md
Copyright: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com> Copyright: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
License: CC-BY-SA-4.0 License: CC-BY-SA-4.0
Files: */rc.local
Copyright: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
License: GPL-3.0-or-later
Files: qusal/sys-mirage-firewall/files/admin/mirage-firewall.tar.bz2 Files: qusal/sys-mirage-firewall/files/admin/mirage-firewall.tar.bz2
qusal/sys-mirage-firewall/files/admin/mirage-firewall.sha256 qusal/sys-mirage-firewall/files/admin/mirage-firewall.sha256
qusal/sys-mirage-firewall/files/admin/version.txt qusal/sys-mirage-firewall/files/admin/version.txt

25
.yamllint Normal file
View file

@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# 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

1
AUTHORS.md Normal file
View file

@ -0,0 +1 @@
Ben Grande <ben.grande.b@gmail.com>

View file

@ -1,7 +1,8 @@
# Contributing to Qusal # Contributing
## Table of Contents ## Table of Contents
* [Respect](#respect)
* [Format](#format) * [Format](#format)
* [File naming](#file-naming) * [File naming](#file-naming)
* [State ID](#state-id) * [State ID](#state-id)
@ -9,6 +10,10 @@
* [Qube naming](#qube-naming) * [Qube naming](#qube-naming)
* [Qrexec](#qrexec) * [Qrexec](#qrexec)
## Respect
Be respectful towards peers.
## Format ## Format
### File naming ### File naming
@ -35,7 +40,7 @@
Table of Contents, Description, Installation, Access Control (if changed Table of Contents, Description, Installation, Access Control (if changed
Qrexec policy), Usage. Qrexec policy), Usage.
### Qube naming ### Qube preferences
1. Qube name format: 1. Qube name format:
@ -46,24 +51,25 @@
- DispVM Template (AppVM): `dvm-NAME` - DispVM Template (AppVM): `dvm-NAME`
- Service qubes (not a class): `sys-NAME` - Service qubes (not a class): `sys-NAME`
2. Label/Color: 2. **Label/Color**:
- *Black* (Ultimately trusted): You must trust Dom0, Templates, Vaults, - **Black** (Ultimately trusted): You must trust Dom0, Templates, Vaults,
Management qubes, these qubes control your system and hold valuable Management qubes, these qubes control your system and hold valuable
information. Examples: dom0, tpl-ssh, vault, default-mgmt-dvm. information. Examples: dom0, tpl-ssh, vault, default-mgmt-dvm.
- *Gray* (Fully trusted): Trusted storage with extra RPC services that allow - **Gray** (Fully trusted): Trusted storage with extra RPC services that allow
certain operations to be made by the client and executed on the server or 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, may build components for other qubes. Examples: sys-cacher, sys-git,
sys-pgp, sys-ssh-agent, qubes-builder. sys-pgp, sys-ssh-agent, qubes-builder.
- *Purple* (Much trust): Has the ability to manager remote servers via - **Purple** (Much trust): Has the ability to manager remote servers via
encrypted connections and depend on authorization provided by another qube. encrypted connections and depend on authorization provided by another
qube.
Examples: ansible, dev, ssh, terraform. Examples: ansible, dev, ssh, terraform.
- *Blue* (Very trusted): TODO - **Blue** (Very trusted): TODO
- *Green* (Trusted): TODO - **Green** (Trusted): TODO
- *Yellow* (Relatively trusted): TODO - **Yellow** (Relatively trusted): TODO
- *Orange* (Slightly trusted): Controls the network flow of data to the - **Orange** (Slightly trusted): Controls the network flow of data to the
client, normally a firewall. Examples: sys-firewall, sys-vpn, sys-pihole. client, normally a firewall. Examples: sys-firewall, sys-vpn, sys-pihole.
- *Red* (Untrusted): Holds untrusted data (PCI devices, untrusted programs, - **Red** (Untrusted): Holds untrusted data (PCI devices, untrusted programs,
disposables for opening untrusted files or web pages). Examples: sys-net, disposables for opening untrusted files or web pages). Examples: sys-net,
sys-usb, dvm-browser. sys-usb, dvm-browser.

29
_modules/qvm_tags.py Normal file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env python3
## TOOD: test usability
# SPDX-FileCopyrightText: 2016 Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
# SPDX-FileCopyrightText: 2019 Brian C. Duggan <https://gist.github.com/bcduggan>
# SPDX-FileCopyrightText: 2023 Gonzalo Bulnes Guilpain <gon.bulnes@fastmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
admin_available = True
try:
import qubesadmin
import qubesadmin.vm
except ImportError:
admin_available = False
def __virtual__():
return admin_available
def ext_pillar(minion_id, pillar, *args, **kwargs):
app = qubesadmin.Qubes()
try:
vm = app.domains[minion_id]
except KeyError:
return {}
return {'qubes': { 'tags': list(vm.tags) } }

View file

@ -1,8 +1,2 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
systemctl unmask ssh systemctl unmask ssh
systemctl --no-block start ssh systemctl --no-block start ssh

View file

@ -1,7 +1 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
qvm-connect-tcp 22000:@default:22 qvm-connect-tcp 22000:@default:22

View file

@ -32,6 +32,12 @@ features:
- disable: - disable:
- service.cups - service.cups
- service.cups-browsed - service.cups-browsed
{% if salt['qvm.exists']('sys-cacher') %}
tags:
- add:
- sys-cacher-updatevm
{% endif %}
{% endif -%}
{%- endload %} {%- endload %}
{{ load(defaults) }} {{ load(defaults) }}

View file

@ -6,11 +6,11 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% if grains['nodename'] != 'dom0' -%} {% if grains['nodename'] != 'dom0' -%}
"{{ slsdotpath }}-updated-network": "{{ slsdotpath }}-updated-python-tools":
pkg.uptodate: pkg.uptodate:
- refresh: True - refresh: True
"{{ slsdotpath }}-installed-network": "{{ slsdotpath }}-installed-python-tools":
pkg.installed: pkg.installed:
- refresh: True - refresh: True
- install_recommends: False - install_recommends: False

View file

@ -17,7 +17,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
- skip_suggestions: True - skip_suggestions: True
- pkgs: - pkgs:
- python3-pip - python3-pip
- yamllint
- ansible-lint - ansible-lint
{% set pkg = { {% set pkg = {

View file

@ -7,6 +7,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% if grains['nodename'] != 'dom0' -%} {% if grains['nodename'] != 'dom0' -%}
include: include:
{%- if salt['qvm.exists']('sys-cacher') %}
- sys-cacher.install-client
{% endif %}
- .home-cleanup - .home-cleanup
- .install-python-tools - .install-python-tools
- .install-salt-tools - .install-salt-tools
@ -26,11 +29,13 @@ include:
- install_recommends: False - install_recommends: False
- skip_suggestions: True - skip_suggestions: True
- pkgs: - pkgs:
## Necessary
- qubes-core-agent-passwordless-root - qubes-core-agent-passwordless-root
- qubes-core-agent-networking - qubes-core-agent-networking
- ca-certificates - ca-certificates
- git - git
- gnupg2 - gnupg2
## Usability
- tmux - tmux
- xclip - xclip
- bash-completion - bash-completion
@ -38,11 +43,15 @@ include:
- texinfo - texinfo
- file - file
- tree - tree
- reuse
- pre-commit
- gitlint
- ripgrep - ripgrep
- fzf - fzf
## Lint
- pre-commit
- precious
- reuse
- gitlint
- pylint
- yamllint
{% set pkg = { {% set pkg = {
'Debian': { 'Debian': {

View file

@ -0,0 +1,58 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: GPL-3.0-or-later
#}
{% if grains['nodename'] != 'dom0' -%}
{% from 'utils/macros/install-repo.sls' import install_repo -%}
{{ install_repo(sls_path, 'docker') }}
"{{ 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 -%}

View file

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

View file

@ -1,5 +1 @@
# SPDX-FileCopyrightText: 2023 The Qubes OS Project <https://www.qubes-os.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
mount /builder -o dev,suid,remount mount /builder -o dev,suid,remount

View file

@ -42,3 +42,5 @@ The client qube can enhanced by being:
- sys-ssh-agent's client and not storing the SSH keys on the client; or - 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. - sys-git's client and fetching from qubes and push to remote servers.
The server requires the OpenSSH server to be installed.

View file

@ -1,6 +1,2 @@
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com
#
# SPDX-License-Identifier: GPL-3.0-or-later
systemctl unmask rsync systemctl unmask rsync
systemctl --no-block restart rsync systemctl --no-block restart rsync

View file

@ -86,7 +86,7 @@ all. Consult sys-ssh-agent documentation for more information.
In the client, create SSH keys and copy them to the server: In the client, create SSH keys and copy them to the server:
```sh ```sh
ssh-keygen -t ed25519 ssh-keygen -t ed25519
qvm-copy .ssh/id_ed25519.pub qvm-copy ~/.ssh/id_ed25519.pub
``` ```
On the server, create the SSH directory and copy the client key to the On the server, create the SSH directory and copy the client key to the

View file

@ -1,6 +1,2 @@
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com
#
# SPDX-License-Identifier: GPL-3.0-or-later
systemctl unmask ssh systemctl unmask ssh
systemctl --no-block restart ssh systemctl --no-block restart ssh

View file

@ -29,14 +29,14 @@ fi
case "${find_tool}" in case "${find_tool}" in
fd|fdfind) fd|fdfind)
# shellcheck disable=2016,2215 # shellcheck disable=2016,2215
files="$(${find_tool} . "${group}"/ --hidden --exclude=zsh --type=f \ files="$(${find_tool} . scripts/ "${group}"/ --hidden --exclude=zsh --type=f \
--exec sh -c ' --exec sh -c '
case $( file -bi "$1" ) in (*/x-shellscript*) case $( file -bi "$1" ) in (*/x-shellscript*)
printf "%s\n" "$1";; esac' sh)" printf "%s\n" "$1";; esac' sh)"
files="${files} $(${find_tool} . --max-depth=1 --type=f --extension=sh)" files="${files} $(${find_tool} . --max-depth=1 --type=f --extension=sh)"
;; ;;
find) find)
files="$(find "${group}"/ -not \( -path "*/zsh" -prune \) -type f -exec sh -c ' files="$(find scripts/ "${group}"/ -not \( -path "*/zsh" -prune \) -type f -exec sh -c '
case $( file -bi "$1" ) in (*/x-shellscript*) exit 0;; esac case $( file -bi "$1" ) in (*/x-shellscript*) exit 0;; esac
exit 1' sh {} \; -print)" exit 1' sh {} \; -print)"
files="${files} $(find . -maxdepth 1 -type f -name "*.sh")" files="${files} $(find . -maxdepth 1 -type f -name "*.sh")"