Add fail2ban SSH protection
This commit is contained in:
parent
6b04b535c1
commit
3d4dc62dc9
1 changed files with 21 additions and 2 deletions
23
base.nix
23
base.nix
|
@ -72,12 +72,31 @@
|
|||
'';
|
||||
|
||||
#################### SSH configuration ####################
|
||||
services.openssh.enable = true;
|
||||
services.openssh.settings.PasswordAuthentication = false;
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings.PasswordAuthentication = false;
|
||||
};
|
||||
users.users.root.openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBbGREoK1uVny1s8FK3KZ74Wmaf0VtifhqPyK69C/Gez vili@helium"
|
||||
];
|
||||
|
||||
#################### Basic fail2ban configuration ####################
|
||||
services.fail2ban = {
|
||||
enable = true;
|
||||
bantime = "1h";
|
||||
bantime-increment = {
|
||||
enable = true;
|
||||
factor = "2";
|
||||
formula = "ban.Time * (1 << (min(ban.Count, 6) * banFactor))";
|
||||
maxtime = "90d";
|
||||
};
|
||||
jails = {
|
||||
DEFAULT.settings = {
|
||||
findtime = 3600;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#################### BASE ####################
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue