add agent-lab sandbox VM on muede-pc2

This commit is contained in:
müde 2026-11-18 18:40:12 +01:00
commit 873622dc8a

View file

@ -0,0 +1,39 @@
{
imports = [ ./hardware.nix ];
config = {
# A deliberately disposable box: hyperhive agents ssh in as root and apply
# whatever config they are testing, up to and including breaking it. The
# host (see ../muede-pc2/agent-lab-vm.nix) only ever seeds the disk and
# runs qemu — it never declares this system's config, so the guest is free
# to `nixos-rebuild switch` itself out from under the seed.
# Agents log in by certificate, not by key. sshd accepts one the swarm's
# SSH CA signed, and the single principal on it names the agent, so the
# list below is what admits atlas and maia and nobody else. Dropping a name
# ends that agent's logins at its next attempt; a signed certificate
# expires within three hours either way.
#
# Spelled out rather than imported from hyperhive.nixosModules.agent-ssh-target
# on purpose: this VM should not take the hyperhive flake as an input.
# Re-read the CA key from the swarm's store after the CA is regenerated:
# bao read -field=public_key ssh-agents/config/ca
environment.etc."ssh/hyperhive-agent-ssh-ca.pub".text =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILHGXr3Voq/SVorEoBY5cDMqTumQyHMweNQvWcSvTXuN\n";
services.openssh.settings.TrustedUserCAKeys = "/etc/ssh/hyperhive-agent-ssh-ca.pub";
users.users.root.openssh.authorizedPrincipals = [
"atlas"
"maia"
];
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO1CRn4yYTL4XUdCebE8Z4ZeuMujBjorTdWifg911EOv pc2 home roaming"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPDNpLDmctyqGpow/ElQvdhY4BLBPS/sigDJ1QEcC7wC lpt2-roaming"
# muede-pc2's build key, reused as the host's provisioning identity: it is
# how /etc/nix/netrc reaches the guest after boot without the credential
# ever passing through the nix store. Private half stays on the host in
# /etc/nix/distributed-build-key.
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHmnyhP6L+kGHV15cb/d31AQr50wSEaQhkUBwy2+OEKk muede-pc2-nix-builds"
];
};
}