3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #185760 from michaeladler/fix-ssh-hostkey-gen

fix: ssh-keygen fails if directory does not exist
This commit is contained in:
Kim Lindberger 2022-08-11 16:39:58 +02:00 committed by GitHub
commit 51998bc19e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 ""} \