From eb990d3ec3cdd13b612af6013960a8ddfc27fd97 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 6 Jan 2024 17:15:44 +0100 Subject: [PATCH] docs: improve SSH host key rebuild process --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index de48121..1ea447c 100644 --- a/README.md +++ b/README.md @@ -40,13 +40,12 @@ nix build '.#nixosConfigurations.test-vm.config.system.build.vm' ./result/bin/run-nixos-vm # In another terminal, get the ed25519 SSH hostkey, then stop the VM with CTRL-c -ssh-keyscan -p 2222 127.0.0.1 | grep ssh-ed25519 -... -[127.0.0.1]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMdCOs16W731ftPDqO+X6RZVSdwVVNw2Xfmcpk5pzbeO + +SSH_HOST_KEY=$(ssh-keyscan -p 2222 127.0.0.1 | grep '\[127.0.0.1\]:2222 ssh-ed25519' | awk '{print $2 " " $3}') # Edit secrets.nix and add the SSH hostkey to machine 'test-vm', starting with 'ssh-ed25519 ...' sed --in-place \ - 's|test-vm = .*|test-vm = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMdCOs16W731ftPDqO+X6RZVSdwVVNw2Xfmcpk5pzbeO host@test-vm";|' \ + "s|test-vm = .*|test-vm = \"$SSH_HOST_KEY host@test-vm\";|" \ secrets/secrets.nix # Rekey the secrets with agenix