diff options
Diffstat (limited to 'system-profiles/initrd-ssh/default.nix')
| -rw-r--r-- | system-profiles/initrd-ssh/default.nix | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/system-profiles/initrd-ssh/default.nix b/system-profiles/initrd-ssh/default.nix deleted file mode 100644 index ef469343..00000000 --- a/system-profiles/initrd-ssh/default.nix +++ /dev/null | |||
| @@ -1,47 +0,0 @@ | |||
| 1 | { hostName, config, pkgs, lib, ... }: | ||
| 2 | |||
| 3 | with lib; | ||
| 4 | |||
| 5 | { | ||
| 6 | config = { | ||
| 7 | boot.initrd = { | ||
| 8 | network = { | ||
| 9 | enable = true; | ||
| 10 | ssh = { | ||
| 11 | enable = true; | ||
| 12 | hostKeys = [ "/etc/ssh/ssh_host_ed25519_key" "/etc/ssh/ssh_host_rsa_key" ]; | ||
| 13 | authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys ++ map (kF: builtins.readFile kF) config.users.users.root.openssh.authorizedKeys.keyFiles; | ||
| 14 | |||
| 15 | extraConfig = '' | ||
| 16 | ForceCommand cryptsetup-askpass | ||
| 17 | ''; | ||
| 18 | }; | ||
| 19 | }; | ||
| 20 | |||
| 21 | secrets = with config.sops.secrets; { | ||
| 22 | "/etc/ssh/ssh_host_ed25519_key" = mkForce initrd_ssh_host_ed25519_key.path; | ||
| 23 | "/etc/ssh/ssh_host_rsa_key" = mkForce initrd_ssh_host_rsa_key.path; | ||
| 24 | }; | ||
| 25 | |||
| 26 | extraFiles = let | ||
| 27 | mkPubkey = typ: pkgs.runCommand "ssh_host_${typ}_key.pub" { buildInputs = with pkgs; [ yq ]; } '' | ||
| 28 | yq -r '.${typ}' ${./host-keys + "/${hostName}-public.yaml"} > $out | ||
| 29 | ''; | ||
| 30 | in { | ||
| 31 | "/etc/ssh/ssh_host_rsa_key.pub".source = mkPubkey "rsa"; | ||
| 32 | "/etc/ssh/ssh_host_ed25519_key.pub".source = mkPubkey "ed25519"; | ||
| 33 | }; | ||
| 34 | }; | ||
| 35 | |||
| 36 | sops.secrets = { | ||
| 37 | initrd_ssh_host_rsa_key = { | ||
| 38 | key = "rsa"; | ||
| 39 | sopsFile = ./host-keys + "/${hostName}-private.yaml"; | ||
| 40 | }; | ||
| 41 | initrd_ssh_host_ed25519_key = { | ||
| 42 | key = "ed25519"; | ||
| 43 | sopsFile = ./host-keys + "/${hostName}-private.yaml"; | ||
| 44 | }; | ||
| 45 | }; | ||
| 46 | }; | ||
| 47 | } | ||
