refactor: move appended states to drop-in rc.local

This commit is contained in:
Ben Grande 2023-12-19 22:50:59 +01:00
parent 0751aff4b5
commit b4d142b640
38 changed files with 237 additions and 86 deletions

View File

@ -8,11 +8,12 @@ SPDX-License-Identifier: AGPL-3.0-or-later
"{{ slsdotpath }}-minion-start-sshd": "{{ slsdotpath }}-minion-start-sshd":
file.managed: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-ansible.rc
- source: salt://{{ slsdotpath }}/files/client/rc.local - source: salt://{{ slsdotpath }}/files/client/rc.local.d/50-ansible.rc
- mode: '0755' - mode: '0755'
- user: root - user: root
- group: root - group: root
- makedirs: True
"{{ slsdotpath }}-minion-ssh-authorized_keys": "{{ slsdotpath }}-minion-ssh-authorized_keys":
file.touch: file.touch:

View File

@ -8,11 +8,12 @@ SPDX-License-Identifier: AGPL-3.0-or-later
"{{ slsdotpath }}-autostart-ssh-over-qrexec": "{{ slsdotpath }}-autostart-ssh-over-qrexec":
file.managed: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-ansible.rc
- source: salt://{{ slsdotpath }}/files/server/rc.local - source: salt://{{ slsdotpath }}/files/server/rc.local.d/50-ansible.rc
- mode: '0755' - mode: '0755'
- user: root - user: root
- group: root - group: root
- makedirs: True
"{{ slsdotpath }}-ssh-config": "{{ slsdotpath }}-ssh-config":
file.managed: file.managed:

View File

@ -1,2 +0,0 @@
systemctl unmask ssh
systemctl --no-block start ssh

View File

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

View File

@ -1 +0,0 @@
qvm-connect-tcp 22000:@default:22

View File

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

View File

@ -7,11 +7,12 @@ SPDX-License-Identifier: AGPL-3.0-or-later
{% if grains['nodename'] != 'dom0' -%} {% if grains['nodename'] != 'dom0' -%}
"{{ slsdotpath }}-rc.local": "{{ slsdotpath }}-rc.local":
file.append: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-docker.rc
- text: | - source: salt://{{ slsdotpath }}/files/client/rc.local.d/50-docker.rc
usermod -aG docker user - mode: '0755'
systemctl unmask docker - user: root
systemctl --no-block restart docker - group: root
- makedirs: True
{% endif -%} {% endif -%}

View File

@ -0,0 +1,9 @@
#!/bin/sh
# vim: ft=sh
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
usermod -aG docker user
systemctl unmask docker
systemctl --no-block restart docker

View File

@ -31,16 +31,20 @@ include:
"{{ slsdotpath }}-executor-bind-dirs": "{{ slsdotpath }}-executor-bind-dirs":
file.managed: file.managed:
- name: /rw/config/qubes-bind-dirs.d/builder.conf - name: /rw/config/qubes-bind-dirs.d/50-qubes-builder.conf
- source: salt://{{ slsdotpath }}/files/server/builder.conf - source: salt://{{ slsdotpath }}/files/server/qubes-bind-dirs.d/50-qubes-builder.conf
- user: root - user: root
- group: root - group: root
- mode: '0644' - mode: '0644'
- makedirs: True - makedirs: True
"{{ slsdotpath }}-executor-rc.local": "{{ slsdotpath }}-executor-rc.local":
file.append: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-qubes-builder.rc
- text: "mount /builder -o dev,suid,remount" - source: salt://{{ slsdotpath }}/files/server/rc.local.d/50-qubes-builder.rc
- user: root
- group: root
- mode: '0755'
- makedirs: True
{% endif -%} {% endif -%}

View File

@ -1 +0,0 @@
mount /builder -o dev,suid,remount

View File

@ -0,0 +1,7 @@
#!/bin/sh
# vim: ft=sh
# SPDX-FileCopyrightText: 2023 The Qubes OS Project <https://www.qubes-os.org>
#
# SPDX-License-Identifier: GPL-2.0-only
mount /builder -o dev,suid,remount

View File

@ -7,9 +7,13 @@ SPDX-License-Identifier: AGPL-3.0-or-later
{% if grains['nodename'] != 'dom0' %} {% if grains['nodename'] != 'dom0' %}
"{{ slsdotpath }}-browser-rc.local": "{{ slsdotpath }}-browser-rc.local":
file.append: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-sys-cacher.rc
- text: "qvm-connect-tcp 8082:@default:8082" - source: salt://{{ slsdotpath }}/files/browser/rc.local.d/50-sys-cacher.rc
- mode: '0755'
- user: root
- group: root
- makedirs: True
"{{ slsdotpath }}-browser-desktop-application": "{{ slsdotpath }}-browser-desktop-application":
file.managed: file.managed:

View File

@ -10,24 +10,28 @@ include:
- dotfiles.copy-x11 - dotfiles.copy-x11
"{{ slsdotpath }}-install-rc.local": "{{ slsdotpath }}-install-rc.local":
file.append: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-sys-cacher.rc
- text: | - source: salt://{{ slsdotpath }}/files/server/rc.local.d/50-sys-cacher.rc
chown -R apt-cacher-ng:apt-cacher-ng /var/log/apt-cacher-ng - mode: '0755'
chown -R apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng - user: root
systemctl unmask qubes-apt-cacher-ng - group: root
systemctl --no-block restart qubes-apt-cacher-ng - makedirs: True
nft 'insert rule ip filter INPUT tcp dport 8082 counter accept'
"{{ slsdotpath }}-install-qubes-firewall-user-script": "{{ slsdotpath }}-install-qubes-firewall":
file.append: file.managed:
- name: /rw/config/qubes-firewall-user-script - name: /rw/config/qubes-firewall.d/50-sys-cacher
- text: nft 'insert rule ip filter INPUT tcp dport 8082 counter accept' - source: salt://{{ slsdotpath }}/files/server/qubes-firewall.d/50-sys-cacher
- mode: '0755'
- user: root
- group: root
- makedirs: True
"{{ slsdotpath }}-bind-dirs": "{{ slsdotpath }}-bind-dirs":
file.managed: file.managed:
- name: /rw/config/qubes-bind-dirs.d/50_cacher.conf - name: /rw/config/qubes-bind-dirs.d/50-sys-cacher.conf
- source: salt://{{ slsdotpath }}/files/server/bind-dirs/50_cacher.conf - source: salt://{{ slsdotpath }}/files/server/qubes-bind-dirs.d/50-sys-cacher.conf
- mode: '0644'
- user: root - user: root
- group: root - group: root
- makedirs: True - makedirs: True

View File

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

View File

@ -0,0 +1,9 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2023 unman <unman@thirdeyesecurity.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
binds+=( '/etc/anacrontab' )
# vim: ft=bash

View File

@ -0,0 +1,7 @@
#!/bin/sh
# vim: ft=sh
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
nft 'insert rule ip filter INPUT tcp dport 8082 counter accept'

View File

@ -0,0 +1,11 @@
#!/bin/sh
# vim: ft=sh
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
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 qubes-apt-cacher-ng
systemctl --no-block restart qubes-apt-cacher-ng
nft 'insert rule ip filter INPUT tcp dport 8082 counter accept'

View File

@ -87,10 +87,13 @@ SPDX-License-Identifier: AGPL-3.0-or-later
- user: root - user: root
- group: root - group: root
"{{ slsdotpath }}-qubes-bind-dirs": "{{ slsdotpath }}-lib-qubes-bind-dirs":
file.append: file.managed:
- name: /usr/lib/qubes-bind-dirs.d/30_cron.conf - name: /usr/lib/qubes-bind-dirs.d/50-sys-cacher.conf
- text: "binds+=( ' /etc/anacrontab' )" - source: salt://{{ slsdotpath }}/files/server/lib-qubes-bind-dirs.d/50-sys-cacher.conf
- mode: '0644'
- user: root
- group: root
"{{ slsdotpath }}-acng.conf": "{{ slsdotpath }}-acng.conf":
file.managed: file.managed:

View File

@ -7,10 +7,14 @@ SPDX-License-Identifier: AGPL-3.0-or-later
{% if grains['nodename'] != 'dom0' %} {% if grains['nodename'] != 'dom0' %}
"{{ slsdotpath }}-browser-rc.local": "{{ slsdotpath }}-browser-auto-tcp-connect":
file.append: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-sys-pihole.rc
- text: "qvm-connect-tcp 80:@default:80" - source: salt://{{ slsdotpath }}/files/browser/rc.local.d/50-sys-pihole.rc
- mode: '0755'
- user: root
- group: root
- makedirs: True
"{{ slsdotpath }}-browser-desktop-application": "{{ slsdotpath }}-browser-desktop-application":
file.managed: file.managed:

View File

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

View File

@ -9,9 +9,13 @@ include:
- dev.home-cleanup - dev.home-cleanup
"{{ slsdotpath }}-start-rsync-on-boot": "{{ slsdotpath }}-start-rsync-on-boot":
file.append: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-sys-rsync.rc
- source: salt://{{ slsdotpath }}/files/server/rc.local - source: salt://{{ slsdotpath }}/files/server/rc.local.d/50-sys-rsync.rc
- mode: '0755'
- user: root
- group: root
- makedirs: True
"{{ slsdotpath }}-creates-local-rsync-configuration-dir": "{{ slsdotpath }}-creates-local-rsync-configuration-dir":
file.directory: file.directory:

View File

@ -1,2 +0,0 @@
systemctl unmask rsync
systemctl --no-block restart rsync

View File

@ -0,0 +1,8 @@
#!/bin/sh
# vim: ft=sh
# SPDX-FileCopyrightText: 2022 unman <unman@thirdeyesecurity.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
systemctl unmask rsync
systemctl --no-block restart rsync

View File

@ -11,9 +11,13 @@ include:
- dev.home-cleanup - dev.home-cleanup
"{{ slsdotpath }}-start-ssh-on-boot": "{{ slsdotpath }}-start-ssh-on-boot":
file.append: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-sys-ssh.rc
- source: salt://{{ slsdotpath }}/files/server/rc.local - source: salt://{{ slsdotpath }}/files/server/rc.local.d/50-sys-ssh.rc
- mode: '0755'
- user: root
- group: root
- makedirs: True
"{{ slsdotpath }}-creates-home-ssh-dir": "{{ slsdotpath }}-creates-home-ssh-dir":
file.directory: file.directory:

View File

@ -1,2 +0,0 @@
systemctl unmask ssh
systemctl --no-block restart ssh

View File

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

View File

@ -5,8 +5,5 @@ SPDX-License-Identifier: AGPL-3.0-or-later
#} #}
"{{ slsdotpath }}-remove-service-from-rc.local": "{{ slsdotpath }}-remove-service-from-rc.local":
file.replace: file.absent:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-sys-syncthing.rc
- pattern: 'systemctl.*unmask.*syncthing@user.service'
- repl: ''
- backup: False

View File

@ -7,9 +7,14 @@ SPDX-License-Identifier: AGPL-3.0-or-later
{% if grains['nodename'] != 'dom0' %} {% if grains['nodename'] != 'dom0' %}
"{{ slsdotpath }}-browser-rc.local": "{{ slsdotpath }}-browser-rc.local":
file.append: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-sys-syncthing.rc
- text: "qvm-connect-tcp 8384:@default:8384" - source: salt://{{ slsdotpath }}/files/browser/rc.local.d/50-sys-syncthing.rc
- mode: '0755'
- user: root
- group: root
- makedirs: True
"{{ slsdotpath }}-browser-desktop-application": "{{ slsdotpath }}-browser-desktop-application":
file.managed: file.managed:

View File

@ -5,9 +5,11 @@ SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later SPDX-License-Identifier: AGPL-3.0-or-later
#} #}
"{{ slsdotpath }}-append-to-rc.local": "{{ slsdotpath }}-rc.local":
file.append: file.managed:
- name: /rw/config/rc.local - name: /rw/config/rc.local.d/50-sys-syncthing.rc
- text: | - source: salt://{{ slsdotpath }}/files/XXXXXXXXXXX/rc.local.d/50-sys-syncthing.rc
systemctl unmask syncthing@user.service - mode: '0755'
systemctl --no-block restart syncthing@user.service - user: root
- group: root
- makedirs: True

View File

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

View File

@ -0,0 +1,8 @@
#!/bin/sh
# vim: ft=sh
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
systemctl unmask syncthing@user.service
systemctl --no-block restart syncthing@user.service

View File

@ -14,37 +14,42 @@ SPDX-License-Identifier: AGPL-3.0-or-later
- makedirs: True - makedirs: True
"{{ slsdotpath }}-rc.local": "{{ 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: file.managed:
- name: /home/user/add-config.sh - name: /rw/config/rc.local.d/50-sys-wireguard.rc
- source: salt://{{ slsdotpath }}/files/server/add-config.sh - source: salt://{{ slsdotpath }}/files/server/rc.local.d/50-sys-wireguard.rc
- user: root
- group: root
- mode: '0755'
- makedirs: True
"{{ slsdotpath }}-wg-conf.sh":
file.managed:
- name: /home/user/wg-conf.sh
- source: salt://{{ slsdotpath }}/files/server/wg-conf.sh
- mode: '0755'
- user: user - user: user
- group: user - group: user
- mode: '0755' - makedirs: True
- replace: True
"{{ slsdotpath }}-qubes-firewall-user-script": "{{ slsdotpath }}-firewall-filter":
file.append: file.managed:
- name: /rw/config/qubes-firewall-user-script - name: /rw/config/qubes-firewall.d/60-sys-wireguard-filter
- text: - source: salt://{{ slsdotpath }}/files/server/qubes-firewall.d/60-sys-wireguard-filter
- nft insert rule filter FORWARD tcp flags syn tcp option maxseg size set rt mtu - mode: '0755'
- nft insert rule filter FORWARD oifname eth0 drop - user: root
- nft insert rule filter FORWARD iifname eth0 drop - group: root
- makedirs: True
"{{ slsdotpath }}-firewall-flush": "{{ slsdotpath }}-firewall-flush":
file.managed: file.managed:
- name: /rw/config/network-hooks.d/flush.sh - name: /rw/config/network-hooks.d/flush.sh
- source: salt://{{ slsdotpath }}/files/server/flush.sh - source: salt://{{ slsdotpath }}/files/server/flush.sh
- mode: '0755'
- user: root - user: root
- group: root - group: root
- makedirs: True - makedirs: True
- mode: '0755'
"{{ slsdotpath }}-set-firewall-flush-rules": "{{ slsdotpath }}-firewall-flush-rules":
file.managed: file.managed:
- name: /rw/config/network-hooks.d/flush - name: /rw/config/network-hooks.d/flush
- source: salt://{{ slsdotpath }}/files/server/flush - source: salt://{{ slsdotpath }}/files/server/flush

View File

@ -0,0 +1,10 @@
#!/usr/bin/nft -f
# SPDX-FileCopyrightText: 2022 unman <unman@thirdeyesecurity.org>
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
insert rule filter FORWARD tcp flags syn tcp option maxseg size set rt mtu
insert rule filter FORWARD oifname eth0 drop
insert rule filter FORWARD iifname eth0 drop

View File

@ -0,0 +1,7 @@
#!/bin/sh
# vim: ft=sh
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
wg-quick up /rw/config/vpn/wireguard.conf