about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2017-12-17 00:00:04 -0800
committerGitHub <noreply@github.com>2017-12-17 00:00:04 -0800
commit4844fbc2677344477c30f0c5fb8bbe4769a20006 (patch)
tree419a8f88941a7c5beab77b01c40caf00859d7015 /nixos
parent0fe97853058ae0833331ede92129f9d782c6d5ac (diff)
parentaf6fc78f5d08e36fa1d5af2ae3ceccd14c59c1a3 (diff)
downloadnixlib-4844fbc2677344477c30f0c5fb8bbe4769a20006.tar
nixlib-4844fbc2677344477c30f0c5fb8bbe4769a20006.tar.gz
nixlib-4844fbc2677344477c30f0c5fb8bbe4769a20006.tar.bz2
nixlib-4844fbc2677344477c30f0c5fb8bbe4769a20006.tar.lz
nixlib-4844fbc2677344477c30f0c5fb8bbe4769a20006.tar.xz
nixlib-4844fbc2677344477c30f0c5fb8bbe4769a20006.tar.zst
nixlib-4844fbc2677344477c30f0c5fb8bbe4769a20006.zip
Merge pull request #32268 from volth/patch-74
nixos/initrd-ssh: generate hostkeys if absent
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/initrd-ssh.nix5
1 files changed, 1 insertions, 4 deletions
diff --git a/nixos/modules/system/boot/initrd-ssh.nix b/nixos/modules/system/boot/initrd-ssh.nix
index d78775c27582..cdeff4845948 100644
--- a/nixos/modules/system/boot/initrd-ssh.nix
+++ b/nixos/modules/system/boot/initrd-ssh.nix
@@ -89,9 +89,6 @@ in
 
   config = mkIf (config.boot.initrd.network.enable && cfg.enable) {
     assertions = [
-      { assertion = cfg.hostRSAKey != null || cfg.hostDSSKey != null || cfg.hostECDSAKey != null;
-        message = "You should specify at least one host key for initrd SSH";
-      }
       { assertion = cfg.authorizedKeys != [];
         message = "You should specify at least one authorized key for initrd SSH";
       }
@@ -121,7 +118,7 @@ in
         echo ${escapeShellArg key} >> /root/.ssh/authorized_keys
       '') cfg.authorizedKeys)}
 
-      dropbear -s -j -k -E -m -p ${toString cfg.port}
+      dropbear -s -j -k -E -m -p ${toString cfg.port} ${optionalString (cfg.hostRSAKey == null && cfg.hostDSSKey == null && cfg.hostECDSAKey == null) "-R"}
     '';
 
     boot.initrd.secrets =