feat: allow specifying host pubkey as string

This commit is contained in:
oddlama 2023-05-21 16:01:49 +02:00
parent cbcd3c943b
commit a0d22b8be1
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
4 changed files with 16 additions and 13 deletions

View file

@ -3,6 +3,7 @@
lib,
nodeName,
nodePath,
options,
...
}: {
# IP address math library
@ -198,10 +199,12 @@
# current system due to yubikey availability.
forceRekeyOnSystem = builtins.extraBuiltins.unsafeCurrentSystem;
hostPubkey = let
pubkeyPath = nodePath + "/secrets/host.pub";
pubkeyPath =
if nodePath == null
then null
else nodePath + "/secrets/host.pub";
in
lib.mkIf (lib.pathExists pubkeyPath || lib.trace "Missing pubkey for ${nodeName}: ${toString pubkeyPath} not found, using dummy replacement key for now." false)
pubkeyPath;
lib.mkIf (pubkeyPath != null && lib.pathExists pubkeyPath) pubkeyPath;
};
boot = {

View file

@ -39,4 +39,14 @@
test = defineVm 11;
#hi = defineVm 12;
};
microvm.vms.test.config = {
imports = [
../common/core
../../users/root
];
home-manager.users.root.home.minimal = true;
rekey.hostPubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBXXjI6uB26xOF0DPy/QyLladoGIKfAtofyqPgIkCH/g";
};
}

View file

@ -1,9 +0,0 @@
{
imports = [
../../../common/core
../../../../users/root
];
home-manager.users.root.home.minimal = true;
}

View file

@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBXXjI6uB26xOF0DPy/QyLladoGIKfAtofyqPgIkCH/g