forked from DGNum/infrastructure
feat(firewall): Ban AI crawlers
This commit is contained in:
parent
c4108a62ab
commit
e0cfd1ceb0
1 changed files with 41 additions and 1 deletions
|
@ -25,6 +25,43 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
available = {
|
available = {
|
||||||
|
ai-crawlers = {
|
||||||
|
cmd = [
|
||||||
|
"tail"
|
||||||
|
"-n0"
|
||||||
|
"-f"
|
||||||
|
"/var/log/nginx/access.log"
|
||||||
|
];
|
||||||
|
|
||||||
|
filters.bots = {
|
||||||
|
regex = builtins.map (name: ''^<ip>.*"[^"]*${name}[^"]*"$'') [
|
||||||
|
"AI2Bot"
|
||||||
|
"Amazonbot"
|
||||||
|
"Applebot"
|
||||||
|
"Applebot-Extended"
|
||||||
|
"Bytespider"
|
||||||
|
"CCBot"
|
||||||
|
"ChatGPT-User"
|
||||||
|
"ClaudeBot"
|
||||||
|
"Diffbot"
|
||||||
|
"DuckAssistBot"
|
||||||
|
"FacebookBot"
|
||||||
|
"GPTBot"
|
||||||
|
"Google-Extended"
|
||||||
|
"Kangaroo Bot"
|
||||||
|
"Meta-ExternalAgent"
|
||||||
|
"Meta-ExternalFetcher"
|
||||||
|
"OAI-SearchBot"
|
||||||
|
"PerplexityBot"
|
||||||
|
"Timpibot"
|
||||||
|
"Webzio-Extended"
|
||||||
|
"YouBot"
|
||||||
|
"omgili"
|
||||||
|
];
|
||||||
|
actions = ban "720h";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
ssh = {
|
ssh = {
|
||||||
cmd = journalctl "sshd";
|
cmd = journalctl "sshd";
|
||||||
|
|
||||||
|
@ -46,5 +83,8 @@ let
|
||||||
in
|
in
|
||||||
|
|
||||||
builtins.mapAttrs (_: builtins.foldl' (a: s: a // { ${s} = available.${s}; }) { }) {
|
builtins.mapAttrs (_: builtins.foldl' (a: s: a // { ${s} = available.${s}; }) { }) {
|
||||||
default = [ "ssh" ];
|
default = [
|
||||||
|
"ai-crawlers"
|
||||||
|
"ssh"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue