git.iko.soy/typeable/nixpkgs
on master help sign in
initrd-ssh service: ensure that keys got copied into initrd

Fixes #17927.

commit1df4dd6bf568a5eb75f07a60bda4e5ca406cc7b4 authorNikolay Amiantov <ab@fmap.me> dateTue 23 Aug 2016, 16:05 (10 years ago) parentab08440
1 file changed+7−3
nixos/modules/system/boot/initrd-ssh.nix+7−3
nixos/modules/system/boot/initrd-ssh.nix+7−3
@@ -93,6 +93,10 @@ in
9393 boot.initrd.extraUtilsCommands = ''
9494 copy_bin_and_libs ${pkgs.dropbear}/bin/dropbear
9595 cp -pv ${pkgs.glibc.out}/lib/libnss_files.so.* $out/lib
96+
97+ ${optionalString (cfg.hostRSAKey != null) "install -D ${cfg.hostRSAKey} $out/etc/dropbear/dropbear_rsa_host_key"}
98+ ${optionalString (cfg.hostDSSKey != null) "install -D ${cfg.hostDSSKey} $out/etc/dropbear/dropbear_dss_host_key"}
99+ ${optionalString (cfg.hostECDSAKey != null) "install -D ${cfg.hostECDSAKey} $out/etc/dropbear/dropbear_ecdsa_host_key"}
96100 '';
97101
98102 boot.initrd.extraUtilsCommandsTest = ''
@@ -108,9 +112,9 @@ in
108112 touch /var/log/lastlog
109113
110114 mkdir -p /etc/dropbear
111− ${optionalString (cfg.hostRSAKey != null) "ln -s ${cfg.hostRSAKey} /etc/dropbear/dropbear_rsa_host_key"}
112− ${optionalString (cfg.hostDSSKey != null) "ln -s ${cfg.hostDSSKey} /etc/dropbear/dropbear_dss_host_key"}
113− ${optionalString (cfg.hostECDSAKey != null) "ln -s ${cfg.hostECDSAKey} /etc/dropbear/dropbear_ecdsa_host_key"}
115+ ${optionalString (cfg.hostRSAKey != null) "ln -s $extraUtils/etc/dropbear/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key"}
116+ ${optionalString (cfg.hostDSSKey != null) "ln -s $extraUtils/etc/dropbear/dropbear_dss_host_key /etc/dropbear/dropbear_dss_host_key"}
117+ ${optionalString (cfg.hostECDSAKey != null) "ln -s $extraUtils/etc/dropbear/dropbear_ecdsa_host_key /etc/dropbear/dropbear_ecdsa_host_key"}
114118
115119 mkdir -p /root/.ssh
116120 ${concatStrings (map (key: ''