From a556852dd550fc0676708b89f9f0fcd6ff015250 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 20 Nov 2026 15:55:20 +0000 Subject: run-firecracker-vm: sshd, with a host key from the host The guests run sshd, started on demand, with an ed25519 host key that isn't in the store: the run script takes it from --ssh-host-key FILE, by default ~/.local/share/run-firecracker-vm/ssh_host_ed25519_key, created on first use, so a user's guests share one key and one known_hosts line covers them (see README.md), and serves a copy from its private temporary directory via 9P on vsock port 567. In the guest, fc-ssh-host-key copies it to /run/ssh (0600) before sshd starts, and unmounts the share again. Who may log in is up to a layer (users.users..openssh.authorizedKeys). --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 8aa03aa..b00e196 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,23 @@ not show up while the guest runs). Other modes: `mmap`, `readahead`, 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: + +```sh +echo "172.16.0.*,fdfc:fc::* $(cut -d' ' -f1,2 ~/.local/share/run-firecracker-vm/ssh_host_ed25519_key.pub)" >> ~/.ssh/known_hosts +``` + +Who may log in goes in a layer, e.g.: + +```nix +{ users.users.root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAA..." ]; } +``` + +A guest on tap fctapN is 172.16.0.(N+2) (see `fc-egress vms`). + 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): -- cgit v1.3.1