34 lines
601 B
Nix
34 lines
601 B
Nix
{
|
|
privateKey,
|
|
publicKey,
|
|
username,
|
|
...
|
|
}:
|
|
{
|
|
# default host key location
|
|
environment.etc."ssh/ssh_host_ed25519_key" = {
|
|
text = privateKey;
|
|
mode = "0600";
|
|
};
|
|
environment.etc."ssh/ssh_host_ed25519_key.pub" = {
|
|
text = publicKey;
|
|
mode = "0644";
|
|
};
|
|
|
|
services.openssh = {
|
|
enable = true;
|
|
settings = {
|
|
PasswordAuthentication = false;
|
|
PermitRootLogin = "no";
|
|
AllowUsers = [ "${username}" ];
|
|
};
|
|
generateHostKeys = false;
|
|
hostKeys = [
|
|
{
|
|
path = "/etc/ssh/ssh_host_ed25519_key";
|
|
type = "ed25519";
|
|
}
|
|
];
|
|
};
|
|
}
|