nix: update input julm-nix
[sourcephile-nix.git] / hosts / mermet / ssh.nix
index 6b55271f7744c0c7133f1a0b27952afa37b971cf..8a089dd3b4642b64a4240022fb92289af5ca9a6f 100644 (file)
@@ -1,4 +1,4 @@
-{ config, ... }:
+{ config, hostName, ... }:
 {
   networking.nftables.ruleset = ''
     table inet filter {
@@ -9,21 +9,20 @@
   '';
 
   services.openssh = {
-    gatewayPorts = "clientspecified";
     openFirewall = true;
+    settings.GatewayPorts = "clientspecified";
   };
   systemd.services.sshd.serviceConfig.LoadCredentialEncrypted = [
     "host.key:${ssh/host.key.cred}"
   ];
 
+  security.initrd.secrets."${hostName}/ssh/initrd.key" =
+    "hosts/${hostName}/ssh/initrd.key.gpg";
   boot.initrd.network.ssh = {
     enable = true;
-    # To prevent ssh from freaking out because a different host key is used,
-    # a different port for dropbear is useful
-    # (assuming the same host has also a normal sshd running)
     port = 2222;
     authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys;
-    hostKeys = [ "/root/initrd/ssh.key" ];
+    hostKeys = [ "${config.security.initrd.stage1Dir}/${hostName}/ssh/initrd.key" ];
   };
   boot.initrd.network = {
     enable = true;