configuration.nix/hosts/bifrost/services/ssh.nix

33 lines
809 B
Nix
Raw Normal View History

2024-11-17 10:28:43 +05:30
{ config, ... }:
let facts = config.nodeconfig.facts; in {
2024-11-23 00:25:40 +05:30
networking.firewall.interfaces = {
ens3.allowedTCPPorts = [ 2222 ];
ens4.allowedTCPPorts = [ 22 ];
};
2024-11-09 20:27:33 +05:30
services.openssh = {
enable = true;
2024-11-17 10:28:43 +05:30
openFirewall = false;
listenAddresses = [
2024-11-23 00:25:40 +05:30
{ addr = facts.external-ip; port = 2222; }
2024-11-17 10:28:43 +05:30
{ addr = facts.local-ip; port = 22; }
2024-11-23 00:25:40 +05:30
{ addr = facts.wireguard-ip; port = 22; }
2024-11-17 10:28:43 +05:30
];
2024-11-09 20:27:33 +05:30
settings = {
KbdInteractiveAuthentication = false;
PasswordAuthentication = false;
PermitRootLogin = "no";
};
hostKeys = [
{
path = "/persist/secrets/ssh/keys/ssh_host_ed25519_key";
type = "ed25519";
}
{
path = "/persist/secrets/ssh/keys/ssh_host_rsa_key";
type = "rsa";
bits = "4096";
}
];
};
}