feat(dgn-firewall): Ban f*cking AI crawlers again

This commit is contained in:
Tom Hubrecht 2025-01-16 15:27:41 +01:00
parent fa2aefdb9a
commit b263c1fc84
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc
2 changed files with 18 additions and 3 deletions

View file

@ -86,9 +86,12 @@ in
stop = [ (nft "delete table inet reaction") ];
streams = {
inherit (streams') ssh;
} // (optionalAttrs config.services.nginx.enable { inherit (streams') ai-crawlers; });
streams =
{
inherit (streams') ssh;
}
// (optionalAttrs config.services.nginx.enable { inherit (streams') ai-crawlers; })
// (optionalAttrs config.services.forgejo.enable { inherit (streams') forgejo-slow-crawlers; });
};
};
}

View file

@ -63,6 +63,18 @@ in
};
};
forgejo-slow-crawlers = {
cmd = journalctl "forgejo";
filters.slowness = {
regex = [
"router: slow .* GET /.* for <ip>:0, elapsed .*"
];
actions = ban "72h";
retry = 15;
retryPeriod = "2h";
};
};
ssh = {
cmd = journalctl "sshd";