From e176fff873dc7f069daa21f8225de36973be3b94 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sun, 30 Nov 2025 08:23:02 +0100 Subject: tweak(tente): block ClaudeBot from cgit --- nixos/hosts/tente/bad-bots.txt | 3 +++ nixos/hosts/tente/git.nix | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 nixos/hosts/tente/bad-bots.txt (limited to 'nixos') 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; -- cgit v1.3.1