From 4dd6ea85895430c1ef231c0f5ec1437bcb7ff0e9 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 21 Nov 2026 15:12:13 +0000 Subject: run-firecracker-vm: the SSH host key a secret, no --ssh-host-key The SSH host key had a way of its own into the guest: --ssh-host-key FILE (by default ~/.local/share/run-firecracker-vm/ssh_host_ed25519_key, created if it didn't exist), served via 9P on vsock port 567, and fc-ssh-host-key. Now it's a secret like any other: the base system declares it (fc.secrets.ssh_host_ed25519_key, at /run/ssh/ssh_host_ed25519_key, 0600, with sshd), so the run script requires --secret ssh_host_ed25519_key=FILE, and checks it as before (adding a missing final newline; no passphrase). There's no --ssh-host-key any more, nor a default key, and the secrets take over port 567. --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 303f2a7..3ee09f0 100644 --- a/README.md +++ b/README.md @@ -138,13 +138,15 @@ faster, but changes may not show up while the guest runs). Other modes: The guest gets 2 CPUs and 1024 MiB unless told otherwise (`--vcpus N`, 1 to 32; `--mem-size MIB`). -The guests run sshd. Its host key comes from the host at boot, so it's -not in the store: `--ssh-host-key FILE`, by default -`~/.local/share/run-firecracker-vm/ssh_host_ed25519_key`, created on first -use, so all your guests have the same one, and one known_hosts line does: +The guests run sshd. Its host key is a secret (see below), so it's not +in the store, and the run script requires it: `--secret +ssh_host_ed25519_key=FILE` (an ed25519 private key without passphrase). +With the same one for all your guests, one known_hosts line does: ```sh +ssh-keygen -t ed25519 -N "" -f ~/.local/share/run-firecracker-vm/ssh_host_ed25519_key echo "172.16.0.*,fdfc:fc::* $(cut -d' ' -f1,2 ~/.local/share/run-firecracker-vm/ssh_host_ed25519_key.pub)" >> ~/.ssh/known_hosts +./result/bin/run-firecracker-vm --secret ssh_host_ed25519_key=$HOME/.local/share/run-firecracker-vm/ssh_host_ed25519_key ``` Who may log in goes in a layer, e.g.: @@ -156,9 +158,9 @@ 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: +Secrets, like API keys (and that host key), come from the host at boot, +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 -- cgit v1.3.1