nixos/ec2-data fix host fingerprint output to console (regression)

PR #322282 introduced a regression that causes the previous display of
the ssh host key fingerprints to get directed to the journal rather than
the console (as intended). Thus, the console only logs an empty set of
fingerprints:

    -----BEGIN SSH HOST KEY FINGERPRINTS-----
    -----END SSH HOST KEY FINGERPRINTS-----

The fix is to reorder the bash statement that invokes ssh-keygen so
that the ssh-keygen output is directed to /dev/console.
This commit is contained in:
Bruce Toll 2025-03-15 13:16:03 -04:00
parent 2d3a45d000
commit ae4750868c

View file

@ -87,7 +87,7 @@ with lib;
# ec2-get-console-output.
echo "-----BEGIN SSH HOST KEY FINGERPRINTS-----" > /dev/console
for i in /etc/ssh/ssh_host_*_key.pub; do
${config.programs.ssh.package}/bin/ssh-keygen -l -f "$i" || true > /dev/console
${config.programs.ssh.package}/bin/ssh-keygen -l -f "$i" > /dev/console || true
done
echo "-----END SSH HOST KEY FINGERPRINTS-----" > /dev/console
'';