feat(firewall): Ban AI crawlers
All checks were successful
Build all the nodes / ap01 (push) Successful in 1m51s
Build all the nodes / geo01 (push) Successful in 2m12s
Build all the nodes / bridge01 (push) Successful in 2m27s
Build all the nodes / geo02 (push) Successful in 2m26s
Build all the nodes / hypervisor01 (push) Successful in 2m26s
Build all the nodes / netcore02 (push) Successful in 44s
Build all the nodes / compute01 (push) Successful in 3m23s
Build all the nodes / hypervisor02 (push) Successful in 2m2s
Build all the nodes / hypervisor03 (push) Successful in 2m10s
Build all the nodes / tower01 (push) Successful in 2m30s
Build all the nodes / storage01 (push) Successful in 3m16s
Build all the nodes / rescue01 (push) Successful in 3m17s
Build all the nodes / vault01 (push) Successful in 2m56s
Run pre-commit on all files / pre-commit (push) Successful in 45s
Build the shell / build-shell (push) Successful in 45s
Build all the nodes / web02 (push) Successful in 2m25s
Build all the nodes / web01 (push) Successful in 3m14s
Build all the nodes / web03 (push) Successful in 1m48s

This commit is contained in:
Tom Hubrecht 2025-01-06 00:11:56 +01:00
parent c4108a62ab
commit e0cfd1ceb0
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc

View file

@ -25,6 +25,43 @@ let
};
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 = {
cmd = journalctl "sshd";
@ -46,5 +83,8 @@ let
in
builtins.mapAttrs (_: builtins.foldl' (a: s: a // { ${s} = available.${s}; }) { }) {
default = [ "ssh" ];
default = [
"ai-crawlers"
"ssh"
];
}