3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #99173 from johanot/fix-initrd-ssh-commands-test

nixos/initrd-ssh: set more defensive pemissions on sshd test key
This commit is contained in:
Sarah Brofeldt 2020-11-29 11:27:03 +01:00 committed by GitHub
commit a7a5f7904c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,9 +159,14 @@ in
boot.initrd.extraUtilsCommandsTest = ''
# sshd requires a host key to check config, so we pass in the test's
tmpkey="$(mktemp initrd-ssh-testkey.XXXXXXXXXX)"
cp "${../../../tests/initrd-network-ssh/ssh_host_ed25519_key}" "$tmpkey"
# keys from Nix store are world-readable, which sshd doesn't like
chmod 600 "$tmpkey"
echo -n ${escapeShellArg sshdConfig} |
$out/bin/sshd -t -f /dev/stdin \
-h ${../../../tests/initrd-network-ssh/ssh_host_ed25519_key}
-h "$tmpkey"
rm "$tmpkey"
'';
boot.initrd.network.postCommands = ''