nixos/palace: Let slop-broker change secrets
The broker gets its age identity and `slop secret` for agents. Listing keys doesn't ask; everything else does, with approvals checked against `master`, which only Dev can push to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0de9124c3a
commit
cb4937f230
6 files changed
+77
-9
No files matched your search
@@ -199,6 +199,7 @@ minutes for a human. See [`docs/slop-broker.md`](docs/slop-broker.md).
|
||||
`--host <user>@<host>` reaches other boxes.
|
||||
- `slop deploy <node>…` builds and deploys a pushed commit; `--boot` stages it for the next boot.
|
||||
- `slop build <attr>…` builds a pushed commit's flake attributes into the binary cache.
|
||||
- `slop secret keys|read|set|generate|rekey <file>` changes age secrets instead of `ragenix`.
|
||||
- `slop requests` lists your pending requests and leases.
|
||||
|
||||
## Secrets
|
||||
|
||||
@@ -204,6 +204,11 @@ the agents on `slop-cannon` after policy and, usually, a human approve them.
|
||||
as `harmonia`, with a key of the broker's own (age secret `palace/slop-broker-cache.key`) whose
|
||||
forced command allows only the store protocol and adding GC roots (see
|
||||
[Binary cache](../../slop-broker.md#binary-cache)).
|
||||
- The broker's age identity (age secret `palace/slop-broker-age.key`, public key
|
||||
`.keys/slop-broker.pub`) is a recipient of every secret, so it can carry out `slop secret`. Its
|
||||
builder looks each request's file up on `master` and evaluates `master`'s `secrets.nix` for the
|
||||
approval (see [Secrets](../../slop-broker.md#secrets)). Listing a secret's keys doesn't ask;
|
||||
everything else does, and reading one never offers a lease.
|
||||
- Answer requests on `palace` as `dev` with `slop-approve`. In a terminal it shows each request
|
||||
in full, asks for an answer and waits for new ones; `slop-approve list` and
|
||||
`slop-approve <id> <decision>` (any unique ID prefix) work from scripts. `slop-approve log`
|
||||
|
||||
+26
-9
@@ -1,7 +1,7 @@
|
||||
# slop-broker
|
||||
|
||||
[`slop-broker`](https://git.nul.ie/dev/slop-broker) carries out privileged operations (SSH
|
||||
commands, deploys, builds, and later secrets, DNS and previews) for the coding agents on
|
||||
commands, deploys, builds and age secrets, and later DNS and previews) for the coding agents on
|
||||
[`slop-cannon`](sites/home/slop-cannon.md) and other boxes, under a policy and usually after Dev
|
||||
approves each one. Agents use the `slop` CLI.
|
||||
|
||||
@@ -56,6 +56,27 @@ the store protocol and GC roots (`services.slop-broker-cache` in `object`'s conf
|
||||
collects garbage in that store on every run, which the roots survive until they expire (see the
|
||||
[design](https://git.nul.ie/dev/slop-broker/src/branch/main/docs/design.md#binary-cache)).
|
||||
|
||||
## Secrets
|
||||
|
||||
`slop secret` lets agents change age secrets without the dev key. The broker's own age identity
|
||||
(`palace/slop-broker-age.key`, public key `.keys/slop-broker.pub`) is in `defaultKeys` in
|
||||
[`secrets.nix`](../secrets.nix), so every secret is encrypted to it; adding it took one full rekey.
|
||||
|
||||
- The agent sends the `.age` file from its checkout, and the broker returns new ciphertext, which
|
||||
the agent commits. Recipients come from the agent's `secrets.nix`.
|
||||
- Before approval, the builder fetches `master`, looks the file's content up there and evaluates
|
||||
`master`'s `secrets.nix`. The approval says which file the content really is and whether the
|
||||
recipients match `master`'s rules for it (see the
|
||||
[design](https://git.nul.ie/dev/slop-broker/src/branch/main/docs/design.md#secrets)).
|
||||
- `secrets.names` labels `dev` and `slop-broker` in approvals (`lib.my.c.ageKeyFiles`); host keys
|
||||
are shown abbreviated.
|
||||
|
||||
### `master` is protected
|
||||
|
||||
Deploy approvals ("on the branch", the diff since `master`) and secret approvals both trust
|
||||
`master`, so only Dev may push to it: branch protection on `dev/nixfiles` in Gitea refuses pushes
|
||||
from deploy keys, including `slop-cannon`'s.
|
||||
|
||||
## Approvals web app
|
||||
|
||||
`middleman` proxies `approve.slop.nul.ie` to port 8095 on `palace`. Approvers sign in through
|
||||
@@ -80,11 +101,7 @@ for simplicity.
|
||||
Each step updates this page, the box pages and `AGENTS.md` as it lands.
|
||||
|
||||
1. **Done:** `slop.nul.ie`; the broker core, box queries, SSH transport, deploys and builds on
|
||||
`palace`; `castle` over SSH; Pocket ID at `id.nul.ie`.
|
||||
2. **Approvals web app:** remove the temporary `http://localhost:8095/auth/callback` from the
|
||||
`slop-approve` client, deploy `palace` and `middleman`.
|
||||
3. **Secrets:** the broker's age identity joins `.keys/dev.pub` in the recipients that
|
||||
`secrets.nix` generates (one full rekey), so the dev key never goes to `palace`.
|
||||
4. **DNS**, with a Cloudflare token of the broker's own for the public zones.
|
||||
5. **Previews** on `*.slop.nul.ie`, through `middleman`.
|
||||
6. **TCP forwards and a cache for VM builds**, if needed.
|
||||
`palace`; `castle` over SSH; Pocket ID at `id.nul.ie`; the approvals web app; secrets.
|
||||
2. **DNS**, with a Cloudflare token of the broker's own for the public zones.
|
||||
3. **Previews** on `*.slop.nul.ie`, through `middleman`.
|
||||
4. **TCP forwards and a cache for VM builds**, if needed.
|
||||
@@ -517,4 +517,9 @@ rec {
|
||||
sshHostKeys = {
|
||||
mail-vm = ../.keys/mail-vm-host.pub;
|
||||
};
|
||||
# age recipients that every secret is encrypted to (see `secrets.nix`)
|
||||
ageKeyFiles = {
|
||||
dev = ../.keys/dev.pub;
|
||||
slop-broker = ../.keys/slop-broker.pub;
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
nixos.systems.palace.configuration = { lib, config, allAssignments, ... }:
|
||||
let
|
||||
inherit (lib) mapAttrs fileContents;
|
||||
|
||||
# `slop-cannon`'s vsock address; the kernel reports it for every connection from the guest
|
||||
slopCannonCid = 3;
|
||||
|
||||
@@ -27,6 +29,11 @@
|
||||
owner = "root";
|
||||
mode = "0400";
|
||||
};
|
||||
# The broker's age identity, a recipient of every secret (`.keys/slop-broker.pub`)
|
||||
"palace/slop-broker-age.key" = {
|
||||
owner = "root";
|
||||
mode = "0400";
|
||||
};
|
||||
# Read-only deploy key for `dev/nixfiles` on Gitea
|
||||
"palace/slop-broker-git.key" = {
|
||||
owner = "slop-broker-build";
|
||||
@@ -106,6 +113,17 @@
|
||||
action = "ask";
|
||||
leases = [ "5m" "1h" ];
|
||||
};
|
||||
# Approvals show whether the file and its recipients match `master`; reading always asks
|
||||
secret = {
|
||||
action = "ask";
|
||||
leases = [ "5m" ];
|
||||
rules = [
|
||||
{
|
||||
match.action = "keys";
|
||||
action = "auto";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
requesters.slop-cannon = {
|
||||
@@ -136,6 +154,13 @@
|
||||
keyFile = config.age.secrets."palace/slop-broker-cache.key".path;
|
||||
};
|
||||
|
||||
# Checked against `master`'s `secrets.nix`, which only people can push to
|
||||
secrets = {
|
||||
enable = true;
|
||||
identityFile = config.age.secrets."palace/slop-broker-age.key".path;
|
||||
names = mapAttrs (_: fileContents) lib.my.c.ageKeyFiles;
|
||||
};
|
||||
|
||||
# `approve.slop.nul.ie`, published by `middleman`; approvers sign in with Pocket ID
|
||||
web = {
|
||||
enable = true;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IGV0MnpwUSBQMVFG
|
||||
c1ovQlR5emJhN2x4clB2VXQxa0xPYUEyRUlOKzlZZ1lFQmhIcTJBCkF2YUJMelA3
|
||||
YU4rM09FTGhTTi9GVWQrN2VpeTFBVjQ5NjhNU2piZS82SVUKLT4gWDI1NTE5IDRx
|
||||
SXIrbmJ4TnNyQ3dnVEZwSEY4SmtoUzIwSXhBZzMzYldsQ0V6bERHVlUKWlRhQkFx
|
||||
ZjZhbWltVDUxS1R1ZFNLZVNFZ3Z1VTVGa3l4dTZiWVV6NTJZZwotPiBYMjU1MTkg
|
||||
ajNSR0QveDhiS0ZzZXVlQllRMVN1VTVDTUhQaW5PbkVwRGtMNzlEL3R5NApWdE5u
|
||||
KzI4UG8xMVFnc1FSdmVRWG5xcW9uTWRUWUNiL3FQaVFjSGdVemE0Ci0+ICQtZ3Jl
|
||||
YXNlCms3Y1ExM3o4Ci0tLSBiMXlPUC84OVhIZXRzTWZKUDJYK094MlcyWmpNMjJn
|
||||
WUptQVNtOTlWYlRVCs9SZYCVHv3ykvGx6/M2tC+mxmzFwKdSR2IGkemya+8W/DQ4
|
||||
8rvtF7Up1BB/KZWysQJj+do3JDcxn3WuSa5pcKlP6JLmawavu2KTxQ/WSPH1ittV
|
||||
SgZrR/axIKcZiIB4ZI9er/2nohRvnqepMJF9lqzQnFjK1Nk/YULOJYCb2/iLPLqE
|
||||
VknJe4wgaSQD/YaweBFQ6brwWuZBE8eopC210GhXSEXR+Slv6dxl0bmpOORcTCKp
|
||||
2fv+Z3eiasGSac1Utm+Q2M2sInwRkZUH9fHbm+pzqPAybH+5HQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
Reference in new issue
Block a user