diff --git a/nixos/.sops.yaml b/nixos/.sops.yaml new file mode 100644 index 0000000..066253a --- /dev/null +++ b/nixos/.sops.yaml @@ -0,0 +1,19 @@ +# Who can decrypt what. A host decrypts with its SSH host key (converted +# with ssh-to-age); the admin key edits everything. +keys: + - &admin age19xvmm6j3h2u6mc3w6k65ufry4p5aa5lwu96p55h3e42p9wfzwc0qp2w7pk + - &asxpio_ops age1jxcl9cwk64wak2gyzf22vm3dpj80wtl76c7krywlrj7jjxftscrskrg3tf + - &asxpio_services age15ws8alg3ftsgmzvqxft09556g87s4n8c8v39nmvhaz6k50gp4e7se8acmg + # Throwaway servers: replace with the new host's key, then + # sops updatekeys secrets/rehearsal-*.yaml + - &rehearsal_ops age1hfaf7h2h43ahhql8zc6u3yr67yx4utnrlw57h6r32wnm4axvzves8pcl0r + - &rehearsal_services age1au6f8m6l245ddrunqf2a62xprnlevn9yrducynlay2tgknfxeeusj94j5l +creation_rules: + - path_regex: secrets/asxpio-ops\.yaml$ + key_groups: [{ age: [*admin, *asxpio_ops] }] + - path_regex: secrets/asxpio-services\.yaml$ + key_groups: [{ age: [*admin, *asxpio_services] }] + - path_regex: secrets/rehearsal-ops\.yaml$ + key_groups: [{ age: [*admin, *rehearsal_ops] }] + - path_regex: secrets/rehearsal-services\.yaml$ + key_groups: [{ age: [*admin, *rehearsal_services] }] diff --git a/nixos/flake.lock b/nixos/flake.lock new file mode 100644 index 0000000..4dab583 --- /dev/null +++ b/nixos/flake.lock @@ -0,0 +1,65 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1794552581, + "narHash": "sha256-qXFIqA6FCcx7XeDzw0ZNlkDT9UiCzrNDwK8RuU8RcHM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f1e5c356f35d07e7b71a6b5e6c9338e0b029e0c0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-26.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1794537146, + "narHash": "sha256-Wpz/7x/YWnDIBu7yj6ixe8j6fIMsidd9Y+o1PqPF3iM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d5cc6833999746cffdfe0598f7bc801a57b887a9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", + "sops-nix": "sops-nix" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1794624949, + "narHash": "sha256-3q/hxp/flW1PnV3Dx+H3p8kHGEHJ7251BqVMNsAAB9E=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "11e5885d241743ff0193465d533b20e754bc3ce0", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nixos/flake.nix b/nixos/flake.nix new file mode 100644 index 0000000..9e81552 --- /dev/null +++ b/nixos/flake.nix @@ -0,0 +1,75 @@ +{ + description = "asxp.io servers"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05"; + # For the few packages 26.05 has older than what production runs + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + sops-nix = { + url = "github:Mic92/sops-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + nixpkgs, + nixpkgs-unstable, + sops-nix, + ... + }: + let + mkHost = + modules: + nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs.unstable = nixpkgs-unstable.legacyPackages.x86_64-linux; + modules = [ + sops-nix.nixosModules.sops + ./modules/hetzner.nix + ./modules/base.nix + ./modules/podman.nix + ./modules/wireguard.nix + ./modules/alert.nix + ./modules/backup.nix + ] + ++ modules; + }; + in + { + # `nix develop ./nixos`: every tool the READMEs call + devShells.x86_64-linux.default = + let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + in + pkgs.mkShell { + packages = with pkgs; [ + opentofu + hcloud + nixos-rebuild + sops + ssh-to-age + age + restic + rclone + jq + ]; + }; + + nixosConfigurations = { + asxpio-ops = mkHost [ ./hosts/asxpio-ops ]; + asxpio-services = mkHost [ ./hosts/asxpio-services ]; + + # Both hosts on throwaway servers, with their own keys and + # addresses: everything is tried there first. + rehearsal-ops = mkHost [ + ./hosts/asxpio-ops + ./hosts/rehearsal/ops.nix + ]; + rehearsal-services = mkHost [ + ./hosts/asxpio-services + ./hosts/rehearsal/services.nix + ]; + }; + }; +} diff --git a/nixos/hosts/asxpio-ops/default.nix b/nixos/hosts/asxpio-ops/default.nix new file mode 100644 index 0000000..d9164dc --- /dev/null +++ b/nixos/hosts/asxpio-ops/default.nix @@ -0,0 +1,67 @@ +# asxpio-ops: Traefik, Forgejo, storage, the app stacks. +# Services are added here as they move over from ../../ansible (see +# MIGRATION.md at the repo root); until then this is the base system only. +{ lib, ... }: +{ + imports = [ + ./forgejo.nix + ./garage.nix + ./postgres.nix + ]; + + networking.hostName = lib.mkDefault "asxpio-ops"; + networking.domain = "asxp.io"; + system.stateVersion = "26.05"; + + systemd.network.networks."10-public".address = [ "2a01:4f9:c013:3258::1/64" ]; + + sops.defaultSopsFile = lib.mkDefault ../../secrets/asxpio-ops.yaml; + + # --- WireGuard hub ------------------------------------------------------- + asxpio.wireguard = { + interface = "wg0"; + address = [ + "10.20.0.10/24" + "fd69:69:69::1/64" + ]; + listenPort = 60101; + hub = true; + peers = lib.mkDefault ( + map + (p: { + inherit (p) name publicKey; + allowedIPs = [ + "10.20.0.${toString p.id}/32" + "fd69:69:69::${toString p.id}/128" + ]; + }) + [ + { id = 20; name = "asxpio-services"; publicKey = "I2D4RvGHm0bW2mMlq9lPvbINHvnP9MsZg4XGMKTLiSU="; } + { id = 2; name = "laptop"; publicKey = "6xYBPCiAa1MBusj7ilHGvwIoj26cXymvVksrOQLY52g="; } + { id = 3; name = "aleks"; publicKey = "Csqd94oo6eRLUrlzeEkFxlW2IZtQG61ASXdK+ZjKzGI="; } + { id = 4; name = "zerrtika"; publicKey = "uBRSmDuM25ciVaS9GxlCbjNPMUlmtphPDvtcEFzs8kI="; } + { id = 5; name = "sanya"; publicKey = "tegWIorm7PjagnixbzQjCGLqDKVImynLNgk/bfx2PEk="; } + ] + ); + }; + + swapDevices = [ + { + device = "/swapfile"; + size = 2048; + } + ]; + + # --- Backup --------------------------------------------------------------- + # Each service adds its own paths and hooks next to its definition: + # Postgres as a dump, Garage with a metadata snapshot, Forgejo's SQLite + # through the online backup API. + asxpio.backup = { + hostName = "asxpio-ops"; + schedule = "*-*-* 03:30:00"; + paths = [ + "/etc/ssh" # the host key decrypts this host's secrets + "/opt" + ]; + }; +} diff --git a/nixos/hosts/asxpio-ops/forgejo.nix b/nixos/hosts/asxpio-ops/forgejo.nix new file mode 100644 index 0000000..c1271ad --- /dev/null +++ b/nixos/hosts/asxpio-ops/forgejo.nix @@ -0,0 +1,131 @@ +# Forgejo at git.asxp.io (git.czsk.it is an alias), with its package +# registry and Actions. It runs as user git, so git@git.asxp.io reaches +# it through the host's sshd with no passthrough. +# +# State: /var/lib/forgejo (repositories/, data/forgejo.db, data/lfs, ...). +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.services.forgejo; + secret = name: config.sops.secrets."forgejo/${name}".path; +in +{ + sops.secrets = lib.genAttrs (map (n: "forgejo/${n}") [ + "secret_key" + "internal_token" + "jwt_secret" + "lfs_jwt_secret" + "smtp_user" + "smtp_password" + "metrics_token" + ]) (_: { owner = cfg.user; }); + + users.users.git = { + isSystemUser = true; + group = "git"; + home = cfg.stateDir; + useDefaultShell = true; + }; + users.groups.git = { }; + # Anyone may try a key against git; Forgejo decides what it may do + services.openssh.settings.AllowUsers = [ "git" ]; + + services.forgejo = { + enable = true; + package = pkgs.forgejo; # the current release, not the LTS: the data is from 17 + user = "git"; + group = "git"; + database.type = "sqlite3"; + lfs.enable = true; + + secrets = { + security.SECRET_KEY = lib.mkForce (secret "secret_key"); + security.INTERNAL_TOKEN = lib.mkForce (secret "internal_token"); + oauth2.JWT_SECRET = lib.mkForce (secret "jwt_secret"); + server.LFS_JWT_SECRET = lib.mkForce (secret "lfs_jwt_secret"); + mailer.USER = secret "smtp_user"; + mailer.PASSWD = secret "smtp_password"; + metrics.TOKEN = secret "metrics_token"; + }; + + settings = { + DEFAULT.APP_NAME = "Git with a cup of tea"; + server = { + DOMAIN = "git.asxp.io"; + ROOT_URL = "https://git.asxp.io/"; + HTTP_PORT = 3000; + SSH_DOMAIN = "git.asxp.io"; + SSH_PORT = 22; + LANDING_PAGE = "explore"; + }; + repository = { + DEFAULT_BRANCH = "main"; + DEFAULT_PRIVATE = "private"; + ENABLE_PUSH_CREATE_USER = true; + ENABLE_PUSH_CREATE_ORG = false; + DEFAULT_REPO_UNITS = "repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,repo.actions"; + }; + "repository.pull-request".DEFAULT_MERGE_STYLE = "merge"; + "repository.signing".DEFAULT_TRUST_MODEL = "collaborator"; + ui = { + THEMES = "forgejo-auto,forgejo-light,forgejo-dark,gitea-auto,gitea-light,gitea-dark"; + DEFAULT_THEME = "forgejo-auto"; + }; + security.PASSWORD_HASH_ALGO = "pbkdf2"; + service = { + DISABLE_REGISTRATION = true; + REQUIRE_SIGNIN_VIEW = false; + REGISTER_EMAIL_CONFIRM = false; + ENABLE_NOTIFY_MAIL = true; + DEFAULT_KEEP_EMAIL_PRIVATE = true; + DEFAULT_ALLOW_CREATE_ORGANIZATION = true; + DEFAULT_ENABLE_TIMETRACKING = true; + NO_REPLY_ADDRESS = "noreply.git.asxp.io"; + }; + oauth2.ENABLED = true; + mailer = { + ENABLED = lib.mkDefault true; + FROM = "Czechoslovakia Git "; + PROTOCOL = "smtp+starttls"; + SMTP_ADDR = "smtp.fastmail.com"; + SMTP_PORT = 587; + }; + session.PROVIDER = "file"; + log.LEVEL = "Info"; + actions = { + ENABLED = true; + DEFAULT_ACTIONS_URL = "https://github.com"; + ARTIFACT_RETENTION_DAYS = 365; + }; + packages.ENABLED = true; + other = { + SHOW_FOOTER_VERSION = false; + SHOW_FOOTER_TEMPLATE_LOAD_TIME = false; + SHOW_FOOTER_POWERED_BY = false; + }; + metrics.ENABLED = true; + }; + }; + asxpio.waitForData = [ + "forgejo" + "forgejo-secrets" + ]; + + # `forgejo-admin regenerate keys`, `forgejo-admin user list`, ... + environment.systemPackages = [ + (pkgs.writeShellScriptBin "forgejo-admin" '' + exec ${pkgs.util-linux}/bin/runuser -u ${cfg.user} -- env \ + HOME=${cfg.stateDir} FORGEJO_WORK_DIR=${cfg.stateDir} FORGEJO_CUSTOM=${cfg.customDir} \ + ${lib.getExe cfg.package} --config ${cfg.customDir}/conf/app.ini admin "$@" + '') + ]; + + asxpio.backup.paths = [ "/var/lib/forgejo" ]; + asxpio.backup.hooks = [ + ''sqlite3 /var/lib/forgejo/data/forgejo.db ".backup '$STAGE/forgejo.db'"'' + ]; +} diff --git a/nixos/hosts/asxpio-ops/garage.nix b/nixos/hosts/asxpio-ops/garage.nix new file mode 100644 index 0000000..4501f57 --- /dev/null +++ b/nixos/hosts/asxpio-ops/garage.nix @@ -0,0 +1,173 @@ +# Garage (S3) for the apps, single node. Buckets, keys and grants are set +# on every start from sops. +# +# asxpio-invoices asxpio rw +# datacenterbingo-photos asxpio rw, bingo ro +# public a website (anonymous reads through Traefik); +# asxpio and public-upload write only +# +# Garage only takes keys in its own format (GK + 24 hex, 64 hex). The +# apps' keys predate it and are hashed into that format, here and in each +# app's deploy workflow: keep the two in step. +{ + config, + lib, + pkgs, + ... +}: +let + garage = pkgs.garage_2; + rpcSecret = config.sops.secrets."garage/rpc_secret".path; + keys = [ + "asxpio" + "bingo" + "public" + ]; +in +{ + sops.secrets = { + "garage/rpc_secret" = { }; + } + // lib.listToAttrs ( + lib.concatMap (k: [ + (lib.nameValuePair "garage/${k}_access_key" { }) + (lib.nameValuePair "garage/${k}_secret_key" { }) + ]) keys + ); + + services.garage = { + enable = true; + package = garage; + # The RPC secret is a systemd credential: mode 0440, but in a + # directory only this service can enter + extraEnvironment.GARAGE_ALLOW_WORLD_READABLE_SECRETS = "true"; + settings = { + # One node and no replica to repair from, so prefer the engine that + # survives an unclean stop, sync writes, and keep metadata snapshots + db_engine = "sqlite"; + metadata_fsync = true; + data_fsync = true; + metadata_auto_snapshot_interval = "6h"; + replication_factor = 1; + + rpc_bind_addr = "[::]:3901"; + rpc_public_addr = "127.0.0.1:3901"; + rpc_secret_file = "/run/credentials/garage.service/rpc_secret"; + + # The apps sign for us-east-1, as they did against MinIO + s3_api = { + s3_region = "us-east-1"; + api_bind_addr = "[::]:3900"; + }; + # Anonymous reads: a bucket marked as a website is served here, + # picked by Host: .web.garage + s3_web = { + bind_addr = "[::]:3902"; + root_domain = ".web.garage"; + index = "index.html"; + }; + }; + }; + asxpio.waitForData = [ + "garage" + "garage-bootstrap" + ]; + systemd.services.garage = { + serviceConfig = { + LoadCredential = [ "rpc_secret:${rpcSecret}" ]; + ExecStart = lib.mkForce "${garage}/bin/garage server --single-node"; + }; + }; + networking.firewall.interfaces."podman*".allowedTCPPorts = [ 3900 ]; + + # `garage` for root, e.g. garage status, garage bucket list + environment.systemPackages = [ + (pkgs.writeShellScriptBin "garage" '' + export GARAGE_RPC_SECRET_FILE=${rpcSecret} + exec ${garage}/bin/garage -c /etc/garage.toml "$@" + '') + ]; + + systemd.services.garage-bootstrap = { + description = "Garage buckets, keys and grants"; + after = [ "garage.service" ]; + requires = [ "garage.service" ]; + wantedBy = [ "multi-user.target" ]; + path = [ + garage + pkgs.gnugrep + pkgs.coreutils + ]; + environment.GARAGE_RPC_SECRET_FILE = rpcSecret; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + script = '' + set -eu + g() { garage -c /etc/garage.toml "$@"; } + secret() { cat "/run/secrets/garage/$1"; } + + key_id() { + if printf '%s' "$1" | grep -Eq '^GK[0-9a-f]{24}$'; then printf '%s' "$1" + else printf 'GK%s' "$(printf '%s' "$1" | sha256sum | cut -c1-24)"; fi + } + key_secret() { + if printf '%s' "$1" | grep -Eq '^[0-9a-f]{64}$'; then printf '%s' "$1" + else printf '%s' "$1" | sha256sum | cut -c1-64; fi + } + + i=0 + until g status >/dev/null 2>&1; do + i=$((i + 1)) + [ "$i" -le 60 ] || { echo "garage did not come up" >&2; exit 1; } + sleep 1 + done + + ensure_bucket() { g bucket info "$1" >/dev/null 2>&1 || g bucket create "$1" >/dev/null; } + # ensure_key : prints the key id + ensure_key() { + id="$(key_id "$(secret "$2_access_key")")" + sec="$(key_secret "$(secret "$2_secret_key")")" + if g key info --show-secret "$id" >/dev/null 2>&1; then + if ! g key info --show-secret "$id" | grep -q "$sec"; then + g key delete --yes "$id" >/dev/null + g key import --yes -n "$1" "$id" "$sec" >/dev/null + fi + else + g key import --yes -n "$1" "$id" "$sec" >/dev/null + fi + printf '%s' "$id" + } + grant() { + case "$3" in + rw) g bucket allow --read --write "$1" --key "$2" >/dev/null + g bucket deny --owner "$1" --key "$2" >/dev/null ;; + ro) g bucket allow --read "$1" --key "$2" >/dev/null + g bucket deny --write --owner "$1" --key "$2" >/dev/null ;; + wo) g bucket allow --write "$1" --key "$2" >/dev/null + g bucket deny --read --owner "$1" --key "$2" >/dev/null ;; + esac + } + + ensure_bucket asxpio-invoices + ensure_bucket datacenterbingo-photos + ensure_bucket public + g bucket website --allow public >/dev/null + + asxpio="$(ensure_key asxpio asxpio)" + grant asxpio-invoices "$asxpio" rw + grant datacenterbingo-photos "$asxpio" rw + grant public "$asxpio" wo + + bingo="$(ensure_key bingo bingo)" + grant datacenterbingo-photos "$bingo" ro + + uploader="$(ensure_key public-upload public)" + grant public "$uploader" wo + ''; + }; + + asxpio.backup.paths = [ "/var/lib/garage" ]; + asxpio.backup.hooks = [ "/run/current-system/sw/bin/garage meta snapshot --all" ]; +} diff --git a/nixos/hosts/asxpio-ops/postgres.nix b/nixos/hosts/asxpio-ops/postgres.nix new file mode 100644 index 0000000..558aee6 --- /dev/null +++ b/nixos/hosts/asxpio-ops/postgres.nix @@ -0,0 +1,99 @@ +# Postgres for the apps. Roles and grants are set on every start from +# sops, so a password is changed by changing the secret. +# +# asxpio owns database asxpio (site, invoices, datacenter bingo admin) +# bingo read-only on the bingo tables, for datacenterbingo.xyz +{ + config, + lib, + pkgs, + ... +}: +let + pg = config.services.postgresql.package; +in +{ + sops.secrets."postgres/asxpio_password" = { }; + sops.secrets."postgres/bingo_password" = { }; + + services.postgresql = { + enable = true; + package = pkgs.postgresql_18; + # App containers connect from Podman's networks; the firewall decides + # who reaches the port + enableTCPIP = true; + authentication = '' + host all all 10.88.0.0/16 scram-sha-256 + host all all 10.89.0.0/16 scram-sha-256 + ''; + }; + networking.firewall.interfaces."podman*".allowedTCPPorts = [ 5432 ]; + + asxpio.waitForData = [ + "postgresql" + "postgresql-setup" + "postgres-roles" + ]; + + systemd.services.postgres-roles = { + description = "Postgres roles, databases and grants"; + after = [ "postgresql.target" ]; + requires = [ "postgresql.target" ]; + wantedBy = [ "multi-user.target" ]; + path = [ pg ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + User = "postgres"; + LoadCredential = [ + "asxpio:${config.sops.secrets."postgres/asxpio_password".path}" + "bingo:${config.sops.secrets."postgres/bingo_password".path}" + ]; + }; + script = '' + set -eu + role() { + psql -v ON_ERROR_STOP=1 -v role="$1" -v pw="$(cat "$CREDENTIALS_DIRECTORY/$1")" <<'SQL' + SELECT format('CREATE ROLE %I LOGIN', :'role') + WHERE NOT EXISTS (SELECT FROM pg_roles WHERE rolname = :'role') \gexec + SELECT format('ALTER ROLE %I WITH LOGIN PASSWORD %L', :'role', :'pw') \gexec + SQL + } + role asxpio + role bingo + + psql -tAc "SELECT 1 FROM pg_database WHERE datname = 'asxpio'" | grep -q 1 \ + || psql -c 'CREATE DATABASE asxpio OWNER asxpio' + psql -d asxpio -c 'CREATE EXTENSION IF NOT EXISTS citext' + + # Tables that do not exist yet (fresh install, asxpio not migrated) + # are granted on the next start + psql -c 'ALTER ROLE bingo SET default_transaction_read_only = on' + psql -d asxpio -v ON_ERROR_STOP=1 <<'SQL' + GRANT CONNECT ON DATABASE asxpio TO bingo; + GRANT USAGE ON SCHEMA public TO bingo; + DO $$ + DECLARE t text; + BEGIN + FOREACH t IN ARRAY ARRAY['bingo_datacenters', 'bingo_incidents', 'bingo_monitor_targets', + 'bingo_monitor_samples', 'bingo_monitor_buckets'] LOOP + IF to_regclass('public.' || t) IS NOT NULL THEN + EXECUTE format('GRANT SELECT ON public.%I TO bingo', t); + ELSE + RAISE NOTICE 'bingo: % missing, not granted yet', t; + END IF; + END LOOP; + END $$; + SQL + ''; + }; + + asxpio.backup.hookPackages = [ + pg + pkgs.util-linux + ]; + asxpio.backup.hooks = [ + ''runuser -u postgres -- pg_dumpall > "$STAGE/pg_dumpall.sql"'' + ''runuser -u postgres -- pg_dump -Fc asxpio > "$STAGE/asxpio.dump"'' + ]; +} diff --git a/nixos/hosts/asxpio-services/acme-forward.nix b/nixos/hosts/asxpio-services/acme-forward.nix new file mode 100644 index 0000000..a46c250 --- /dev/null +++ b/nixos/hosts/asxpio-services/acme-forward.nix @@ -0,0 +1,20 @@ +# Let's Encrypt validates xmpp.asxp.io on this host's port 80, but the +# certificates are requested by Traefik on asxpio-ops: pass the +# challenges on, answer nothing else. +{ ... }: +{ + services.nginx = { + enable = true; + serverTokens = false; + virtualHosts.acme-forward = { + default = true; + extraConfig = "access_log off;"; + locations."/.well-known/acme-challenge/" = { + proxyPass = "http://10.10.0.10"; + extraConfig = "proxy_set_header Host $host;"; + }; + locations."/".return = "404"; + }; + }; + networking.firewall.allowedTCPPorts = [ 80 ]; +} diff --git a/nixos/hosts/asxpio-services/default.nix b/nixos/hosts/asxpio-services/default.nix new file mode 100644 index 0000000..1b3ec53 --- /dev/null +++ b/nixos/hosts/asxpio-services/default.nix @@ -0,0 +1,71 @@ +# asxpio-services: CI runners, Minecraft, XMPP, Xray, SillyTavern. +# Services are added here as they move over from ../../ansible (see +# MIGRATION.md at the repo root); until then this is the base system only. +{ lib, ... }: +{ + imports = [ + ./acme-forward.nix + ./minecraft.nix + ./sillytavern.nix + ./xmpp.nix + ./xray.nix + ]; + + asxpio.publicIPv4 = lib.mkDefault "46.62.228.216"; + + networking.hostName = lib.mkDefault "asxpio-services"; + networking.domain = "asxp.io"; + system.stateVersion = "26.05"; + + systemd.network.networks."10-public".address = [ "2a01:4f9:c013:8269::1/64" ]; + # No swap, by choice + + sops.defaultSopsFile = lib.mkDefault ../../secrets/asxpio-services.yaml; + + # --- WireGuard spoke of asxpio-ops --------------------------------------- + asxpio.wireguard = { + interface = "asxpio-services"; + address = [ + "10.20.0.20/32" + "fd69:69:69::20/128" + ]; + listenPort = 52820; + peers = lib.mkDefault [ + { + name = "asxpio-ops"; + publicKey = "0gRrNiV4FjP6ipczZCRD3dsnK7k7rl6IyjG84fPaJB4="; + endpoint = "135.181.27.77:60101"; + allowedIPs = [ + "10.20.0.0/24" + "fd69:69:69::/64" + ]; + } + ]; + }; + + # --- Backup --------------------------------------------------------------- + # ejabberd's Mnesia through its own backup command, its SQLite through + # the online backup API. The Paper world is copied live (RCON is off, so + # there is no save-off); its autosave keeps that close enough. + asxpio.backup = { + hostName = "asxpio-services"; + schedule = "*-*-* 04:15:00"; + paths = [ + "/etc/ssh" # the host key decrypts this host's secrets + "/opt" + "/var/lib/minecraft" + "/var/lib/SillyTavern" + "/var/lib/containers/storage/volumes/xmpp_database" + "/var/lib/containers/storage/volumes/xmpp_tackygram" + ]; + excludes = [ + "/var/lib/minecraft/cache" + "/var/lib/minecraft/libraries" + "/var/lib/minecraft/versions" + ]; + hooks = [ + "podman exec xmpp-ejabberd ejabberdctl backup /opt/ejabberd/database/nightly.backup" + ''sqlite3 /var/lib/containers/storage/volumes/xmpp_database/_data/ejabberd.sqlite ".backup '$STAGE/ejabberd.sqlite'"'' + ]; + }; +} diff --git a/nixos/hosts/asxpio-services/minecraft.nix b/nixos/hosts/asxpio-services/minecraft.nix new file mode 100644 index 0000000..ed7641c --- /dev/null +++ b/nixos/hosts/asxpio-services/minecraft.nix @@ -0,0 +1,33 @@ +# Paper. The world, plugins and server.properties are data in +# /var/lib/minecraft and not managed here; Geyser (a plugin) adds the +# Bedrock port. +{ lib, pkgs, ... }: +{ + services.minecraft-server = { + enable = true; + eula = true; + package = pkgs.papermc; + jvmOpts = "-Xmx4G -Xms2G"; + }; + asxpio.waitForData = [ "minecraft-server" ]; + systemd.services.minecraft-server = { + # Stopping saves the world first + serviceConfig.TimeoutStopSec = 120; + # Geyser lists the network interfaces (netlink) for Bedrock's + # signalling; the module allows IP sockets only + serviceConfig.RestrictAddressFamilies = lib.mkForce [ + "AF_INET" + "AF_INET6" + "AF_UNIX" + "AF_NETLINK" + ]; + # Geyser unpacks native libraries that expect a usual Linux around + # them (libcrypto, libstdc++) + environment.LD_LIBRARY_PATH = lib.makeLibraryPath [ + pkgs.openssl + pkgs.stdenv.cc.cc.lib + ]; + }; + networking.firewall.allowedTCPPorts = [ 25565 ]; + networking.firewall.allowedUDPPorts = [ 19132 ]; +} diff --git a/nixos/hosts/asxpio-services/sillytavern.nix b/nixos/hosts/asxpio-services/sillytavern.nix new file mode 100644 index 0000000..3f47cfc --- /dev/null +++ b/nixos/hosts/asxpio-services/sillytavern.nix @@ -0,0 +1,18 @@ +# SillyTavern, on the WireGuard address only. State: /var/lib/SillyTavern +# (data/, extensions/). +{ config, unstable, ... }: +{ + services.sillytavern = { + enable = true; + package = unstable.sillytavern; # 26.05 has 1.18, the data is from 1.19 + configFile = "${./sillytavern.yaml}"; + # Port 8000, the WireGuard address and the whitelist (WireGuard only) + # are in the config file; the module's flags do not reach the server + }; + asxpio.waitForData = [ "sillytavern" ]; + systemd.services.sillytavern = { + after = [ "wireguard-${config.asxpio.wireguard.interface}.service" ]; + wants = [ "wireguard-${config.asxpio.wireguard.interface}.service" ]; + serviceConfig.RestartSec = 5; + }; +} diff --git a/nixos/hosts/asxpio-services/sillytavern.yaml b/nixos/hosts/asxpio-services/sillytavern.yaml new file mode 100644 index 0000000..cbfa42b --- /dev/null +++ b/nixos/hosts/asxpio-services/sillytavern.yaml @@ -0,0 +1,171 @@ +dataRoot: ./data +# Bound to the WireGuard address (in Docker this was the published port) +listen: true +listenAddress: + ipv4: 10.20.0.20 + ipv6: "[::]" +protocol: + ipv4: true + ipv6: false +dnsPreferIPv6: false +browserLaunch: + enabled: false + browser: default + hostname: auto + port: -1 + avoidLocalhost: false +port: 8000 +ssl: + enabled: false + certPath: ./certs/cert.pem + keyPath: ./certs/privkey.pem + keyPassphrase: "" +whitelistMode: true +enableForwardedWhitelist: true +whitelist: + - ::1 + - 127.0.0.1 + - 10.20.0.0/24 +whitelistDockerHosts: true +basicAuthMode: false +basicAuthUser: + username: user + password: password +enableCorsProxy: false +requestProxy: + enabled: false + url: socks5://username:password@example.com:1080 + bypass: + - localhost + - 127.0.0.1 +enableUserAccounts: true +enableDiscreetLogin: false +perUserBasicAuth: false +sso: + autheliaAuth: false + authentikAuth: false + trustedProxies: + - ::1 + - 127.0.0.1 +hostWhitelist: + enabled: false + scan: true + hosts: [] +sessionTimeout: -1 +disableCsrfProtection: false +securityOverride: false +logging: + enableAccessLog: true + minLogLevel: 0 +rateLimiting: + preferRealIpHeader: false + basicAuthMaxAttempts: 5 + accountsLoginMaxAttempts: 5 + accountsRecoverMaxAttempts: 5 + accountsResetMaxAttempts: 5 +backups: + common: + numberOfBackups: 50 + chat: + enabled: true + checkIntegrity: true + maxTotalBackups: -1 + throttleInterval: 10000 + allowFullDataBackup: true +thumbnails: + enabled: true + format: jpg + quality: 95 + dimensions: + bg: + - 160 + - 90 + avatar: + - 96 + - 144 + persona: + - 96 + - 144 +performance: + lazyLoadCharacters: false + memoryCacheCapacity: 100mb + useDiskCache: true + requestCompression: + enabled: false + minPayloadSize: 256kb + maxPayloadSize: 8mb + timeout: 4000 +cacheBuster: + enabled: false + userAgentPattern: "" +allowKeysExposure: false +skipContentCheck: false +whitelistImportDomains: + - localhost + - cdn.discordapp.com + - files.catbox.moe + - raw.githubusercontent.com + - char-archive.evulid.cc +requestOverrides: [] +extensions: + enabled: true + autoUpdate: true + models: + autoDownload: true + classification: Cohee/distilbert-base-uncased-go-emotions-onnx + captioning: Xenova/vit-gpt2-image-captioning + embedding: Cohee/jina-embeddings-v2-base-en + speechToText: Xenova/whisper-small + textToSpeech: Xenova/speecht5_tts +enableDownloadableTokenizers: true +promptPlaceholder: "[Start a new chat]" +openai: + randomizeUserId: false + captionSystemPrompt: "" +deepl: + formality: default +mistral: + enablePrefix: false +ollama: + keepAlive: -1 + batchSize: -1 +claude: + enableSystemPromptCache: false + cachingAtDepth: -1 + extendedTTL: false + enableAdaptiveThinking: false +gemini: + apiVersion: v1beta + thoughtSignatures: true + enableSystemPromptCache: false + image: + personGeneration: allow_adult +enableServerPlugins: false +enableServerPluginsAutoUpdate: true +heartbeatInterval: 0 +enableKeepAlive: false +cors: + enabled: true + origin: + - "null" + methods: + - OPTIONS + allowedHeaders: [] + exposedHeaders: [] + credentials: false + maxAge: null +privateAddressWhitelist: + enabled: false + allowUnresolvedHosts: false + log: + blockedRequests: true + allowedRequests: false + allowedRanges: + - 127.0.0.0/8 + - ::1/128 +forwardedHeaders: + xRealIp: true + xForwardedFor: true + cfConnectingIp: false +git: + backend: auto diff --git a/nixos/hosts/asxpio-services/xmpp.nix b/nixos/hosts/asxpio-services/xmpp.nix new file mode 100644 index 0000000..60d9ab9 --- /dev/null +++ b/nixos/hosts/asxpio-services/xmpp.nix @@ -0,0 +1,100 @@ +# XMPP for asxp.io: another.im's ejabberd build, its push server and the +# Telegram gateway. A custom image, so containers; the two helpers share +# ejabberd's network namespace and reach its component port on 127.0.0.1. +# +# /opt/xmpp/state (secrets.env, certs/, apushd/, tackygram/) is host data: +# generated once, backed up, not in this repo. Certificates arrive there +# from asxpio-ops (xmpp-cert-sync). +{ config, lib, ... }: +let + # renovate: datasource=docker depName=dev.another.im/another-im/anotherim-server + ejabberd = "dev.another.im/another-im/anotherim-server:2026.11.07"; + # renovate: datasource=docker depName=dev.another.im/another-im/apushd + apushd = "dev.another.im/another-im/apushd:0.2"; + # renovate: datasource=docker depName=dev.another.im/another-im/tackygram + tackygram = "dev.another.im/another-im/tackygram:0.4.3"; + + callPorts = "50000-50099"; + state = "/opt/xmpp/state"; + helper = { + dependsOn = [ "xmpp-ejabberd" ]; + extraOptions = [ "--network=container:xmpp-ejabberd" ]; + }; +in +{ + options.asxpio.publicIPv4 = lib.mkOption { type = lib.types.str; }; + + config = { + virtualisation.oci-containers.containers = { + xmpp-ejabberd = { + image = ejabberd; + environment = { + EJABBERD_MACRO_XMPP_DOMAIN = "asxp.io"; + EJABBERD_MACRO_TURN_IP = config.asxpio.publicIPv4; + EJABBERD_MACRO_POW_DIFFICULTY = "6"; + EJABBERD_MACRO_REGISTRATION_TIMEOUT = "600"; + EJABBERD_MACRO_UPLOAD_URL = "https://hel1.your-objectstorage.com/asxpio-xmpp-public/"; + EJABBERD_MACRO_ACME_URL = "https://acme-v02.api.letsencrypt.org/directory"; + }; + environmentFiles = [ "${state}/secrets.env" ]; + ports = [ + "5222:5222" # clients, STARTTLS + "5223:5223" # clients, direct TLS + "5269:5269" # other servers + "5443:5443" # WebSocket, host-meta + "8448:8448" # Matrix federation + "3478:3478/udp" # STUN and TURN + "3478:3478/tcp" + "49160-49199:49160-49199/udp" # TURN relay + "7777:7777" # SOCKS5 bytestreams proxy + "${callPorts}:${callPorts}/udp" # gateway calls + ]; + volumes = [ + "xmpp_database:/opt/ejabberd/database" + "xmpp_logs:/opt/ejabberd/logs" + "${state}/certs:/opt/ejabberd/conf/certs:ro" + ]; + }; + + xmpp-apushd = helper // { + image = apushd; + volumes = [ "${state}/apushd:/etc/apushd:ro" ]; + }; + + xmpp-tackygram = helper // { + image = tackygram; + environment = { + CREDENTIALS_DIRECTORY = "/run/credentials"; + TACKYGRAM_CALL_IP = config.asxpio.publicIPv4; + TACKYGRAM_CALL_PORTS = callPorts; + }; + environmentFiles = [ "${state}/tackygram/env" ]; + volumes = [ + "xmpp_tackygram:/var/lib/tackygram" + "${state}/tackygram/key:/run/credentials/gateway-key:ro" + ]; + }; + }; + + asxpio.waitForData = [ + "podman-xmpp-ejabberd" + "podman-xmpp-apushd" + "podman-xmpp-tackygram" + ]; + + networking.firewall.allowedTCPPorts = [ + 5222 + 5223 + 5269 + 5443 + 8448 + 3478 + 7777 + ]; + networking.firewall.allowedUDPPorts = [ 3478 ]; + networking.firewall.allowedUDPPortRanges = [ + { from = 49160; to = 49199; } + { from = 50000; to = 50099; } + ]; + }; +} diff --git a/nixos/hosts/asxpio-services/xray.nix b/nixos/hosts/asxpio-services/xray.nix new file mode 100644 index 0000000..4461de9 --- /dev/null +++ b/nixos/hosts/asxpio-services/xray.nix @@ -0,0 +1,13 @@ +# Xray VLESS Reality on :443. The whole config is a secret (keys, UUIDs). +{ config, unstable, ... }: +{ + sops.secrets."xray/config" = { }; + + services.xray = { + enable = true; + package = unstable.xray; # 26.05 has 26.3, production runs 26.11 + settingsFile = config.sops.secrets."xray/config".path; + }; + systemd.services.xray.restartTriggers = [ config.sops.secrets."xray/config".sopsFile ]; + networking.firewall.allowedTCPPorts = [ 443 ]; +} diff --git a/nixos/hosts/rehearsal/ops.nix b/nixos/hosts/rehearsal/ops.nix new file mode 100644 index 0000000..ac36d2f --- /dev/null +++ b/nixos/hosts/rehearsal/ops.nix @@ -0,0 +1,45 @@ +# asxpio-ops on a throwaway server: the same system with its own keys, +# its own addresses and SSH open to the world. Pairs with ./services.nix +# on a private network with the production addresses (10.10.0.10/.20). +{ lib, ... }: +{ + networking.hostName = "rehearsal-ops"; + sops.defaultSopsFile = ../../secrets/rehearsal-ops.yaml; + asxpio.sshFrom = [ "*" ]; + + # Same script and schedule, into repositories on its own disk + asxpio.backup.repositories = lib.mkForce { + hel1 = "/var/backups/test-repo-hel1"; + fsn1 = "/var/backups/test-repo-fsn1"; + }; + systemd.network.networks."10-public".address = lib.mkForce [ "2a01:4f9:c015:f949::1/64" ]; + + # A restored copy of production must not mail anyone, sync mirrors or + # call webhooks + services.forgejo.settings = { + mailer.ENABLED = false; + service.ENABLE_NOTIFY_MAIL = lib.mkForce false; + mirror.ENABLED = false; + webhook.ALLOWED_HOST_LIST = "loopback"; + "cron.update_mirrors".ENABLED = false; + }; + + asxpio.wireguard.peers = [ + { + name = "asxpio-services"; + publicKey = "DwCNEfzgV1fU2ZPwEwkxun/s8vMZYrzdp74ZDrrSTD4="; + allowedIPs = [ + "10.20.0.20/32" + "fd69:69:69::20/128" + ]; + } + { + name = "laptop"; + publicKey = "iTY+NChSd8pcm/vke8s8EqsxjwEJpBEc07PfEg1Q0zQ="; + allowedIPs = [ + "10.20.0.2/32" + "fd69:69:69::2/128" + ]; + } + ]; +} diff --git a/nixos/hosts/rehearsal/services.nix b/nixos/hosts/rehearsal/services.nix new file mode 100644 index 0000000..a4755be --- /dev/null +++ b/nixos/hosts/rehearsal/services.nix @@ -0,0 +1,51 @@ +# asxpio-services on a throwaway server; see ./ops.nix. +{ lib, ... }: +{ + networking.hostName = "rehearsal-services"; + sops.defaultSopsFile = ../../secrets/rehearsal-services.yaml; + asxpio.sshFrom = [ "*" ]; + + # Same script and schedule, into repositories on its own disk + asxpio.backup.repositories = lib.mkForce { + hel1 = "/var/backups/test-repo-hel1"; + fsn1 = "/var/backups/test-repo-fsn1"; + }; + systemd.network.networks."10-public".address = lib.mkForce [ "2a01:4f9:c01d:6f9::1/64" ]; + + asxpio.publicIPv4 = "2.29.197.9"; + + # A 4 GB server + services.minecraft-server.jvmOpts = lib.mkForce "-Xmx2G -Xms1G"; + + # A restored world brings its plugins and their credentials along. + # Those that talk to the outside (the Discord bot logs in with the + # production token and edits the real server's slash commands) are + # put aside before every start. + systemd.services.minecraft-server.preStart = lib.mkBefore '' + mkdir -p plugins/disabled-on-rehearsal + for p in DiscordSRV ServerBackup AutoUpdateGeyser; do + for f in plugins/$p*.jar; do + [ ! -e "$f" ] || mv "$f" plugins/disabled-on-rehearsal/ + done + done + ''; + + # With production data restored these would act as production: a second + # asxp.io XMPP server and Telegram session. Start them by hand, and + # only with test data. + virtualisation.oci-containers.containers = lib.genAttrs [ "xmpp-ejabberd" "xmpp-apushd" "xmpp-tackygram" ] (_: { + autoStart = false; + }); + + asxpio.wireguard.peers = [ + { + name = "asxpio-ops"; + publicKey = "Zuufncq9a9UZGvgRBjattzuoomJtWREjFeoB0POt620="; + endpoint = "62.238.40.174:60101"; # rehearsal-ops + allowedIPs = [ + "10.20.0.0/24" + "fd69:69:69::/64" + ]; + } + ]; +} diff --git a/nixos/migration/ops-data.sh b/nixos/migration/ops-data.sh new file mode 100755 index 0000000..4c5f602 --- /dev/null +++ b/nixos/migration/ops-data.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# asxpio-ops: move the data of the Debian/Docker layout to where the +# NixOS services keep it, then let them start. +# +# ops-data.sh +# +# is /old-root after an in-place conversion (the dumps then +# come from the last thing done before it: `restic-backup run`, which +# leaves nothing behind, so take them by hand into +# /var/backups/restic-stage), or the target of a restic restore. +# Moves within one filesystem, so it is quick; run it once, as root, on a +# host whose services are still waiting for /var/lib/.data-in-place. +set -euo pipefail + +src=${1:?usage: ops-data.sh } +stage=$src/var/backups/restic-stage +[ ! -e /var/lib/.data-in-place ] || { echo "services already have data (/var/lib/.data-in-place exists)" >&2; exit 1; } +for f in "$stage/pg_dumpall.sql" "$stage/forgejo-gitea.db" "$src/opt/forgejo/data/git/repositories"; do + [ -e "$f" ] || { echo "missing: $f" >&2; exit 1; } +done + +echo "== Forgejo" +fj=/var/lib/forgejo +install -d -o git -g git -m 750 $fj $fj/data $fj/custom +mv "$src/opt/forgejo/data/git/repositories" $fj/repositories +mv "$src/opt/forgejo/data/git/lfs" $fj/data/lfs +for d in "$src"/opt/forgejo/data/gitea/data/*; do + case "$(basename "$d")" in + home | ssh | tmp | sessions | queues | indexers) ;; # rebuilt, or the container's own + *) mv "$d" $fj/data/ ;; + esac +done +[ ! -d "$src/opt/forgejo/data/gitea/public" ] || mv "$src/opt/forgejo/data/gitea/public" $fj/custom/public +# The online copy taken by the backup hook, not the live file +cp "$stage/forgejo-gitea.db" $fj/data/forgejo.db +chown -R git:git $fj + +echo "== Garage" +install -d -m 700 /var/lib/garage +mv "$src/var/lib/docker/volumes/storage_garage_meta/_data" /var/lib/garage/meta +mv "$src/var/lib/docker/volumes/storage_garage_data/_data" /var/lib/garage/data + +echo "== Starting" +touch /var/lib/.data-in-place +systemctl start postgresql.service + +echo "== Postgres" +# The dump recreates the roles with their old passwords; postgres-roles +# then sets the ones from sops +runuser -u postgres -- psql -q postgres < "$stage/pg_dumpall.sql" > /var/log/pg-restore.log 2>&1 || true +echo "errors in /var/log/pg-restore.log: $(grep -c ERROR /var/log/pg-restore.log || true)" +systemctl restart postgres-roles.service + +systemctl start garage.service garage-bootstrap.service forgejo.service + +echo "== Forgejo: hooks and SSH keys for the new paths" +forgejo-admin regenerate hooks +forgejo-admin regenerate keys + +echo "== Done. Check: systemctl --failed; garage status; a git clone over SSH and HTTPS" diff --git a/nixos/migration/services-data.sh b/nixos/migration/services-data.sh new file mode 100755 index 0000000..10fa6c7 --- /dev/null +++ b/nixos/migration/services-data.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# asxpio-services: move the data of the Debian/Docker layout to where the +# NixOS services keep it, then let them start. +# +# services-data.sh +# +# is /old-root after an in-place conversion, or the target of +# a restic restore. Moves within one filesystem, so it is quick; run it +# once, as root, on a host whose services are still waiting for +# /var/lib/.data-in-place. +set -euo pipefail + +src=${1:?usage: services-data.sh } +vols=$src/var/lib/docker/volumes +[ ! -e /var/lib/.data-in-place ] || { echo "services already have data (/var/lib/.data-in-place exists)" >&2; exit 1; } +for f in "$src/opt/minecraft/world" "$src/opt/sillytavern/data" "$src/opt/xmpp/state" "$vols/xmpp_database/_data"; do + [ -e "$f" ] || { echo "missing: $f" >&2; exit 1; } +done + +echo "== Minecraft" +rm -rf /var/lib/minecraft +mv "$src/opt/minecraft" /var/lib/minecraft +rm -f /var/lib/minecraft/docker-compose.yml +chown -R minecraft:minecraft /var/lib/minecraft + +echo "== SillyTavern" +install -d -o sillytavern -g sillytavern -m 750 /var/lib/SillyTavern +rm -rf /var/lib/SillyTavern/data +mv "$src/opt/sillytavern/data" /var/lib/SillyTavern/data +chown -R sillytavern:sillytavern /var/lib/SillyTavern + +echo "== XMPP" +install -d -m 755 /opt/xmpp +rm -rf /opt/xmpp/state +mv "$src/opt/xmpp/state" /opt/xmpp/state +for v in xmpp_database xmpp_tackygram; do + podman volume exists $v || podman volume create $v >/dev/null + dst=$(podman volume inspect $v --format '{{.Mountpoint}}') + rm -rf "$dst" + mv "$vols/$v/_data" "$dst" +done +# The online copy taken by the backup hook, if this is a restore +stage=$src/var/backups/restic-stage/ejabberd.sqlite +db=$(podman volume inspect xmpp_database --format '{{.Mountpoint}}')/ejabberd.sqlite +if [ -f "$stage" ]; then + cp "$stage" "$db.new" + chown --reference="$db" "$db.new" + chmod --reference="$db" "$db.new" + mv "$db.new" "$db" +fi + +echo "== Starting" +touch /var/lib/.data-in-place +systemctl start minecraft-server.service sillytavern.service +for u in podman-xmpp-ejabberd podman-xmpp-apushd podman-xmpp-tackygram; do + # Not enabled on a rehearsal host: it would be a second asxp.io + if systemctl is-enabled -q $u.service 2>/dev/null; then systemctl start $u.service; else echo "left stopped: $u"; fi +done + +echo "== Done. Check: systemctl --failed; the Minecraft log reaches Done; SillyTavern on :8000; an XMPP login" diff --git a/nixos/modules/alert.nix b/nixos/modules/alert.nix new file mode 100644 index 0000000..f9af6d5 --- /dev/null +++ b/nixos/modules/alert.nix @@ -0,0 +1,52 @@ +# Mail the tail of a failed unit's journal: OnFailure=alert-mail@%n.service +# Sends through the SMTP account Forgejo uses (sops: alert/*). +{ config, pkgs, ... }: +let + send = pkgs.writers.writePython3 "alert-mail" { flakeIgnore = [ "E501" ]; } '' + import os + import smtplib + import socket + import subprocess + import sys + from email.message import EmailMessage + + unit = sys.argv[1] + log = subprocess.run( + ["journalctl", "-u", unit, "-n", "60", "--no-pager", "-o", "cat"], + capture_output=True, text=True, + ).stdout + + msg = EmailMessage() + msg["Subject"] = f"[{socket.gethostname()}] {unit} failed" + msg["From"] = os.environ["ALERT_SMTP_USER"] + msg["To"] = os.environ["ALERT_RECIPIENT"] + msg.set_content(log) + + with smtplib.SMTP(os.environ["ALERT_SMTP_HOST"], int(os.environ["ALERT_SMTP_PORT"]), timeout=30) as s: + s.starttls() + s.login(os.environ["ALERT_SMTP_USER"], os.environ["ALERT_SMTP_PASSWORD"]) + s.send_message(msg) + ''; +in +{ + sops.secrets."alert/smtp_user" = { }; + sops.secrets."alert/smtp_password" = { }; + sops.secrets."alert/recipient" = { }; + sops.templates."alert.env".content = '' + ALERT_SMTP_HOST=smtp.fastmail.com + ALERT_SMTP_PORT=587 + ALERT_SMTP_USER=${config.sops.placeholder."alert/smtp_user"} + ALERT_SMTP_PASSWORD=${config.sops.placeholder."alert/smtp_password"} + ALERT_RECIPIENT=${config.sops.placeholder."alert/recipient"} + ''; + + systemd.services."alert-mail@" = { + description = "Mail the failure of %i"; + path = [ config.systemd.package ]; + serviceConfig = { + Type = "oneshot"; + EnvironmentFile = config.sops.templates."alert.env".path; + ExecStart = "${send} %i"; + }; + }; +} diff --git a/nixos/modules/backup.nix b/nixos/modules/backup.nix new file mode 100644 index 0000000..8eb05e2 --- /dev/null +++ b/nixos/modules/backup.nix @@ -0,0 +1,174 @@ +# Nightly restic backup of the host into two independent repositories +# (Hetzner Object Storage, hel1 and fsn1): losing one region or one +# repository leaves the other complete. A failed run mails its journal. +# +# restic-backup run hooks, then backup + forget to every repository +# restic-backup init create the repositories that do not exist yet +# restic-backup plain restic against one repository, e.g. +# restic-backup hel1 snapshots +# restic-backup fsn1 restore latest --target /tmp/r +# +# Restoring: RESTORE.md at the repo root. +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.asxpio.backup; + host = cfg.hostName; + stage = "/var/backups/restic-stage"; + textfileDir = "/var/lib/node_exporter/textfile"; + + script = pkgs.writeShellScriptBin "restic-backup" '' + set -uo pipefail + export PATH=${ + lib.makeBinPath ( + [ + pkgs.restic + pkgs.sqlite + pkgs.coreutils + pkgs.gnused + config.virtualisation.podman.package + ] + ++ cfg.hookPackages + ) + }:$PATH + + set -a; . ${config.sops.templates."restic.env".path}; set +a + export RESTIC_CACHE_DIR=/var/cache/restic + STAGE=${stage} + + declare -A REPOS=( + ${lib.concatStrings (lib.mapAttrsToList (n: url: " [${n}]=${lib.escapeShellArg url}\n") cfg.repositories)}) + + log() { echo "restic-backup: $*"; } + + # Last good backup per repository, for Prometheus (node_exporter textfile) + metric() { + [ -d ${textfileDir} ] || return 0 + local f=${textfileDir}/restic_$1.prom + printf '# HELP restic_backup_last_success_timestamp_seconds Last successful restic backup.\n# TYPE restic_backup_last_success_timestamp_seconds gauge\nrestic_backup_last_success_timestamp_seconds{repo="%s"} %s\n' "$1" "$(date +%s)" > "$f.tmp" && mv "$f.tmp" "$f" + } + + case "''${1:-}" in + init) + for name in "''${!REPOS[@]}"; do + if RESTIC_REPOSITORY="''${REPOS[$name]}" restic cat config >/dev/null 2>&1; then + log "$name: exists" + else + RESTIC_REPOSITORY="''${REPOS[$name]}" restic init || exit 1 + log "$name: created" + fi + done + ;; + + run) + failed=0 + rm -rf "$STAGE"; install -d -m 700 "$STAGE" + export STAGE + ${lib.concatImapStrings (i: hook: '' + log "hook ${toString i}/${toString (lib.length cfg.hooks)}" + ( set -e; ${hook} ) || { log "hook failed"; failed=1; } + '') cfg.hooks} + for name in "''${!REPOS[@]}"; do + export RESTIC_REPOSITORY="''${REPOS[$name]}" + log "$name: backup" + restic backup --host ${host} --one-file-system --exclude-caches \ + ${lib.concatMapStringsSep " " (e: "--exclude ${lib.escapeShellArg e}") cfg.excludes} \ + ${lib.escapeShellArgs (cfg.paths ++ [ stage ])} || { failed=1; continue; } + + prune="" + [ "$(date +%a)" = "Sun" ] && prune="--prune" + log "$name: forget $prune" + restic forget --host ${host} --keep-daily 7 --keep-weekly 4 --keep-monthly 6 $prune || failed=1 + metric "$name" + done + + rm -rf "$STAGE" + exit $failed + ;; + + *) + [ -n "''${1:-}" ] && [ -n "''${REPOS[$1]:-}" ] || { echo "usage: restic-backup run | init | <${lib.concatStringsSep "|" (lib.attrNames cfg.repositories)}> "; exit 2; } + export RESTIC_REPOSITORY="''${REPOS[$1]}"; shift + exec restic "$@" + ;; + esac + ''; +in +{ + options.asxpio.backup = { + hostName = lib.mkOption { + type = lib.types.str; + description = "Name the snapshots are filed under; the path inside the buckets."; + }; + repositories = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + default = { + hel1 = "s3:https://hel1.your-objectstorage.com/asxpio-backups-main/restic/${host}"; + fsn1 = "s3:https://fsn1.your-objectstorage.com/asxpio-backups-repl/restic/${host}"; + }; + }; + paths = lib.mkOption { type = lib.types.listOf lib.types.str; }; + excludes = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + }; + hooks = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = '' + Shell lines run in order before the backup, with $STAGE set; what + they write there is backed up too. A failing hook marks the run + as failed, but the backup still runs. + ''; + }; + hookPackages = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = [ ]; + }; + schedule = lib.mkOption { type = lib.types.str; }; + }; + + config = { + sops.secrets."restic/password" = { }; + sops.secrets."s3/access_key" = { }; + sops.secrets."s3/secret_key" = { }; + sops.templates."restic.env".content = '' + RESTIC_PASSWORD=${config.sops.placeholder."restic/password"} + AWS_ACCESS_KEY_ID=${config.sops.placeholder."s3/access_key"} + AWS_SECRET_ACCESS_KEY=${config.sops.placeholder."s3/secret_key"} + ''; + + environment.systemPackages = [ script ]; + + # Nothing to back up, and nothing to overwrite in the repositories, + # before the host has its data + asxpio.waitForData = [ "restic-backup" ]; + + systemd.services.restic-backup = { + description = "restic backup (${lib.concatStringsSep ", " (lib.attrNames cfg.repositories)})"; + wants = [ "network-online.target" ]; + after = [ "network-online.target" ]; + onFailure = [ "alert-mail@%n.service" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${script}/bin/restic-backup run"; + Nice = 10; + IOSchedulingClass = "idle"; + TimeoutStartSec = "6h"; + }; + }; + systemd.timers.restic-backup = { + description = "Nightly restic backup"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = cfg.schedule; + RandomizedDelaySec = "10m"; + Persistent = true; + }; + }; + }; +} diff --git a/nixos/modules/base.nix b/nixos/modules/base.nix new file mode 100644 index 0000000..63cadc0 --- /dev/null +++ b/nixos/modules/base.nix @@ -0,0 +1,154 @@ +# What every host gets: users, SSH, fail2ban, journal cap, Nix settings. +{ + config, + lib, + pkgs, + ... +}: +let + keys = { + asxpi = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMZ+/5F7SxdTVW47iiStLpGK77oWfR5NgaK4tTSR/aVB me@asxp.io"; + zerrtika = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIELE7hTD4sC5raqjSxy2fXyM+q1CwwVuy9KLFgDR6SFl zerrtika@zerrtika-mac"; + deploy = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGTDPg3mV55lO8uBnvpcGRxJ2vMRP0qB3Pxhg+C8rwj9 asxpio-deploy"; + }; + admin = name: uid: key: { + inherit uid; + isNormalUser = true; + group = name; + extraGroups = [ + "wheel" + "podman" # the Docker-compatible socket + ]; + openssh.authorizedKeys.keys = [ key ]; + }; +in +{ + options.asxpio.sshFrom = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ + "10.20.0.0/24" # WireGuard + "10.10.0.0/20" # private network + ]; + description = "Networks shell users may log in from."; + }; + + # Units that own data start only once /var/lib/.data-in-place exists, + # so a fresh install never creates empty state where a restore is about + # to land. Create the file after the data is in place. + options.asxpio.waitForData = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = "systemd services that must not start before the host has its data."; + }; + + config = { + time.timeZone = "UTC"; + + systemd.services = lib.genAttrs config.asxpio.waitForData (_: { + unitConfig.ConditionPathExists = "/var/lib/.data-in-place"; + }); + + # UIDs as on the Debian hosts, so files in /opt and /home keep their owners + users.mutableUsers = false; + users.users = { + root.openssh.authorizedKeys.keys = [ keys.asxpi ]; + asxpi = admin "asxpi" 1000 keys.asxpi; + deploy = admin "deploy" 1001 keys.deploy; # CI + zerrtika = admin "zerrtika" 1002 keys.zerrtika; + }; + users.groups = { + asxpi.gid = 1000; + deploy.gid = 1001; + zerrtika.gid = 1002; + }; + security.sudo.wheelNeedsPassword = false; + + services.openssh = { + enable = true; + settings = { + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + PermitRootLogin = "prohibit-password"; + X11Forwarding = false; + MaxAuthTries = 3; + MaxSessions = 5; + ClientAliveInterval = 300; + ClientAliveCountMax = 2; + Ciphers = [ + "chacha20-poly1305@openssh.com" + "aes256-gcm@openssh.com" + "aes128-gcm@openssh.com" + "aes256-ctr" + "aes192-ctr" + "aes128-ctr" + ]; + Macs = [ + "hmac-sha2-512-etm@openssh.com" + "hmac-sha2-256-etm@openssh.com" + "hmac-sha2-512" + "hmac-sha2-256" + ]; + KexAlgorithms = [ + "sntrup761x25519-sha512@openssh.com" + "curve25519-sha256" + "curve25519-sha256@libssh.org" + "diffie-hellman-group-exchange-sha256" + "diffie-hellman-group16-sha512" + "diffie-hellman-group18-sha512" + ]; + # Shell users only from the trusted networks; the Hetzner + # firewall is the outer layer + AllowUsers = lib.concatMap ( + net: + map (u: "${u}@${net}") [ + "root" + "asxpi" + "deploy" + "zerrtika" + ] + ) config.asxpio.sshFrom; + }; + }; + services.fail2ban.enable = true; + + # The Hetzner firewall decides what the internet reaches; this one + # opens each service's ports next to its definition. The admin + # networks are trusted, as they were on Debian. + networking.nftables.enable = true; + networking.firewall.extraInputRules = '' + ip saddr { 10.20.0.0/24, 10.10.0.0/20 } accept + ip6 saddr fd69:69:69::/64 accept + ''; + + sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; + + services.journald.extraConfig = "SystemMaxUse=500M"; + + nix.settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + trusted-users = [ + "root" + "@wheel" # nixos-rebuild --target-host as deploy + ]; + }; + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 14d"; + }; + + environment.systemPackages = with pkgs; [ + curl + git + htop + ncdu + tree + sqlite + rclone + restic + ]; + }; +} diff --git a/nixos/modules/hetzner.nix b/nixos/modules/hetzner.nix new file mode 100644 index 0000000..a74ae43 --- /dev/null +++ b/nixos/modules/hetzner.nix @@ -0,0 +1,50 @@ +# Hetzner Cloud VM as nixos-infect leaves it: the Debian image's disk +# (sda1 ext4 root, sda14 BIOS boot, sda15 unused ESP), GRUB in the MBR. +{ lib, modulesPath, ... }: +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + + boot.loader.grub.device = "/dev/sda"; + boot.initrd.availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "virtio_pci" + "virtio_scsi" + "sd_mod" + ]; + fileSystems."/" = { + device = "/dev/sda1"; + fsType = "ext4"; + }; + boot.tmp.cleanOnBoot = true; + services.qemuGuest.enable = true; + + # Public interface: IPv4 by DHCP, IPv6 static (asxpio.ipv6, Hetzner + # offers no router advertisements). Private network: DHCP, never the + # default route. Names differ between a switch from the bootstrap + # system (eth0) and a boot of this one (enp1s0). + networking.useDHCP = false; + networking.useNetworkd = true; + systemd.network.enable = true; + systemd.network.networks = { + "10-public" = { + matchConfig.Name = "enp1s0 eth0"; + networkConfig.DHCP = "ipv4"; + routes = [ { Gateway = "fe80::1"; } ]; + }; + "20-private" = { + matchConfig.Name = "enp7s0 ens10"; + networkConfig.DHCP = "ipv4"; + dhcpV4Config = { + RouteMetric = 2000; + UseDNS = false; + }; + linkConfig.RequiredForOnline = "no"; + }; + }; + networking.nameservers = lib.mkDefault [ + "185.12.64.1" + "185.12.64.2" + "2a01:4ff:ff00::add:1" + ]; +} diff --git a/nixos/modules/podman.nix b/nixos/modules/podman.nix new file mode 100644 index 0000000..5286e67 --- /dev/null +++ b/nixos/modules/podman.nix @@ -0,0 +1,20 @@ +# Containers, for what has no native NixOS service: Podman, no Docker. +# Declared containers (virtualisation.oci-containers) become systemd units +# named podman-.service. `docker` is an alias, and /run/docker.sock +# is Podman's Docker-compatible socket (CI runner, compose files). +{ ... }: +{ + virtualisation.podman = { + enable = true; + dockerCompat = true; + dockerSocket.enable = true; + defaultNetwork.settings.dns_enabled = true; + # Every image update and CI job leaves an image behind + autoPrune = { + enable = true; + dates = "Mon 03:00"; + flags = [ "--all" ]; + }; + }; + virtualisation.oci-containers.backend = "podman"; +} diff --git a/nixos/modules/wireguard.nix b/nixos/modules/wireguard.nix new file mode 100644 index 0000000..96c9058 --- /dev/null +++ b/nixos/modules/wireguard.nix @@ -0,0 +1,65 @@ +# WireGuard, the admin network (10.20.0.0/24). asxpio-ops is the hub +# every peer connects to; everything else is a spoke with ops as its +# only peer. Keys come from sops: wireguard/private_key and, per peer, +# wireguard/psk/. +{ config, lib, ... }: +let + cfg = config.asxpio.wireguard; +in +{ + options.asxpio.wireguard = { + interface = lib.mkOption { type = lib.types.str; }; + address = lib.mkOption { type = lib.types.listOf lib.types.str; }; + listenPort = lib.mkOption { type = lib.types.port; }; + hub = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Forward between peers, and masquerade what leaves by the public interface."; + }; + peers = lib.mkOption { + type = lib.types.listOf ( + lib.types.submodule { + options = { + name = lib.mkOption { type = lib.types.str; }; + publicKey = lib.mkOption { type = lib.types.str; }; + allowedIPs = lib.mkOption { type = lib.types.listOf lib.types.str; }; + endpoint = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + }; + }; + } + ); + }; + }; + + config = { + sops.secrets = { + "wireguard/private_key" = { }; + } + // lib.listToAttrs (map (p: lib.nameValuePair "wireguard/psk/${p.name}" { }) cfg.peers); + + networking.wireguard.interfaces.${cfg.interface} = { + ips = cfg.address; + listenPort = cfg.listenPort; + privateKeyFile = config.sops.secrets."wireguard/private_key".path; + peers = map (p: { + inherit (p) name publicKey allowedIPs endpoint; + presharedKeyFile = config.sops.secrets."wireguard/psk/${p.name}".path; + persistentKeepalive = 25; + }) cfg.peers; + }; + networking.firewall.allowedUDPPorts = [ cfg.listenPort ]; + + boot.kernel.sysctl = lib.mkIf cfg.hub { + "net.ipv4.ip_forward" = 1; + "net.ipv6.conf.all.forwarding" = 1; + }; + networking.nat = lib.mkIf cfg.hub { + enable = true; + enableIPv6 = true; + internalInterfaces = [ cfg.interface ]; + externalInterface = "enp1s0"; + }; + }; +} diff --git a/nixos/secrets/asxpio-ops.yaml b/nixos/secrets/asxpio-ops.yaml new file mode 100644 index 0000000..41202de --- /dev/null +++ b/nixos/secrets/asxpio-ops.yaml @@ -0,0 +1,60 @@ +wireguard: + private_key: ENC[AES256_GCM,data:Dl5Mg0V/mNT64NqGxRMG1LXBBRxse/rxP4gQ4xo5+0YUD9Up4mEM3YUkt/U=,iv:V7D7U1rO8L2B5KDL0kjJO5GpZmBh0Tk5A5RKLkH7iAQ=,tag:6hC7S3j9U8u9uqzzfWgjXg==,type:str] + psk: + asxpio-services: ENC[AES256_GCM,data:0YUJEJpYm0VdtlHcWfUDLE07sfnV5vysEwGXHEWi0phr5uQLdxPTpklFbGU=,iv:xwNZtnD9XLPKvucaTN4EWYAF0n+rd3dK/+DUmGJeJzE=,tag:SCBHrakvz7m3h5RKrSe4IA==,type:str] + laptop: ENC[AES256_GCM,data:ZkVrAYirJQG/Aiok7gP3XvNoSW+bxPstqOv8Lq5FxgatXPvlc7GgkfX8x2c=,iv:swLwHJqqsPg+Su8XKB9dVKhf/GmMz2VynS8Yl5ZH/Is=,tag:+1cI4DTU6Dr4JMsxD+PVMg==,type:str] + aleks: ENC[AES256_GCM,data:upoHmzn+c0kjzUHykcM2atQEOPhFwtZK/VVtHDbUFG1wkPBAG0XH1bXoCSI=,iv:KT9E9av1m4p+BX7l+wyb6ZBBOO4DNrqUrBMqX02kguU=,tag:+iJRlNgwVEoHOVDl02GzYw==,type:str] + zerrtika: ENC[AES256_GCM,data:kntjXaukawwZ/CDDoO7woZ/FxKnZTKWkcq51kicAs9L6FSMLMmpQkjf0Ox4=,iv:do9IZEA0eUcM+YqlgaLH5ccFWYqR0W0Kzgmz686oQc8=,tag:jx3Vg4qMloGFqM+VHsNW3w==,type:str] + sanya: ENC[AES256_GCM,data:rZnicDf8NeBL8SsYaN7peYwLff3zf10Wth7k1H57l0/vEhrOXRw6yddmgNU=,iv:/V47HapAjAyH49LS8uCJmEi5qELk5x0/xPEJVqcYY/0=,tag:tXskns5rfz0oQ8/Q09n1og==,type:str] +restic: + password: ENC[AES256_GCM,data:dTkVbnkbR4mYl8EXWhrf7Mx3vG15NyUlwlRZh45K3RGE1q+m/Uer3//+WAoj72aFFti8JbK3D9Mtv+K8IES/Uw==,iv:aFXLESPzr2fvqGax45Ic6HsFG8ZxXjN702sAcixZmIs=,tag:nqbwJlu63BBIzJvs9IJskg==,type:str] +s3: + access_key: ENC[AES256_GCM,data:fYwVHweLF3h4qwv98t+RsLVGjOo=,iv:hnAGZSZt5dNVxCeWq9d7bD/8siktMl/80f/1jbM7Gbg=,tag:4IdfTK/Q3bu+kPX5VopzKg==,type:str] + secret_key: ENC[AES256_GCM,data:ZrNieicQNNsF4RysJEmj4YLIUZapMCZhcK0hQ1/bItxSFA5EtOdl/w==,iv:nDA5gTVdDWv/N+GokSifYuBVJt/jwEtNMGjrY9Wr5Bc=,tag:sbszuA2yDT8F2AOiuoFS1g==,type:str] +alert: + smtp_user: ENC[AES256_GCM,data:dmw/w3MbpyIRUQ==,iv:A30vyGeWey8PiQ86kNGdk+NT2MKzg6eraO/ZZXWM54Q=,tag:QXkd308IlfIahZ7y7Rxx3A==,type:str] + smtp_password: ENC[AES256_GCM,data:oC4+3587Hk3MPiRXHqvlMw==,iv:fSF4U7FVMaUCV3uBxdY39Ql7qidoDiBBhz5nwxFj62g=,tag:H/1Ple/vzUiE+4z5YdV2QQ==,type:str] + recipient: ENC[AES256_GCM,data:G8HnqQ+guUh5LA==,iv:cZHj2b8vqpK6CwRoha0L/u6p0l24Hqg6o42M2Xczn+E=,tag:zPmQ9vsUdFB8nZ4AoLncsw==,type:str] +postgres: + asxpio_password: ENC[AES256_GCM,data:T30pHD0/VFeVyfYPfMuaEQlrq4pK5/3ec9k/,iv:w/WxhXZq26IJS9yKZXtbE027dvhRoaUQe0hBYdJRyPI=,tag:vII4c61u1nTvnLH095p/Sg==,type:str] + bingo_password: ENC[AES256_GCM,data:kir1XUYmrYm/hOZ8yLaiuQpr/wwFOjGpdTLotGHHG2ZbQZmeQOaI0bA4yHLZz4cSisMJyPX8dBiOOL+2GPjLyA==,iv:rX/9dkFtFxafP012k+Zg4tcDAkoQaiDqKSEn2gyB/VE=,tag:eC7jA85F8kKExtxeLyb3OQ==,type:str] +garage: + asxpio_access_key: ENC[AES256_GCM,data:X749ploq0DiUNwQBmAhx0xN+P1g=,iv:SaDLwboGOMSLdDIkRuV46iEgRBhcLfJihZABiEt0ELg=,tag:j1XfEYMEpP97rAPQ4OlGUA==,type:str] + asxpio_secret_key: ENC[AES256_GCM,data:BM9TA1eG6ne019AfkdYKwCSirgGVpYJbE5vp7HB8gDvdj3xp92o+Ig==,iv:GAZSadAwz8IL9qa9fBwAEPnRAKyS5+eFK4hctJ9qedw=,tag:sjmYDALo1ZlYjt37FjB+nA==,type:str] + bingo_access_key: ENC[AES256_GCM,data:sUx5iiUtw9TNNGuqfvuAHXOE2aQ=,iv:qaNAwgfZYrd7Sbl6jPBkDYoisH/QespMSqcDzuFgiHI=,tag:zbnYD7mlXfjN8ncV/WIo7A==,type:str] + bingo_secret_key: ENC[AES256_GCM,data:wmhlHqV1wz1bO9qc5aqQSvzraR2lRAVw7nCdrC0aFYcXy+aFz6SEeA==,iv:wLf7D/qc1QSOzH5PiOLkAaOw4j7YxzcN6QZo8Mrc5SA=,tag:Ah5oD34cpUUX9LwbfogLdA==,type:str] + public_access_key: ENC[AES256_GCM,data:uzrt/UoNVjruX+YRMnUT6gMq9J0=,iv:YNb2rfi4nYtzMSDBOdKguXl6kD7b4dTE0zOlP1ZnVr0=,tag:C7NdB6jxmRVVwZINKOtTWA==,type:str] + public_secret_key: ENC[AES256_GCM,data:/FGGNF/5hY6xf9f87qScjRGTcYoxL4HLyAAVpCvUc5niu1LTtTrC4Q==,iv:+wKpetNatoQwZmgV4qCGq/OfGVKzYyqzs0F1M+3/D5s=,tag:C4w1bgB5LETbdfU8mhb5uA==,type:str] + rpc_secret: ENC[AES256_GCM,data:wjI4Z5KMjQHyXQJ7l98CP2LhleW+IhtLFtknOaVoDEFh2yMGtDsur4DZWjMIXnt0RztNOgakKCOgAOd1LmJl8A==,iv:nu1RtADutjWDzInTpxT8PkalhOqzeLfpbmnU36UTJgU=,tag:LTo71fI9jjR/Q9x1JqKFpQ==,type:str] +forgejo: + secret_key: ENC[AES256_GCM,data:LCYKnKHvHRww5CSqZTDxFNqWLL1DsB6BzMYmE+qPwExEL6yZuhMtb9ro1UeJLCvFMblaAMFDwrcgdILCAUE86Q==,iv:i4XobZ5x/Oqp9VWyUHoFJ+2RuFop37NrwP9DpFOkOa8=,tag:H31vTCYF988xiNk19kIXTw==,type:str] + internal_token: ENC[AES256_GCM,data:6b6EWaIndilcSyygYEdyujEN+rm7w9ysKnbQZ3QlxtpUFYlGNV1/Uodhga0sYzUy1l3aJQH2w+74DGkzYlGCCw6Ub3SSfdst8WAZ9LAZOuiu1K7Gg1Qyq7Xv1N1LeFGTHlC9hCNHbDak,iv:rs5dg7aobabQdhci8muYbWX29Yrw/LfTwP795gXLnto=,tag:+wwoi0991SMtry3tvkk1BA==,type:str] + jwt_secret: ENC[AES256_GCM,data:6EUjvGhSUgjcH3a6ZFZqO91pNyebKw60X7zhvDwTaybwP2cuTsLEUxcTsw==,iv:3tnsOlkWa5cV7WxvaPF6TA4bYzSRgd+vHSOvE25k30I=,tag:0d3ObVDH9n3Kr8kbl/tUIA==,type:str] + lfs_jwt_secret: ENC[AES256_GCM,data:t1S4JPNFAQe8R2AfYbsCtuRTmCuhYd4L1Jrrw7Ng+FM17yvNYD/Q0mT5SQ==,iv:dwhONAlew1CCIKbShIocqyVUqqwWtD8pBTMomX5ndKA=,tag:W1yBl724KAUN6A2YfrC1nQ==,type:str] + smtp_user: ENC[AES256_GCM,data:p4iN1od9fDEUzg==,iv:zCkcxSRvO5USxxxZ6O5Wyg1iKvXX3I+Bun6THNgol0M=,tag:Pw9gqLwYOZS51MyuRlNkMw==,type:str] + smtp_password: ENC[AES256_GCM,data:xYZ5O61Z/Ihxe8SNh3iFbA==,iv:4MFTzFX44sbClCNrVQMU+vkyJizxudOjA3kuwZliHMA=,tag:3L3RV6Jy8bVn4QsoE3n1fA==,type:str] + metrics_token: ENC[AES256_GCM,data:ZOvqzBi+xzAsaGhFG877/G0p3w88/B4Azp/jWHaN7XgJWXLKVDtDUEORIpAkW9cUn3T3awy/3WGXqvhBiQ6dFw==,iv:+nElsXhpUjTK06zb7iyxxPq/TUngQnaeveM94Suy4m0=,tag:bjbHYIhvAtKZPOe/yNMoAQ==,type:str] +sops: + age: + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBLV2tVYlVhQkR6R0p5YXFy + cW1hMjI5TFFreElkYVJ4M2d1QXJDNjZXMGswCjFpMjBBTm1ldFVrMm83eWQybnlL + cmJzTnVnUzF6RGJHZWZVQ3hKZXpIcTgKLS0tIDR1ZGp0Q2hVam1ieGJkZzJ1ZmlS + eWdFUFlPOFJuL2p5MEFiWlFVa3FHNnMKgnPOHPxfX4rycpszo8JBLhxYce8Ne/yx + PUbIyVTvoPG/7WwJaQwaTxoZPN19QJDw380bRo9/UJwPi43LrRuCew== + -----END AGE ENCRYPTED FILE----- + recipient: age19xvmm6j3h2u6mc3w6k65ufry4p5aa5lwu96p55h3e42p9wfzwc0qp2w7pk + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBpMnNRaXRpdlpwdW44aGZY + VWxUemtLV2NmWWFORFVGOGZVSTBaL0hTNm1nCi9heVFZcTRLQjBHUzJpdFEzbVRF + aE0xTElaVHJjdHp3YUJ0QldERWttNFUKLS0tIHYvdEJQTmVXU244MDJhdW5ab004 + MjNDN0syWWJ2R0hyV3owV0Q0R1pLUGMKAjK+sXsqwwUMH4rlbb0ACNCNBnPQJ7S7 + iGRzP1x1rLrGgaiuXkAIJ0bqZIvOKSrKRzl73hxF1Lf+Uo6ouNvQ+w== + -----END AGE ENCRYPTED FILE----- + recipient: age1jxcl9cwk64wak2gyzf22vm3dpj80wtl76c7krywlrj7jjxftscrskrg3tf + lastmodified: "2026-11-16T18:18:28Z" + mac: ENC[AES256_GCM,data:0mN8444yoA6aiIpB3mIj4NrzI7O35AmqoN1P+JzNimNzfWZagSL4ndwOisiYbCIbUgfJDcbeq5YNUibGoE64nLuEmJ6LxepUpCGQWoNxyLPhWkBa1ZnNHCWIhuCPxGmCT1q9WNVUrf041ng8RTw8hvD/pI23v4jp4wKFhCkpD7U=,iv:4cl/2AGztxQ6sFG+x7k556uA9N7+oIP/Mr6IH6kEq6M=,tag:CWWgaGaMoNECTolwwNSHMQ==,type:str] + unencrypted_suffix: _unencrypted + version: 3.13.3 diff --git a/nixos/secrets/asxpio-services.yaml b/nixos/secrets/asxpio-services.yaml new file mode 100644 index 0000000..31038c3 --- /dev/null +++ b/nixos/secrets/asxpio-services.yaml @@ -0,0 +1,39 @@ +wireguard: + private_key: ENC[AES256_GCM,data:G+FwV9wfQkCxkaHm3+ooL8nx8YDXSptCc2hmsNwgE6efxjW6lZRO0loN4mI=,iv:/waeKxk7boxM4XD17MCswsKxr9iNM0xyfjIw582OAQs=,tag:0s9j6Gunubo+ybp/MANHVw==,type:str] + psk: + asxpio-ops: ENC[AES256_GCM,data:Cl04/CawaSO+UmqnJjRbYb+rR3x7fwsJ6X/56Wz3gXdeSnOppsfBqnBCGNc=,iv:Qrkv8ecmeSI2NzFqwkfSuYzIbz7KUQZKvccuwDYO1uU=,tag:EMLA7JJ46GXWBJ7JnpXbAQ==,type:str] +xray: + config: ENC[AES256_GCM,data:T8kAhDdt8OU0nRfZKquopRVfocVWc0c/VLgv2H9wSPJe6DMwQwr3ePJk6xUESXJnqSQQjopUTT4o4dqxr/wImqdzS5m96f740XGNml++aJtsZqwh2WUSHSsz7mCIpgJDMeS8CLDYO0LrI1B4KJ/ulvKVV9L+CNF4cd6gmdCC4YO55VRebWwGofigA/9sc3jRbpFJn5Q4v7QtIjrVkKiQgEYcvfFyYdwLUfVCmdVBOyb8LhuVTbRQN0hPw0CpcgyrdMIXtvbrz0Zn1zauA3AJVHcDV3HY/ZcICyKLFGhjRasvVcEfKIZeN2tl8EPPeY9qOM1Ide7SXf9yleKyV3innaW0v+5uGwIV+1kAYirKvgBufpugonII+jlztcnousi5pmT3exw62/95+OimnhEJdgoaZyw29WCDbMEene1cIYr4s+EW1TOKrMDBvEJzZJLCyHrMUY1YTv0aQ5AjR+C6R40zW/o6h0hMBJrKt5hQyDRHvzmU56TbU5V6t4WcZfKQgMGTuzAGejtv6s3DnDBVGh6W20SqHiPEBeiaIA7Uh5gxYnE6BjsjuEG6t/xNpERdoS1syPBDvyGj9kK7dzoNnBwNpztLX0OntJTrA0klzWwC5M7JuBCo6hznWnKAtGuGR1HCZ07KUa1/Bwk0dlo8r7v/HMSKP3+Xd/aSkr+i3TXZYIMdzQFxAXBs4+CSKZvE1Bwo0nxaUcA1aIZVaxN9cKOr8zZoxY+p3V8IJe//PsnJ7MXEt9R0nDORfgZU2nmUbmrKu0FfhrQw+jhlQZ0CZUPy8NHoDUJKgZVTUA1jrOIWLGbd2ywe934vXQ9PboRep1f27AlnpoTdLbKTNbGTMxtcAZzbUN5mXl68JWREYnpGKAeShlRiMLi1jdXhlAce/8cDpqak/Hxy68ClQuGXXHIXobdJJZTdVtxnvoe8A7Gn5SKgHoChMLzc0oCkQi1Z7fHoQ9ssA6n4FUJOIq1dvFVFYIfTTqdFt4jVXGfr8aLcw0kbj95+55LnfmtburtS8XQ3t629vmn5lSkjni+u0rpoIIK6DvKMcqNjmBP7pnyPmnOLa99okW+EWzcwXXlcz1NksUj3LBt/4b0fHSWzkGEiuLlJJngrBhhZ2XOhe2vgXtPIaLIlp3tX9oEZ5CVIzfqjZeG0bSeJ57xOi58creoKpAXOAWyyIR0U4gUpuMs8qrbcShzuDS+RplNZxOV692cXuA==,iv:WOdCz0mTweCPe60MTTOz741QIozWpkOtpeu2W0JJcWk=,tag:S5EnO8F5w5GL+RkcJwluSQ==,type:str] +restic: + password: ENC[AES256_GCM,data:DOEpW+f1qTF2FMDn/j51RbPgPmhfO+L7DNU3+H+50GMBI68ExB6MsyuwUWVvegmqaquxlFb3yxlWFGK4KnDAxw==,iv:zeZlSBz9tcHIe2JGKNhWa6NPMgy9cbLbXdsYijvYFhs=,tag:pPKY7XcozwGuioSs/1KSRA==,type:str] +s3: + access_key: ENC[AES256_GCM,data:NQWD/eppV0on2+jyRGi6MXj2G0Q=,iv:JQF3ztS0bOBWkFlBdKeqelZGaKRaVJIsbThRN2nw8d0=,tag:3E/wXxA2eYKOgkHXpcGbZg==,type:str] + secret_key: ENC[AES256_GCM,data:rOf7GJSo05SnCg1i5LPnCTALF+dbBP+SzgZj1WZRrflGJO4VwbzYUA==,iv:VSPXTqAo7vrO2nCGCg0TYicAu+w8Ino2iQ8rsPhifJ0=,tag:OltR1pJA0JTDYk7oJsj1HQ==,type:str] +alert: + smtp_user: ENC[AES256_GCM,data:N0Qk6sXP5UEi4g==,iv:CtoXFCD1KR6v7KocDIJDGddLf/fbLXKtgV0BmIXCRFY=,tag:4hMxIhyb0FHO70vs6HCpIg==,type:str] + smtp_password: ENC[AES256_GCM,data:TKtHmZbDRrQuWMIms87uIQ==,iv:MamjZ5A5U2g4o8sGHcwWCZhhKPrdwEtpmwkQAUYsOpM=,tag:mhEfq+q05INHZoB8laWRWA==,type:str] + recipient: ENC[AES256_GCM,data:nInG7xymguzEJw==,iv:hTjehJDREjviydX68olGmtRZuYhdREXzO3yq5v9HP2o=,tag:4eECnlEqz9aT2Z2qPkxECg==,type:str] +sops: + age: + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBrS1k1VnpzVzcvR1NQK2lJ + amxYb2U0UEo2S2xZR3lDM0JJZEhaOEVvMGowCjdIaVVMTE1CWjRmUjBqU1VBZ1ZD + bmdxTjhJZE4rSGw4a0JOUC9QSnF0ZE0KLS0tIHZnMDFPalpRNUp6ZkhFNnFwdjlp + M3JWNURqcG45MVBQVmtnbnhRanRaR3cKbOFztz8ki4dT+Kezvaqgyfz2CvHYOMw7 + UkpGwXifQ8NsgMJwRuo+Uq6hd8qQgTSCAwQBHwPlZKc1iQeSmMV5dg== + -----END AGE ENCRYPTED FILE----- + recipient: age19xvmm6j3h2u6mc3w6k65ufry4p5aa5lwu96p55h3e42p9wfzwc0qp2w7pk + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBJYWN0U0k2YlFvYjE2TmdQ + NnhFazV2VFRCUm1WSDVSb1NJUy9iN0JwaUhvCmxzeStFSzB0SitUMEpUSHJJZm5M + RDdWVmw1MTBCeUExS2hxQy9EUVZkancKLS0tIHpwZzFJTkZQRXhEZUk2M1BRdVdM + SThYVW9SU0NPaHRFdGc2NlJFSytpQ28KLpsqyoNZfOHhs0nNdaRXtSkGjgFhSRg4 + rXMY2WHVEU7o2Bp2qM0yU+F7kapdMZbnyIS5o4K073jzrPL9WRB8pg== + -----END AGE ENCRYPTED FILE----- + recipient: age15ws8alg3ftsgmzvqxft09556g87s4n8c8v39nmvhaz6k50gp4e7se8acmg + lastmodified: "2026-11-16T18:04:54Z" + mac: ENC[AES256_GCM,data:ML2jSY1F5/ZYk67qM4vK0mFcmPRPBLjI+dvbpHssNi64Xp8rReY7A5M1DSjAc6XMJ07NGeQYxW7T56u4CMIIr91EglOFz64DjSf6MZJKqtxJLrYoo3K25AN6C+8/ZYO921mbI4Cr5vNSLPgd1CADAbkvL3GzVoIzSAWLQSQlrV4=,iv:kc2eALNozrKHX1K3uW2jVwHwWRNv3Q0aMQEftZTOUm0=,tag:wPB9P+fPKg5ezHJ6GRvPyw==,type:str] + unencrypted_suffix: _unencrypted + version: 3.13.3 diff --git a/nixos/secrets/rehearsal-ops.yaml b/nixos/secrets/rehearsal-ops.yaml new file mode 100644 index 0000000..8fafed9 --- /dev/null +++ b/nixos/secrets/rehearsal-ops.yaml @@ -0,0 +1,57 @@ +wireguard: + private_key: ENC[AES256_GCM,data:DkLNMfrdBSybBGFmU6zk759XGnsBFf7cLb78tCHqKaA29oEO6dyGxGKxmpI=,iv:tBGtR/jlUHHNmP2gIKyA3QENAt55tJ3BQQ0AriYYXXM=,tag:GR4YkvZ02mOCjIhGuamlqA==,type:str] + psk: + asxpio-services: ENC[AES256_GCM,data:m4NZgJV1VRkUwcwMIDG3dlctaDYZUY7XBxDv3204Omf7PLPpR1MR4Tap35g=,iv:aPom8jqZlNKtdWROXPM3Jfq7YR3eCilz4nyJbymRJZ8=,tag:R6H/+jywPTacYXeSkyrIrQ==,type:str] + laptop: ENC[AES256_GCM,data:k5JNwFFaBlNu9/R6xeYf25EAui1hZzOaZQ0x8ceuezPuLTgpPpq+XinRyPI=,iv:9+boqRpG2IelyXgn2YzWqf7Pa9jIW8eAZTXeuNhR9c8=,tag:+8TUY0NUQ1lJk9xSNmoI/g==,type:str] +restic: + password: ENC[AES256_GCM,data:+TXqXafr/9s1y5xrpKts,iv:ahS43ViXdu0DO1mNzIUyXQn/ubaGuLsWr19BmyaNGcY=,tag:jgBFw+6DPwDkNi8arAkH0g==,type:str] +s3: + access_key: ENC[AES256_GCM,data:tTUu0l/Ln4dYpeyW1Ydy,iv:O/t8KriGelq4YBoC7ajE/hn1LvZh2xkJ8PmubNb++S8=,tag:ykY+Z58wHoUX7cv4tW0shQ==,type:str] + secret_key: ENC[AES256_GCM,data:2fZMZAXUazC0ue69FEvH,iv:ID3rRnQTZ9ROwLKWbN3pAbSCGjAiuTuOPxR7c9NPi20=,tag:/fKgqWlBH5Z2DCJOPCiwog==,type:str] +alert: + smtp_user: ENC[AES256_GCM,data:ayaabj0mJ7yQHv2znb5r,iv:Ylz3Z2DPwmSe1VNnhShUJluvpoh6xjtqRciyjS9kpZc=,tag:k93iUwO9v0o92fDsCc1a8g==,type:str] + smtp_password: ENC[AES256_GCM,data:8Q/yRbjpN1YE9WlcIoq/,iv:PTmXgv6wnAgoRkb+5nQhMa09sda385VvqMW4c8YN7s8=,tag:tOIJRfWEHXhh2v8jNZj4Kw==,type:str] + recipient: ENC[AES256_GCM,data:Gcil8WBYCioR3WMVKfG1d6Lzi1/EiQ==,iv:K4b4YRxFDMNdNj1BEiY79VffjiINiqXr9BP2mTzqp7s=,tag:UgoBBwLz91gpcoUbmRyV0Q==,type:str] +postgres: + asxpio_password: ENC[AES256_GCM,data:+NEzolCNwhbC01a858cKH+LXWJB3Z91kN/nmCqJ1tWU=,iv:7gp1fu2/SnRUBXkQYPkQqwxZsngNsFlaMqKeCqi824g=,tag:onaTeuhFl1xI8MQZj7Ud1Q==,type:str] + bingo_password: ENC[AES256_GCM,data:wAwglGSKxUOUJRIBgcIUb1TeKtMLGAbQQWGDsNBYe1I=,iv:hy+tn1WBr6D0eWf8rRItLoMhc33sdCgOBqbiV/QlQKQ=,tag:eiZNZIlFoNhiV44K56XDqA==,type:str] +garage: + asxpio_access_key: ENC[AES256_GCM,data:fapfu04ANOeK5Ix4ejMWHI4zSXk8y4496iOsvGN1fDs=,iv:ls740e2RvG8yafto7fYslyUY3tunjlQQZWuYaNho9u0=,tag:JAFKIlVj9K8NdFR/kQ1A1g==,type:str] + asxpio_secret_key: ENC[AES256_GCM,data:5c0xs1GEe3ELGz9F3Zj3a1hObIhyV+O7m+5iG7pKskk=,iv:yLNf5uYzEGPLqeBIwg09dmR+4/oPAESLNL1IZUJhw8M=,tag:HiLxeKwElZPZCpTYj74V2g==,type:str] + bingo_access_key: ENC[AES256_GCM,data:yplmNR+/y3t1+4VWlWTIvQy9eViFHKoGJMim4R6obH0=,iv:0rLtu04mfcVJGBf5au5dzjeWBVEwD9JFxsptrqN6YVo=,tag:wDjaj8EhM0SLpXJqpTBicA==,type:str] + bingo_secret_key: ENC[AES256_GCM,data:h05jUdF5D3AcCxX2zWATVHpugFJJ3LR8Zz90RD6pgEU=,iv:wddLoV1APO3qKvHe/ZYc/0MT68DroIUzJ5+xGXYBcII=,tag:KxqKaf/NrUrKVdqoPh6Kkw==,type:str] + public_access_key: ENC[AES256_GCM,data:F1a+zqj4fnKZJJEw4gFsSA1a+S4iHir+q/npjhEX2C8=,iv:Cq15eZaGfi0Yl91u/OIGcXOHvaTeGw6j1BUlvH4fk/U=,tag:bsEtn3SMXiB4bQ8TBzTRLA==,type:str] + public_secret_key: ENC[AES256_GCM,data:8t7CUPJEKJzzyAOyWfaRLR89GiZIQ3nxvJ2akIrdC7g=,iv:ya9R6ALe1Vym4TjUik5XrJLQP7TRZwKUdk1goq8wXD8=,tag:EM7LkY0uzffbH/lk+YnH5A==,type:str] + rpc_secret: ENC[AES256_GCM,data:QTVFRsBkyEPtvWqwxTCaReWkGm5ad1WR+NZv6QdI9c3eRhUYdgZmNqa9hhk4phvqsE1xt7rBFhddqvF/3In5bg==,iv:wEKdDs2kx+KYcliEXAynAzQvLYGCQKOgcbNEF77fiLI=,tag:M6+zACxJurXl2LW5IEwZ5w==,type:str] +forgejo: + secret_key: ENC[AES256_GCM,data:d9ITHJDRIDePdM/fdovt1lS9oFLfK42FTKbDbkOlWTo=,iv:FOgJAG+IUglUnwBQWkS8TJgiV0s1sW0KWRIRz0h6tUU=,tag:l6gN2Sr7P9tPra2yhksUdQ==,type:str] + jwt_secret: ENC[AES256_GCM,data:U7wq6Y2i74PGiaGZ2UmqXXi6ynI671nPD8JFHJbausNJo5bXl+5bERd2Lw==,iv:B8kKe4wfRKX2PmKBu/IMGFk3nVyKq/03GLLDGqumaHI=,tag:0Ut/I01s39l+C9M4rw03uQ==,type:str] + lfs_jwt_secret: ENC[AES256_GCM,data:xmUP2cYOI48OnoO7SGbfPQ1yYkaXZxjyQnlkXYJ2tr/DNe3ZlX+gTsoQyg==,iv:EjJrSPsFm5/bpPsxWtk59HkQvNEuyEFbocu7bq8jVrM=,tag:0RjxqcZN6EfFdWPkdDqySg==,type:str] + smtp_user: ENC[AES256_GCM,data:gxuYQk16mrrXMxBnn6yvfiu1E7uapq7QUJ3WChJBhv0=,iv:ddRLo/2YKX0XK5PzBzmh19yEaSy/nBphELQTUnAFIDQ=,tag:TS0wmASRDnN7zENKzGQ+NQ==,type:str] + smtp_password: ENC[AES256_GCM,data:ZWVjBAM/1Qeoi8Jqjjrmgp118Oxw1QgNVgaLw9DsWfE=,iv:UI1TYBsvT03lXGOyQ25KV7egV2ZZ3akugWILxgOT0l0=,tag:imhtVdS6zTTaFrScCDvumQ==,type:str] + metrics_token: ENC[AES256_GCM,data:pk1X3BAflndRl8n7vYRTTmOYCgcKoeJw/23DSYSyMAs=,iv:PLSwOppShQYveW7HVze6nw43B1m8kkH9G71Z9mg7gzo=,tag:+4CSNXie8oKap8zGQnjnkw==,type:str] + internal_token: ENC[AES256_GCM,data:IBHJ02KU/3mftjrRNFWSLEn4eX7994p1WakIJb0LKfHSGJU6evE2htJ/xd4W/EBvGoCnVc08eLb2hmNBrl7zWt6SmBSD/M0Pp4RjsI+ZTn4=,iv:Jd7IoshMCNj1L77sLZs8cTwpw4Nm97T5ZMCUxaaT5gI=,tag:rmJjOdECj6HzEx/2g3Nrfg==,type:str] +sops: + age: + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBPb0E3VThKeDJ3bTJNRjlI + elY2aXpMVUVkSWJXTmw2OGVDTE5sd3lLNlRVCkJRM0N5N200NkJxMWdrcXUzc0NS + MzE1ckV4MkpqV0t4djBmQnJlV21iczAKLS0tICtjV3F6bjZlVldzVkR3bHAyTUNM + YmdYcEROWDF1QThVNXJNd2FZYU1ncUkKeNQWlxUSm+N/XKwVyBN2iYkDnhXbNgAr + uQANCsVZYD9itvlVeTnU+LjXsG5+8CFrIvHHvY1i01yL/kwJiK8sIA== + -----END AGE ENCRYPTED FILE----- + recipient: age19xvmm6j3h2u6mc3w6k65ufry4p5aa5lwu96p55h3e42p9wfzwc0qp2w7pk + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBSeE5talpMeU5ERGJxMW1W + MlBocldPWFNaRzVKQjJQaGN0enY5cnZxU1h3CmFXRVozQWdUb0dCeWoyVUthT1lK + L2R6RW0vT0hqU2hWVzBCUGlRclp6RUUKLS0tIEx0NHlNclBUOWRkajFLZG1FVjJG + MHBGN1ZneFQzd3lnUnRXUWduOEFWNUkK8+bDhGrltxM9P7ffSSFqbfsw7i5seZ0h + Ntveu3ILPevnj/b5WQTJyG8B6UDUGdgy55AdmCgg3il7cG+GUK34gA== + -----END AGE ENCRYPTED FILE----- + recipient: age1hfaf7h2h43ahhql8zc6u3yr67yx4utnrlw57h6r32wnm4axvzves8pcl0r + lastmodified: "2026-11-16T18:18:43Z" + mac: ENC[AES256_GCM,data:Q1oonfwDk01dKT/hiUi4jTR9zeOscTL/NXZtilgSm/hSNCy75g6LUeoBN9b82ukKKfaykxsi/QIHtWCoqI3/2/dhMJu5AWh8rCXHVo9QbqyJ9Jxc/wJ2E1MAroAc9vQQkZeQ6v29UZQ95xohbBC36n+aKMAmjYyFjkfNwwZdNMc=,iv:T1SQ5IsikeAvcG/Let63Rx9ceOB4zfEpED4gMyAhl7s=,tag:PgINV6Gucl8aS+833JWZWA==,type:str] + unencrypted_suffix: _unencrypted + version: 3.13.3 diff --git a/nixos/secrets/rehearsal-services.yaml b/nixos/secrets/rehearsal-services.yaml new file mode 100644 index 0000000..a44aaa9 --- /dev/null +++ b/nixos/secrets/rehearsal-services.yaml @@ -0,0 +1,39 @@ +wireguard: + private_key: ENC[AES256_GCM,data:PUOlyBRhcFjpCkRY1iB/VieX8s3fXVJgqQCkB93TXdRtRHS99tvHU7cnRdI=,iv:qIvsC5yfdskx0z5H5mvCGr5C1KpZ+wENwT4tfQE9Ptw=,tag:YtswD9X9UJuCjlgKywoaxQ==,type:str] + psk: + asxpio-ops: ENC[AES256_GCM,data:IN6LX/lq9Rlxe8dMrYKO3Jm0T7AWJ/W8P4NVgKVNa0E/IELSOO4GvmswUvE=,iv:cO4RPGl8twGLb3rta/RnsjrPR2qIiAITdbLg3sD6Qgc=,tag:aWOeGWO6k+Q7wzS8HdD/mA==,type:str] +xray: + config: ENC[AES256_GCM,data:V+52wflRQ3EuyH3nQHBkU9XvllsqfLlbeeW7tFcVk35s6Umr9pFqXj7ABEmzJYG190cEigybYvv3uiAdx+HNaVUCXbQ3P4YFLj033V5ZuZapLVqQAepeeoUVnAVJ6uxbvauIYajgx09G/XyG/N6K8BhSoHRqbGHf2xZ49r+N/t9LTR0c4mxfgUY0pBBI4bRjrKlXSd5cnNa67/auLt/o5A6AZ7KedXgtePvlTDc9WFlpzC5T,iv:QjyBitOv6z4d0Muj+sLiCmvkyDElCu/oDed4peKwxpw=,tag:D390KdRfu0zenvgNpei2DA==,type:str] +restic: + password: ENC[AES256_GCM,data:nYUVRll/aDrEolaf/m8U,iv:eRGdDQcBP3lxxqI2Tqun7I4c9FfWQdXUdrnhStTD1Qo=,tag:pRuYgj2CXMZyYwuRKgVP8Q==,type:str] +s3: + access_key: ENC[AES256_GCM,data:wN0B8YZs0WuA7JlQWc9s,iv:4Cwgu5kwAbXlnTnkVnH0Iom7cgUWqVcAa/ifqainLTY=,tag:GLEZn8UuGv8UPpy/4boKiw==,type:str] + secret_key: ENC[AES256_GCM,data:RkbeZCy83n2VVOiC+g37,iv:dr6qqVJ5HrSG4YLZPs+UFGnXs0oyrBMCEqlR31z6i5I=,tag:UB0LueCNx4g2bhPWHbMpbQ==,type:str] +alert: + smtp_user: ENC[AES256_GCM,data:qFePxfCUu6lq4Ev783+Z,iv:Q9/5DN8mFJ/A/39nWv0MuokfZ4AdJ+mJlxkyxNN45jQ=,tag:Jsuce5wbB6FPruhrtQoU3Q==,type:str] + smtp_password: ENC[AES256_GCM,data:7B+Hz41HPjQROsSdxtcL,iv:Ntg1uMkPg4OmY9NYBmXrwENjdkSrQmMdfqJAH0GrNV4=,tag:jeHegNY72drhq6MfQany3A==,type:str] + recipient: ENC[AES256_GCM,data:6ToWFpKc3eZPIN8ycVCIxkdsHbiq4A==,iv:YSSQ7XUPEqnebKRJPMTfUBy4Rtt8Gro3igOS0vCQMrs=,tag:FDP27ufUhai3uqh+8/SFOw==,type:str] +sops: + age: + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA4ZmduYjNXZEorcmxwNUNx + bmt3NGU5UmZhMG0xY0JUWHRnUVhYWU8yeW5FClNmY3k2cnN5K3pFMGV6V1l4N3pM + VlEza0JuM0F4QkVSYmQ3UWlRTktPV2MKLS0tIHB1ZExEdkVVWmt2YmZaaWY2SXFY + czhrYzVHeDZTNnZrc1A1VCtYQmdILzQKwQo1ss84RRm25ZPA/dZEcyPZm2TrCzmQ + YV4AmymV/QhuL4CokynHpxx2jNna2MTbdqQNET1PYCczoU7+lkisAw== + -----END AGE ENCRYPTED FILE----- + recipient: age19xvmm6j3h2u6mc3w6k65ufry4p5aa5lwu96p55h3e42p9wfzwc0qp2w7pk + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBBb1NjdWpiZzI2Z1cwWmdU + NDlwV3dRN3VsWVBMdzIzeWVuNXc4NGNlY1JnCkFwcSsyUWxVdHNhUTdUYXNQNER2 + MXJ5S2lSeHFGamVZWWp4RjN1TG40SGsKLS0tIGVrZFJlUUFwZnNvRm5RTlBHVlpR + UGlGRS9Ca0hnekY4SjdTaVFCbFppQTAKhLgJ6CMctPkVxO3og69tLRAO9DRm/5W9 + cdAX8w7/jxpECelWZWUisIN0qvb/42I86CfdQAqTLknL02pnLNYW7A== + -----END AGE ENCRYPTED FILE----- + recipient: age1au6f8m6l245ddrunqf2a62xprnlevn9yrducynlay2tgknfxeeusj94j5l + lastmodified: "2026-11-16T18:04:55Z" + mac: ENC[AES256_GCM,data:zNzmbqxWVTycXWHKmBX3IFCSK5cQ4XeZr859ezDWrR/EZFOHHCGGV+N3GqYwDtrHK832Ovs69S6WgSI0SwUqeC3cfxlauym0VdPq1kl8FcON1nbK51dueR3YuxIxvCmtQJy9BNmgmAMgnhldCvtPnQW3ELS/DViLF0iTGKBzLAg=,iv:0KSj8ct+R4GKYZ6/5VhBWmIiaryMzM8n/5ccUyiPpGQ=,tag:C/dDDmv7MBIltRfrUiFToQ==,type:str] + unencrypted_suffix: _unencrypted + version: 3.13.3