On each commit of Ruby's Git repository, following git hooks are triggered:
- Verify committer email from
SVN_ACCOUNT_NAMEassociated to SSH key used forgit push - Reject merge commits (ask @mame about why)
- Sync ruby.git to GitHub
/data/git/ruby.git: Bare Git repository of rubyhooks/pre-receive: Run/home/git/git.ruby-lang.org/hooks/pre-receive.shhooks/update: Run/home/git/git.ruby-lang.org/hooks/update.sh
/home/git/git.ruby-lang.org: Cloned Git repository of git.ruby-lang.org
- There's a symlink
/var/git->/data/git. - User
git's$HOMEis NOT/home/gitbut/var/git.
- We use only
adminuser forgit.ruby-lang.org's SSH access.- You should contact @hsbt, @mame or @k0kubun for accessing
git.ruby-lang.org.
- You should contact @hsbt, @mame or @k0kubun for accessing
# dry-run
bin/hocho apply -n git.ruby-lang.org
# apply
bin/hocho apply git.ruby-lang.orgScrapers forging desktop browser user agents took the site down in June and
July 2026. Fastly is not an option because DNS has to keep pointing at the host
that accepts git push over SSH, so the defense runs on the box.
Requests reach cgit through four stages:
client -> apache :443 -> anubis :8923 -> apache :3001 -> cgit.cgi
:443(sites-available/git.ruby-lang.org.conf) terminates TLS, servesrobots.txt, 403s the crawlers that name themselves, and 302s the browse URLs it can hand to GitHub. Whatever is left it proxies.- Git clone requests (
HEAD,info/refs,objects/) and/cgit-css/skip Anubis and go straight to:3001. cgit serves the dumb HTTP clone protocol, andgitcannot solve a challenge. - Anubis (
anubis@cgit.service,/etc/anubis/cgit.botPolicies.yaml) gives everything else a proof-of-work challenge, weighted by how much the client looks like a scraper. :3001(sites-available/cgit-backend.conf) is loopback-only and runs cgit.
Checking on it:
systemctl status anubis@cgit
journalctl -u anubis@cgit -f
curl -s http://127.0.0.1:9090/metrics | grep anubis_challengesTo take Anubis out of the path, point the last three RewriteRule lines of the
:443 vhost back at http://127.0.0.1:3001/ and reload Apache. Everything
else keeps working.
- How to store
ssh_host_key*andsshd_configsafely? - How to write a recipe to mount data volume for bare git repository?
- How to write a recipe for mackerel with the host key of git.ruby-lang.org?