debug agent

This commit is contained in:
ari committed 2026-11-11 17:02:36 -05:00
1 parent 2547ec45b4
commit 09c6fe2235
19 files changed
+203 -8

No files matched your search

+14
View File
@@ -15,6 +15,7 @@ common/
├── user.nix # skyg.user.createSystemUser — creates the system user/groups + zsh shell
├── fonts.nix # System font packages + fontconfig defaults (Fira Code, Noto, …); skyg.nixos.common.fonts.minimal
├── ssh-server.nix # skyg.nixos.common.ssh-server — hardened sshd + master public keys (list)
├── diagnix/ # skyg.nixos.common.diagnix — read-only user nbot uses to diagnose hosts
├── qemu.nix # skyg.core.qemu — QEMU/quickemu + SPICE guest tooling
├── binary-cache.nix # skyg.nixos.common.cachePush — push finished builds to the bigbox2 cache
@@ -38,6 +39,18 @@ common/
- **`ssh-server.nix`** ships the master public keys (`masterPubKeys`, a list so a key can be
rotated by adding the new one before dropping the old) and a hardened sshd config
(key-only auth, long keepalives). Disabled by default.
- **`diagnix/`** adds a read-only `diagnix` user (uid 2950) that nbot uses over SSH, via
`lab-ssh` in the agent system (`server/services/nbot-agent.nix`). It reads logs
(`systemd-journal` group), units, `/proc` and the store, and can't change anything. It
can't read root-only files. Through sudo it can run only the fixed `diag-*` scripts
(docker ps/logs, smart, ports, firewall, btrfs, io). The key is `restrict,pty` and only
works from the nbot hosts (`hosts.nix`). Hosts running nbot also let their own containers
reach port 22 and accept them from private IPs outside the LAN. Their IPs are random, so
they can't be listed. Resources are capped (1G memory, 1 CPU, 256 tasks). The Nix daemon
is left open on purpose: an allow-list would break nix-serve/buildbot.
The private key (base64) is `DIAGNIX_KEY` in the `nbot-goose` secret; fwdesk passes it to
every container via `agent_env`.
`hosts.nix` also holds each host's address and host key; the agent pins those keys.
## Option Namespace
@@ -46,6 +59,7 @@ skyg.core.hostName → networking.nix
skyg.user.createSystemUser → user.nix
skyg.core.qemu.* → qemu.nix
skyg.nixos.common.ssh-server.* → ssh-server.nix
skyg.nixos.common.diagnix.* → diagnix/
skyg.nixos.common.cachePush.* → binary-cache.nix
skyg.nixos.common.minimal → core.nix (skip heavy always-on system packages)