2023-07-26 14:10:22 +03:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
myData,
|
|
|
|
...
|
2024-07-29 15:39:54 +03:00
|
|
|
}:
|
|
|
|
{
|
2023-09-14 06:41:16 +03:00
|
|
|
options.mj.services.sshguard = with lib.types; {
|
2023-07-26 14:10:22 +03:00
|
|
|
enable = lib.mkOption {
|
|
|
|
type = bool;
|
2023-09-14 06:41:16 +03:00
|
|
|
default = false;
|
2023-07-26 14:10:22 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-09-14 06:41:16 +03:00
|
|
|
config = lib.mkIf config.mj.services.sshguard.enable {
|
2023-07-26 14:10:22 +03:00
|
|
|
services.sshguard = {
|
|
|
|
enable = true;
|
|
|
|
blocktime = 900;
|
2024-07-29 15:39:54 +03:00
|
|
|
whitelist = [
|
|
|
|
"192.168.0.0/16"
|
|
|
|
myData.subnets.tailscale.cidr
|
|
|
|
] ++ (lib.catAttrs "publicIP" (lib.attrValues myData.hosts));
|
2023-07-26 14:10:22 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|