forked from DGNum/infrastructure
chore(modules/firewall): Rewrite to simplify
Also disable the ai filter for nodes that don't have nginx enabled
This commit is contained in:
parent
e0cfd1ceb0
commit
3c9c38fb03
2 changed files with 55 additions and 59 deletions
|
@ -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; });
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue