aboutsummaryrefslogtreecommitdiff
path: root/nixos
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-11-30 08:23:02 +0100
committerMartin Fischer <martin@push-f.com>2025-11-30 08:28:47 +0100
commite176fff873dc7f069daa21f8225de36973be3b94 (patch)
tree2a9bbd27bbf78bfd9f99037426282a69ae766333 /nixos
parentae1ba47a679903e6a1b98a5b1e00f65e32b082a3 (diff)
tweak(tente): block ClaudeBot from cgit
Diffstat (limited to 'nixos')
-rw-r--r--nixos/hosts/tente/bad-bots.txt3
-rw-r--r--nixos/hosts/tente/git.nix8
2 files changed, 11 insertions, 0 deletions
diff --git a/nixos/hosts/tente/bad-bots.txt b/nixos/hosts/tente/bad-bots.txt
new file mode 100644
index 0000000..780c477
--- /dev/null
+++ b/nixos/hosts/tente/bad-bots.txt
@@ -0,0 +1,3 @@
+# 7 million requests in 5 days
+User-agent: ClaudeBot
+Disallow: /
diff --git a/nixos/hosts/tente/git.nix b/nixos/hosts/tente/git.nix
index 49ecff0..467ba30 100644
--- a/nixos/hosts/tente/git.nix
+++ b/nixos/hosts/tente/git.nix
@@ -36,6 +36,14 @@ in
cgit.main = {
enable = true;
+ package = pkgs.runCommand "cgit-with-extended-robots-txt" {} ''
+ cp -r ${pkgs.cgit} $out
+ robots_txt=$out/cgit/robots.txt
+ chmod u+w $robots_txt
+ echo >> $robots_txt
+ cat ${./bad-bots.txt} >> $robots_txt
+ '';
+
# running as the gitolite user because otherwise cloning a repo via cgit fails with:
# fatal: detected dubious ownership in repository
user = config.services.gitolite.user;