feat(openssh): reconfigure hardening based on nixos wiki reccomendations

This commit is contained in:
Will Holdsworth 2026-03-09 17:41:04 +11:00
parent c6135ee301
commit 383989516c
Signed by: will-holdsworth
SSH key fingerprint: SHA256:Ykee8aymMJNAiYeeEmiwcIzkA1wgd4v8OZcWGxjq12c

View file

@ -42,18 +42,22 @@
};
# hardened openssh
services.openssh = {
allowSFTP = false;
extraConfig = ''
AllowTcpForwarding yes
X11Forwarding no
AllowAgentForwarding no
AllowStreamLocalForwarding no
AuthenticationMethods publickey
'';
services = {
fail2ban.enable = true;
endlessh = {
enable = true;
port = 22;
openFirewall = true;
};
openssh = {
enable = true;
ports = [ 5011 ];
settings = {
KbdInteractiveAuthentication = false;
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = "no";
AllowUsers = [ "srv" ];
};
};
};