buzz ssl
This commit is contained in:
1 parent
6411069dbc
commit
dd6d071c34
15 files changed
+270
-42
No files matched your search
+24
-21
@@ -11,32 +11,35 @@ bin/
|
||||
├── temp-monitor # NuShell script: collect CPU/GPU temps to CSV + optional graph
|
||||
├── TEMP_MONITOR_README.md # Usage docs for temp-monitor
|
||||
└── lib/
|
||||
├── cmds.nu # All subcommand implementations (NuShell — source of truth)
|
||||
├── cmds.nu # All subcommand implementations (NuShell — source of truth); commands only
|
||||
├── helpers.nu # Shared helpers: REPO_ROOT const + internal functions used by commands
|
||||
├── profile.nu # Profile helpers and tab-completion data
|
||||
└── types.nu # Type definitions
|
||||
└── types.nu # Type definitions
|
||||
```
|
||||
|
||||
## Key Commands
|
||||
|
||||
| Command | Description |
|
||||
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `skyg os switch` | Rebuild and switch local system |
|
||||
| `skyg remote switch <host>` | Deploy to a remote host |
|
||||
| `skyg remote install <host>` | Fresh-install a remote host via nixos-anywhere, using `hosts/<profile>.disko.nix`. Always wipes the disks in that file. Aborts if the file is missing, if the host already boots NixOS from disk (unless `--force-wipe`), or if you do not type the short hostname. |
|
||||
| `skyg hm switch` | Apply Home Manager config |
|
||||
| `skyg update [input]` | Update flake inputs |
|
||||
| `skyg build-image iso | pi1 | pi2` | Build bootable image — ISO (`iso`) or Pi SD card image (`pi1`, `pi2`) |
|
||||
| `skyg openwrt` | Deploy OpenWrt config |
|
||||
| `skyg rollback` | Roll back to previous generation |
|
||||
| `skyg profiles` | List valid local/remote profiles |
|
||||
| `skyg check` | Run `nix flake check --no-build` |
|
||||
| `skyg check-flake-versions` | Verify NixOS release version consistency in flake.nix |
|
||||
| `skyg remote boot-all` | Boot all remote hosts (builds on `fwdesk`) |
|
||||
| `skyg remote status` | Check status of all remote hosts |
|
||||
| `skyg secrets` | List known secret names |
|
||||
| `skyg decrypt <secret>` | Decrypt a secret to `.tmp/unencrypted-<secret>` |
|
||||
| `skyg encrypt <secret> [--yaml]` | Encrypt a working copy back into the secret |
|
||||
| `skyg compare-secret <secret>` | Diff the working copy against the stored secret |
|
||||
| Command | Description |
|
||||
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `skyg os switch` | Rebuild and switch local system |
|
||||
| `skyg remote switch <host>` | Deploy to a remote host |
|
||||
| `skyg remote install <host>` | Fresh-install a remote host via nixos-anywhere, using `hosts/<profile>.disko.nix`. Always wipes the disks in that file. Aborts if the file is missing, if the host already boots NixOS from disk (unless `--force-wipe`), or if you do not type the short hostname. |
|
||||
| `skyg hm switch` | Apply Home Manager config |
|
||||
| `skyg update [input]` | Update flake inputs |
|
||||
| `skyg build-image iso | pi1 | pi2` | Build bootable image — ISO (`iso`) or Pi SD card image (`pi1`, `pi2`) |
|
||||
| `skyg openwrt` | Deploy OpenWrt config |
|
||||
| `skyg rollback` | Roll back to previous generation |
|
||||
| `skyg profiles` | List valid local/remote profiles |
|
||||
| `skyg check` | Run `nix flake check --no-build` |
|
||||
| `skyg check-flake-versions` | Verify NixOS release version consistency in flake.nix |
|
||||
| `skyg remote boot-all` | Boot all remote hosts (builds on `fwdesk`) |
|
||||
| `skyg remote status` | Check status of all remote hosts |
|
||||
| `skyg secrets` | List known secret names |
|
||||
| `skyg decrypt <secret>` | Decrypt a secret to `.tmp/unencrypted-<secret>` |
|
||||
| `skyg encrypt <secret> [--yaml]` | Encrypt a working copy back into the secret |
|
||||
| `skyg compare-secret <secret>` | Diff the working copy against the stored secret |
|
||||
| `skyg ca init` | Generate the lab root CA: key → `secrets/lab-ca-key.age`, cert → `configs/pki/lab-ca.crt` (see `configs/pki/ABOUTME.md`) |
|
||||
| `skyg ca issue <domain> --for <host>` | Mint a TLS leaf cert signed by the lab CA: cert → `configs/pki/<domain>.crt`, key → `secrets/<name>-tls-key.age`. Auto-registers missing `secrets.nix` entries. |
|
||||
|
||||
## Agent Note
|
||||
|
||||
|
||||
+72
-2
@@ -1,7 +1,6 @@
|
||||
use types.nu *
|
||||
use profile.nu *
|
||||
|
||||
const REPO_ROOT = path self | path dirname | path dirname | path dirname
|
||||
use helpers.nu *
|
||||
|
||||
export def skyg [] {
|
||||
print $REPO_ROOT
|
||||
@@ -473,3 +472,74 @@ export def "skyg compare-secret" [secret: string] {
|
||||
|
||||
rm -f $temp_decrypted
|
||||
}
|
||||
|
||||
# Generate the lab root CA: key encrypted to secrets/lab-ca-key.age,
|
||||
# public cert written to configs/pki/lab-ca.crt. Run once, before `ca issue`.
|
||||
export def "skyg ca init" [
|
||||
--days: int = 3650 # CA lifetime in days
|
||||
] {
|
||||
cd $REPO_ROOT
|
||||
let cert = "configs/pki/lab-ca.crt"
|
||||
let key_secret = "secrets/lab-ca-key.age"
|
||||
if ($cert | path exists) {
|
||||
error make {msg: $"($cert) already exists — refusing to overwrite the CA. Delete it manually to rotate."}
|
||||
}
|
||||
ensure-secret-entry $key_secret ["ari"]
|
||||
mkdir .tmp configs/pki
|
||||
let tmp_key = ".tmp/lab-ca-key.pem"
|
||||
(openssl req -x509 -newkey rsa:4096 -sha256 -days $days -nodes
|
||||
-keyout $tmp_key -out $cert
|
||||
-subj "/CN=Skyg Lab CA"
|
||||
-addext "basicConstraints=critical,CA:TRUE"
|
||||
-addext "keyUsage=critical,keyCertSign,cRLSign")
|
||||
^cat $tmp_key | agenix -e $key_secret
|
||||
rm -f $tmp_key
|
||||
print $"✅ CA cert: ($cert) — commit this"
|
||||
print $"✅ CA key encrypted: ($key_secret)"
|
||||
print "Next: skyg ca issue <domain> --for <host>"
|
||||
}
|
||||
|
||||
# Issue a TLS cert for a domain, signed by the lab CA.
|
||||
# Writes configs/pki/<domain>.crt; encrypts the key to secrets/<name>-tls-key.age.
|
||||
export def "skyg ca issue" [
|
||||
domain: string # e.g. buzz.app.internal
|
||||
--for: string # secrets.nix key name allowed to decrypt the leaf key (e.g. minipc1)
|
||||
--days: int = 825 # leaf lifetime (825 = browser max)
|
||||
--name: string # secret slug override (default: first DNS label)
|
||||
] {
|
||||
cd $REPO_ROOT
|
||||
let ca_cert = "configs/pki/lab-ca.crt"
|
||||
let ca_key_secret = "secrets/lab-ca-key.age"
|
||||
if not ($ca_cert | path exists) {
|
||||
error make {msg: "No CA found — run `skyg ca init` first"}
|
||||
}
|
||||
let key_names = (^cat secrets.nix | parse --regex '(\w+) = "ssh-' | get capture0)
|
||||
if ($for not-in $key_names) {
|
||||
error make {msg: $"Unknown recipient '($for)'. Known: ($key_names | str join ', ')"}
|
||||
}
|
||||
let slug = $name | default ($domain | split row "." | first)
|
||||
let secret = $"secrets/($slug)-tls-key.age"
|
||||
let cert = $"configs/pki/($domain).crt"
|
||||
if ($cert | path exists) {
|
||||
error make {msg: $"($cert) already exists — delete it manually to re-issue."}
|
||||
}
|
||||
ensure-secret-entry $secret ["ari" $for]
|
||||
mkdir .tmp configs/pki
|
||||
let ca_key = ".tmp/lab-ca-key.pem"
|
||||
agenix -d $ca_key_secret | save -f $ca_key
|
||||
let leaf_key = $".tmp/($slug)-tls-key.pem"
|
||||
let csr = $".tmp/($slug).csr"
|
||||
let ext = $".tmp/($slug)-ext.cnf"
|
||||
$"basicConstraints=critical,CA:FALSE\nkeyUsage=critical,digitalSignature,keyEncipherment\nextendedKeyUsage=serverAuth\nsubjectAltName=DNS:($domain)\n" | save -f $ext
|
||||
(openssl req -newkey rsa:2048 -nodes
|
||||
-keyout $leaf_key -out $csr
|
||||
-subj $"/CN=($domain)")
|
||||
(openssl x509 -req -in $csr
|
||||
-CA $ca_cert -CAkey $ca_key -CAcreateserial
|
||||
-out $cert -days $days -sha256 -extfile $ext)
|
||||
^cat $leaf_key | agenix -e $secret
|
||||
rm -f $ca_key $leaf_key $csr $ext
|
||||
print $"✅ Cert: ($cert) — commit this"
|
||||
print $"✅ Key encrypted: ($secret)"
|
||||
print $"Wire it up: age.secrets.($slug)-tls-key.file = ../($secret);"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
export const REPO_ROOT = path self | path dirname | path dirname | path dirname
|
||||
|
||||
# Insert a secrets.nix entry for the given secret path if missing.
|
||||
export def ensure-secret-entry [secret_path: string, recipients: list<string>] {
|
||||
let file = "secrets.nix"
|
||||
# Read via external cat — `open` type-guessing on .nix files is unreliable.
|
||||
let content = (^cat $file)
|
||||
if ($content | str contains $secret_path) {
|
||||
return
|
||||
}
|
||||
let entry = $' "($secret_path)".publicKeys = [ ($recipients | str join " ") ];'
|
||||
let lines = ($content | lines)
|
||||
# Insert before the final top-level closing brace.
|
||||
let closing = ($lines | enumerate | where item == "}" | last)
|
||||
if $closing == null {
|
||||
error make {msg: $"Could not find the final '}' in ($file) — refusing to edit"}
|
||||
}
|
||||
let new_lines = ($lines | insert $closing.index $entry)
|
||||
($new_lines | str join "\n") + "\n" | save -f $file
|
||||
print $"📝 Registered ($secret_path) in secrets.nix — review with git diff"
|
||||
}
|
||||
+15
-14
@@ -12,20 +12,21 @@ these cases where the source subdir and `~/.config` target differ.
|
||||
|
||||
## Contents
|
||||
|
||||
| Path | Description |
|
||||
|---|---|
|
||||
| `niri/` | Niri Wayland compositor config (legacy shared location — will be removed after hosts migrate to `<hostName>/niri/`) |
|
||||
| `fwbook/niri/` | Niri config for `fwbook`; linked to `~/.config/niri` by the `skyg.nixos.desktop.tiler.niri` module (mirrors the hyprland pattern) |
|
||||
| `fwbook/hypr/` | Hyprland config for `fwbook` (scrolling layout + noctalia); linked to `~/.config/hypr` |
|
||||
| `hl-fwdesk/hypr/` | Hyprland config for `hl-fwdesk` (Steam console); **baked into the build** via `mountAsSource`, linked to `~/.config/hypr` |
|
||||
| `hl-pi1/hypr/` | Hyprland config for `hl-pi1` (clock box); linked to `~/.config/hypr` |
|
||||
| `hl-fws1/hypr/` | Hyprland config for `hl-fws1` (remote slim desktop); **baked into the build** via `mountAsSource`, linked to `~/.config/hypr` |
|
||||
| `hl-pi1/quickshell/` | Quickshell configs for `hl-pi1` (full-screen clock + calendar); linked to `~/.config/quickshell` |
|
||||
| `fwbook/quickshell/` | Quickshell configs for `fwbook` (scrolling overview); linked to `~/.config/quickshell` |
|
||||
| `extra.nu` | Extra NuShell config sourced at shell startup |
|
||||
| `fwbook.knsv` | fwbook-specific Kanshi display profile |
|
||||
| `libinput-gestures.conf` | Touchpad gesture bindings |
|
||||
| `hypr-types/hl.lua` | Shared EmmyLua type stubs for the `hl` global; each host's Hyprland `.luarc.json` points here via `workspace.library` |
|
||||
| Path | Description |
|
||||
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `niri/` | Niri Wayland compositor config (legacy shared location — will be removed after hosts migrate to `<hostName>/niri/`) |
|
||||
| `fwbook/niri/` | Niri config for `fwbook`; linked to `~/.config/niri` by the `skyg.nixos.desktop.tiler.niri` module (mirrors the hyprland pattern) |
|
||||
| `fwbook/hypr/` | Hyprland config for `fwbook` (scrolling layout + noctalia); linked to `~/.config/hypr` |
|
||||
| `hl-fwdesk/hypr/` | Hyprland config for `hl-fwdesk` (Steam console); **baked into the build** via `mountAsSource`, linked to `~/.config/hypr` |
|
||||
| `hl-pi1/hypr/` | Hyprland config for `hl-pi1` (clock box); linked to `~/.config/hypr` |
|
||||
| `hl-fws1/hypr/` | Hyprland config for `hl-fws1` (remote slim desktop); **baked into the build** via `mountAsSource`, linked to `~/.config/hypr` |
|
||||
| `hl-pi1/quickshell/` | Quickshell configs for `hl-pi1` (full-screen clock + calendar); linked to `~/.config/quickshell` |
|
||||
| `fwbook/quickshell/` | Quickshell configs for `fwbook` (scrolling overview); linked to `~/.config/quickshell` |
|
||||
| `extra.nu` | Extra NuShell config sourced at shell startup |
|
||||
| `fwbook.knsv` | fwbook-specific Kanshi display profile |
|
||||
| `libinput-gestures.conf` | Touchpad gesture bindings |
|
||||
| `hypr-types/hl.lua` | Shared EmmyLua type stubs for the `hl` global; each host's Hyprland `.luarc.json` points here via `workspace.library` |
|
||||
| `pki/` | Public certs of the lab internal CA (`lab-ca.crt` + issued leaves), managed by `skyg ca`; **not** symlinked to `~/.config` — see `pki/ABOUTME.md` |
|
||||
|
||||
## Notes
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# configs/pki/
|
||||
|
||||
Public certificates of the lab internal CA. **Public material only** — private
|
||||
keys live encrypted in `secrets/` (`lab-ca-key.age`, `<name>-tls-key.age`),
|
||||
managed with agenix.
|
||||
|
||||
## Contents
|
||||
|
||||
| File | Description |
|
||||
|---|---|
|
||||
| `lab-ca.crt` | Root CA cert (`CN=Skyg Lab CA`). Trusted fleet-wide via `modules/core/lab-ca.nix` (`security.pki.certificateFiles`). |
|
||||
| `lab-ca.srl` | OpenSSL serial counter, written on first `ca issue`. Needed for unique serials — commit it. |
|
||||
| `<domain>.crt` | Leaf certs issued for services (e.g. `buzz.app.internal.crt`). |
|
||||
|
||||
## Managed by `skyg ca` (bin/lib/cmds.nu)
|
||||
|
||||
```sh
|
||||
skyg ca init # one-time: generate the root CA
|
||||
skyg ca issue buzz.app.internal --for minipc1 # mint a leaf for a service
|
||||
```
|
||||
|
||||
- `ca init` encrypts the CA key to `secrets/lab-ca-key.age` (recipient: `ari`
|
||||
only) and writes `lab-ca.crt` here. Refuses to overwrite an existing CA.
|
||||
- `ca issue` decrypts the CA key to `.tmp/`, signs a leaf (SAN = domain, EKU
|
||||
serverAuth, 825 days), encrypts the leaf key to `secrets/<name>-tls-key.age`
|
||||
(recipients: `ari` + the `--for` host), and writes `<domain>.crt` here.
|
||||
- Both commands auto-register missing entries in `secrets.nix` — review with
|
||||
`git diff` after running them.
|
||||
|
||||
Never hand-edit or commit keys here. Re-issuing: delete the leaf cert and
|
||||
re-run `ca issue`. Rotating the CA itself: delete `lab-ca.crt` +
|
||||
`secrets/lab-ca-key.age`, re-run `ca init`, re-issue all leaves, and rebuild
|
||||
every host (fleet trust comes from the committed root cert).
|
||||
@@ -0,0 +1,26 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEVTCCAj2gAwIBAgIUDQx8Jw/33WYA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||
VOgwl1or1NM0KDxFW/Rk6ghCVAhrvMi+dt4g7KC4B4T+oQCaslDNPxlfUzH53rXR
|
||||
ZAXZeubGIApQOWSuN8qJWhI9QzvhFB8Z4nGc5e263ahmLFCUOS96xBYilF1lcecV
|
||||
17S8PrD/iPzxtNr0+QywRaEWvcr4HkoIBqXz4eDItAblAHxQirsEW8zGQZnhLknP
|
||||
z3F0iyuc+D2xYIpWBQxJbX9+VSJhg9QwJAci9w66/KfbQsRdmIEe9OS1vjHBK0Mo
|
||||
9IGkkA/pIlHa53XnKdc5xaP9It+v+7vSwvf+8Bd+9xnlee+pwngyjSAVM8UcRxa/
|
||||
MatVc3nqoVfU70eTAAdm3Qo=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1 @@
|
||||
0D0C7C270FF7DD6600BBC42B9282088EC96C8C08
|
||||
+32
-5
@@ -36,9 +36,12 @@ let
|
||||
domain = "buzz.app.internal";
|
||||
port = 3000;
|
||||
ip = "10.0.101.3";
|
||||
# Caddy TLS terminator — buzz.app.internal points here (443/80).
|
||||
caddyIp = "10.0.101.5";
|
||||
bucket = "buzz-media";
|
||||
images = {
|
||||
relay = "ghcr.io/block/buzz:main";
|
||||
caddy = "caddy:2-alpine";
|
||||
posgres = "postgres:17-alpine";
|
||||
redis = "redis:7-alpine";
|
||||
minio = "quay.io/minio/minio:RELEASE.2025-09-07T16-13-09Z@sha256:14cea493d9a34af32f524e538b8346cf79f3321eff8e708c1e2960462bd8936e";
|
||||
@@ -255,6 +258,8 @@ in
|
||||
|
||||
# Buzz — relay + postgres + redis + minio (S3).
|
||||
age.secrets.buzz-env.file = ../secrets/buzz-env.age;
|
||||
# TLS key for buzz.app.internal, minted by `skyg ca issue` (lab CA).
|
||||
age.secrets.buzz-tls-key.file = ../secrets/buzz-tls-key.age;
|
||||
skyg.nixos.common.container-services.buzz = {
|
||||
enable = true;
|
||||
autoUpdate.enable = true;
|
||||
@@ -285,16 +290,15 @@ in
|
||||
internal = { };
|
||||
lan = { ipv4_address = buzz.ip; };
|
||||
};
|
||||
dns.names = [ buzz.domain ];
|
||||
environmentFiles = [ config.age.secrets.buzz-env.path ];
|
||||
environment = {
|
||||
BUZZ_BIND_ADDR = "0.0.0.0:${toString buzz.port}";
|
||||
BUZZ_HEALTH_PORT = "8080";
|
||||
BUZZ_METRICS_PORT = "9102";
|
||||
RELAY_URL = "ws://${buzz.domain}:${toString buzz.port}";
|
||||
BUZZ_MEDIA_BASE_URL = "http://${buzz.domain}:${toString buzz.port}/media";
|
||||
BUZZ_MEDIA_SERVER_DOMAIN = "${buzz.domain}:${toString buzz.port}";
|
||||
BUZZ_CORS_ORIGINS = "http://${buzz.domain}:${toString buzz.port}";
|
||||
RELAY_URL = "wss://${buzz.domain}";
|
||||
BUZZ_MEDIA_BASE_URL = "https://${buzz.domain}/media";
|
||||
BUZZ_MEDIA_SERVER_DOMAIN = buzz.domain;
|
||||
BUZZ_CORS_ORIGINS = "https://${buzz.domain}";
|
||||
BUZZ_S3_ENDPOINT = "http://minio:9000";
|
||||
BUZZ_S3_REGION = "us-east-1";
|
||||
BUZZ_S3_ADDRESSING_STYLE = "path";
|
||||
@@ -317,6 +321,29 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
# TLS terminator — owns buzz.app.internal (443/80), proxies to the relay
|
||||
# over the internal network. Cert minted by `skyg ca issue` (lab CA).
|
||||
caddy = {
|
||||
image = buzz.images.caddy;
|
||||
extraConfig.depends_on.relay.condition = "service_healthy";
|
||||
networks = {
|
||||
internal = { };
|
||||
lan = { ipv4_address = buzz.caddyIp; };
|
||||
};
|
||||
dns.names = [ buzz.domain ];
|
||||
files."/etc/caddy/Caddyfile" = ''
|
||||
${buzz.domain} {
|
||||
tls /etc/caddy/tls/cert.pem /etc/caddy/tls/key.pem
|
||||
encode zstd gzip
|
||||
reverse_proxy relay:${toString buzz.port}
|
||||
}
|
||||
'';
|
||||
volumes = [
|
||||
"${../../configs/pki/buzz.app.internal.crt}:/etc/caddy/tls/cert.pem:ro"
|
||||
"${config.age.secrets.buzz-tls-key.path}:/etc/caddy/tls/key.pem:ro"
|
||||
];
|
||||
};
|
||||
|
||||
postgres = {
|
||||
image = buzz.images.posgres;
|
||||
networks = [ "internal" ];
|
||||
|
||||
@@ -11,6 +11,7 @@ core/
|
||||
├── default.nix # Entry point: imports the files below + overlays + remote builder
|
||||
├── user.nix # skyg.user.* — the human user + Home Manager wiring
|
||||
├── nix-substituters.nix # skyg.core.substituters.* — binary caches & trusted keys
|
||||
├── lab-ca.nix # Fleet-wide trust of the lab internal CA (configs/pki/lab-ca.crt)
|
||||
└── macos.nix # skyg.user.macos.enableOverride — macOS-only HM tweaks
|
||||
```
|
||||
|
||||
@@ -29,6 +30,10 @@ core/
|
||||
and `bigbox2` caches, cache.nixos.org, cachix caches for cuda/cosmic/ai/noctalia, flox,
|
||||
devenv) and the trusted public keys. Extra entries can be appended per-host via
|
||||
`skyg.core.substituters.{urls,keys}`.
|
||||
- **Lab CA trust** (`lab-ca.nix`): adds `configs/pki/lab-ca.crt` to
|
||||
`security.pki.certificateFiles` so every machine trusts the lab internal CA
|
||||
(created by `skyg ca init`, see `configs/pki/ABOUTME.md`). Eval fails if the
|
||||
cert file is missing — run `skyg ca init` before the first rebuild.
|
||||
|
||||
## Option Namespace
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
./user.nix
|
||||
./macos.nix
|
||||
./nix-substituters.nix
|
||||
./lab-ca.nix
|
||||
];
|
||||
options = {
|
||||
skyg.rootDir = lib.mkOption {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{ ... }:
|
||||
{
|
||||
# Trust the lab internal CA on every machine (e.g. buzz.app.internal TLS).
|
||||
# The cert is created by `skyg ca init` (public certs in configs/pki/,
|
||||
# CA key encrypted in secrets/). Eval fails if the cert is missing —
|
||||
# run `skyg ca init` before rebuilding.
|
||||
security.pki.certificateFiles = [ ../../configs/pki/lab-ca.crt ];
|
||||
}
|
||||
@@ -34,4 +34,6 @@ in
|
||||
|
||||
# portainer agent envs
|
||||
"secrets/portainer-agent-bigbox1.age".publicKeys = [ ari bigbox1 ];
|
||||
"secrets/lab-ca-key.age".publicKeys = [ ari ];
|
||||
"secrets/buzz-tls-key.age".publicKeys = [ ari minipc1 ];
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user