Enable console on serial port and print public ssh host key when booting

This commit is contained in:
fi 2023-08-01 14:21:06 +02:00
parent 6885c40c10
commit 8a16dd0af2
Signed by: fi
SSH key fingerprint: SHA256:d+6fQoDPMbSFK95zRVflRKZLRKF4cPSQb7VIxYkhFsA
3 changed files with 24 additions and 1 deletions

View file

@ -51,5 +51,23 @@
preliminarySelfsigned = true;
};
# Print the ed25519 public ssh host key to console when booting
systemd.units."print-public-ssh-host-key.service" = {
enable = true;
text = ''
[Unit]
Description=print-public-ssh-host-key.service
Before=getty@tty1.service
[Service]
Type=oneshot
ExecStart=/run/current-system/sw/bin/bash -c "/run/current-system/sw/bin/echo ----- ED25519 PUBLIC SSH HOST KEY -----\
&& /run/current-system/sw/bin/cut -d ' ' -f 1-2 /etc/ssh/ssh_host_ed25519_key.pub"
RemainAfterExit=no
StandardOutput=tty
'';
wantedBy = [ "multi-user.target" ];
};
services.fstrim.enable = true;
}