diff options
author | Kim Lindberger <kim.lindberger@gmail.com> | 2022-08-11 16:39:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-11 16:39:58 +0200 |
commit | 51998bc19e3c5f69184114d560844b5237b7c543 (patch) | |
tree | 6318aac30f7b04419bc38fefe75c359d52625b2f /nixos | |
parent | 964d60ff2e6bc76c0618962da52859603784fa78 (diff) | |
parent | d8b356caafb34d454737a79bb0fc6076f3da0b5d (diff) |
Merge pull request #185760 from michaeladler/fix-ssh-hostkey-gen
fix: ssh-keygen fails if directory does not exist
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/ssh/sshd.nix | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index 6da83eb7de10a..00ec15c54bc1c 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -435,13 +435,12 @@ in # socket activation, it goes to the remote side (#19589). exec >&2 - mkdir -m 0755 -p /etc/ssh - ${flip concatMapStrings cfg.hostKeys (k: '' if ! [ -s "${k.path}" ]; then if ! [ -h "${k.path}" ]; then rm -f "${k.path}" fi + mkdir -m 0755 -p "$(dirname '${k.path}')" ssh-keygen \ -t "${k.type}" \ ${if k ? bits then "-b ${toString k.bits}" else ""} \ |