Add hardening module and enable firewall, auditd,
and fail2ban
This commit is contained in:
23
modules/harden.nix
Normal file
23
modules/harden.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
networking.firewall.enable = true;
|
||||
|
||||
security.sudo.execWheelOnly = true;
|
||||
|
||||
security.sudo.wheelNeedsPassword = true;
|
||||
|
||||
security.auditd.enable = true;
|
||||
security.audit.enable = true;
|
||||
|
||||
services = {
|
||||
openssh = {
|
||||
enable = true;
|
||||
settings.PermitRootLogin = "no"; # distributed-build.nix requires it
|
||||
settings.PasswordAuthentication = false;
|
||||
allowSFTP = false;
|
||||
};
|
||||
fail2ban = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
nix.settings.allowed-users = [ "root" "@users" ];
|
||||
}
|
||||
Reference in New Issue
Block a user