chore(modules/firewall): Rewrite to simplify

Also disable the ai filter for nodes that don't have nginx enabled
This commit is contained in:
Tom Hubrecht 2025-01-06 00:28:13 +01:00
parent e0cfd1ceb0
commit 3c9c38fb03
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc
2 changed files with 55 additions and 59 deletions

View file

@ -3,9 +3,9 @@
# SPDX-License-Identifier: EUPL-1.2
{
pkgs,
config,
lib,
name,
pkgs,
...
}:
@ -13,6 +13,7 @@ let
inherit (lib)
concatStringsSep
length
optionalAttrs
replicate
splitString
;
@ -85,7 +86,9 @@ in
stop = [ (nft "delete table inet reaction") ];
streams = streams'.default // (streams'.${name} or { });
streams = {
inherit (streams') ssh;
} // (optionalAttrs config.services.nginx.enable { inherit (streams') ai-crawlers; });
};
};
}

View file

@ -23,8 +23,9 @@ let
cmd = act "delete";
};
};
in
available = {
{
ai-crawlers = {
cmd = [
"tail"
@ -79,12 +80,4 @@ let
};
};
};
};
in
builtins.mapAttrs (_: builtins.foldl' (a: s: a // { ${s} = available.${s}; }) { }) {
default = [
"ai-crawlers"
"ssh"
];
}