From 7559d061fdda8d00094026bd1647f6b4a50f3270 Mon Sep 17 00:00:00 2001 From: alexion Date: Wed, 7 Oct 2026 19:34:54 -0400 Subject: [PATCH] refactor(nixos): externalize SSH client keys --- configs/nixos/hosts/neogaia/ssh_user_ed25519_key.pub | 1 + configs/nixos/hosts/pikachu/ssh_user_ed25519_key.pub | 1 + configs/nixos/hosts/zeus/ssh_user_ed25519_key.pub | 1 + configs/nixos/modules/network/ssh.nix | 7 ++++--- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 configs/nixos/hosts/neogaia/ssh_user_ed25519_key.pub create mode 100644 configs/nixos/hosts/pikachu/ssh_user_ed25519_key.pub create mode 100644 configs/nixos/hosts/zeus/ssh_user_ed25519_key.pub diff --git a/configs/nixos/hosts/neogaia/ssh_user_ed25519_key.pub b/configs/nixos/hosts/neogaia/ssh_user_ed25519_key.pub new file mode 100644 index 0000000..93c84ad --- /dev/null +++ b/configs/nixos/hosts/neogaia/ssh_user_ed25519_key.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGxQ4kWsBo2OGYIPOkFe0vNEcB3yoJwAu0y9wrdQzALE alexion@neogaia diff --git a/configs/nixos/hosts/pikachu/ssh_user_ed25519_key.pub b/configs/nixos/hosts/pikachu/ssh_user_ed25519_key.pub new file mode 100644 index 0000000..dcbcbb3 --- /dev/null +++ b/configs/nixos/hosts/pikachu/ssh_user_ed25519_key.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINNqJIC6VRXyvrNf3n9su9KdPCikC3CjK/QrCK2reHdB alexion@pikachu diff --git a/configs/nixos/hosts/zeus/ssh_user_ed25519_key.pub b/configs/nixos/hosts/zeus/ssh_user_ed25519_key.pub new file mode 100644 index 0000000..16b5499 --- /dev/null +++ b/configs/nixos/hosts/zeus/ssh_user_ed25519_key.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIRBcHHuubptXCdvED/p2dR3MpjGN/AimqLasLY5984G alexion@zeus diff --git a/configs/nixos/modules/network/ssh.nix b/configs/nixos/modules/network/ssh.nix index 69c68b3..21de18e 100644 --- a/configs/nixos/modules/network/ssh.nix +++ b/configs/nixos/modules/network/ssh.nix @@ -37,22 +37,23 @@ let neogaia = { hostName = registry.address.neogaia.self; - clientKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGxQ4kWsBo2OGYIPOkFe0vNEcB3yoJwAu0y9wrdQzALE alexion@neogaia"; + clientKey = clientKeyFor "neogaia"; hostKeys = hostKeysFor "neogaia"; }; zeus = { hostName = registry.address.zeus.self; - clientKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIRBcHHuubptXCdvED/p2dR3MpjGN/AimqLasLY5984G alexion@zeus"; + clientKey = clientKeyFor "zeus"; hostKeys = hostKeysFor "zeus"; }; pikachu = { hostName = registry.address.pikachu.self; - clientKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINNqJIC6VRXyvrNf3n9su9KdPCikC3CjK/QrCK2reHdB alexion@pikachu"; + clientKey = clientKeyFor "pikachu"; hostKeys = hostKeysFor "pikachu"; }; }; + clientKeyFor = host: builtins.readFile (../../hosts + "/${host}/ssh_user_ed25519_key.pub"); hostKeysFor = host: map builtins.readFile [