diff options
| author | tv <tv@krebsco.de> | 2026-11-21 15:09:49 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-21 15:09:49 +0000 |
| commit | ab8c63531ca4a5d8eb185fcdafbe02122649416b (patch) | |
| tree | 3f56fda69675e59e8eab6c84361b6dfe57267feb /README.md | |
| parent | 4e480218c0777ba9342ce2edd3b00ff3488229b2 (diff) | |
run-firecracker-vm: secrets, --secret NAME=FILE and fc.secrets
Secrets for a guest, like API keys, had no way in but the store or
/xchg, which other VMs started in the same directory see. Now a layer
declares the secrets its guest needs (fc.secrets.NAME, with where it
goes, default /run/secrets/NAME, and whose it is, default root's, 0400),
and the run script gets them with --secret NAME=FILE (FILE read once,
so a pipe will do), refusing to start the guest without the declared
ones. Like the SSH host key, it copies them into its private temporary
directory and serves that via 9P on vsock port 568, to that guest only;
there, fc-secrets copies them into place, before sysinit.target (so
before any service with the default dependencies), but after the users
get created, and unmounts the share again. A secret the guest doesn't
declare goes to /run/secrets/NAME, root's, with a warning.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -156,6 +156,26 @@ Who may log in goes in a layer, e.g.: A guest's address is its VM's, by name (`vms`, see host setup), or else its tap's own (see `fc-egress vms`). +Secrets, like API keys, come from the host at boot, too, never through +the store or `/xchg` (which other VMs started in the same directory +see): a layer declares what it needs, where it goes (default: +`/run/secrets/NAME`), and whose it is (default: root's, 0400): + +```nix +{ fc.secrets."hermes.env" = { owner = "hermes"; }; } +``` + +and the run script, which doesn't start the guest without them, gets +them with `--secret NAME=FILE` (FILE read once, so a pipe will do): + +```sh +./result/bin/run-firecracker-vm --secret hermes.env=<(pass show hermes/env) +``` + +They're only that guest's, and only in its memory (`/run`), until it +stops; to change one, restart the guest. A secret the guest doesn't +declare ends up in `/run/secrets/NAME`, root's, with a warning. + The guest's system can be built in layers, each a NixOS module on top of the ones before (the first on top of the base system): |
