mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
Merge pull request #32268 from volth/patch-74
nixos/initrd-ssh: generate hostkeys if absent
This commit is contained in:
commit
4844fbc267
@ -89,9 +89,6 @@ in
|
|||||||
|
|
||||||
config = mkIf (config.boot.initrd.network.enable && cfg.enable) {
|
config = mkIf (config.boot.initrd.network.enable && cfg.enable) {
|
||||||
assertions = [
|
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 != [];
|
{ assertion = cfg.authorizedKeys != [];
|
||||||
message = "You should specify at least one authorized key for initrd SSH";
|
message = "You should specify at least one authorized key for initrd SSH";
|
||||||
}
|
}
|
||||||
@ -121,7 +118,7 @@ in
|
|||||||
echo ${escapeShellArg key} >> /root/.ssh/authorized_keys
|
echo ${escapeShellArg key} >> /root/.ssh/authorized_keys
|
||||||
'') cfg.authorizedKeys)}
|
'') 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 =
|
boot.initrd.secrets =
|
||||||
|
Loading…
Reference in New Issue
Block a user