dedupe ssh config
This commit is contained in:
parent
f0fca1bad4
commit
01cc32ee50
3 changed files with 19 additions and 40 deletions
17
modules/common/ssh.nix
Normal file
17
modules/common/ssh.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
{
|
||||||
|
options.quad.ssh.enable = lib.mkEnableOption "the SSH server, with key-only login as quadradical";
|
||||||
|
|
||||||
|
config = lib.mkIf config.quad.ssh.enable {
|
||||||
|
users.users.quadradical.openssh.authorizedKeys.keys = import ../../secrets/keys.nix;
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
openFirewall = true;
|
||||||
|
settings = {
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
AllowUsers = [ "quadradical" ];
|
||||||
|
PermitRootLogin = "no";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,12 +1 @@
|
||||||
{
|
{ quad.ssh.enable = true; }
|
||||||
users.users.quadradical.openssh.authorizedKeys.keys = import ../../secrets/keys.nix;
|
|
||||||
services.openssh = {
|
|
||||||
enable = true;
|
|
||||||
openFirewall = true;
|
|
||||||
settings = {
|
|
||||||
PasswordAuthentication = false;
|
|
||||||
AllowUsers = [ "quadradical" ];
|
|
||||||
PermitRootLogin = "no";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1 @@
|
||||||
{
|
{ quad.ssh.enable = true; }
|
||||||
users.users.quadradical.openssh.authorizedKeys.keys = import ../../secrets/keys.nix;
|
|
||||||
services = {
|
|
||||||
openssh = {
|
|
||||||
enable = true;
|
|
||||||
openFirewall = true;
|
|
||||||
settings = {
|
|
||||||
PasswordAuthentication = false;
|
|
||||||
AllowUsers = [ "quadradical" ];
|
|
||||||
PermitRootLogin = "no";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
fail2ban = {
|
|
||||||
enable = true;
|
|
||||||
maxretry = 5;
|
|
||||||
ignoreIP = [ "192.168.0.0/16" ];
|
|
||||||
bantime = "6h";
|
|
||||||
bantime-increment = {
|
|
||||||
enable = true;
|
|
||||||
formula = "ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)";
|
|
||||||
maxtime = "240h";
|
|
||||||
overalljails = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue