Server/ssh: add ssh host key

This commit is contained in:
Toast 2024-04-22 11:25:43 +02:00
parent a3d1a8a744
commit befadf8ed2

View file

@ -1,4 +1,23 @@
{...}: {
{
flakeSelf,
config,
...
}: let
hostSecrets = "${flakeSelf.inputs.secrets}/" + config.networking.hostName + "/";
hostKeyPath = "/etc/ssh/everest_host_key";
in {
age.secrets = {
everest-host-key = {
file = hostSecrets + "host-private-key.age";
path = hostKeyPath;
mode = "0400";
};
"everest-host-key.pub" = {
file = hostSecrets + "host-public-key.age";
path = hostKeyPath + ".pub";
};
};
services.openssh = {
enable = true;
settings = {
@ -6,6 +25,13 @@
PermitRootLogin = "no";
PasswordAuthentication = false;
};
hostKeys = [
{
path = hostKeyPath;
type = "ed25519";
comment = "Everest host key";
}
];
startWhenNeeded = true;
};
}