I had been meaning to block the most common generative AI training data harvesters for a while. While I would be interested in playing with a model trained on my own posts for fun, I don’t want to feed into someone else’s slop machine. Dan Moren’s post on Six Colors about the updated Apple crawler feeding text into Apple Intelligence reminded me to set this up for my personal server, covering this blog, my website, and my wife’s blog.

Big Hitters

Since it was already too late for my archives to not be consumed, I first wanted to do a quick bit of analysis of my server logs to see what user agents were in there. Nothing fancy since they’re small, just a quick shell script:

cat /var/log/httpd/access_log* | awk -F\" '{print $6}' | sort | uniq -c | sort -rn

There were over 10k unique user agents over the last month! Here are the top 20:

CountUser Agent
235390
Mozilla/5.0 (compatible; SemrushBot/7~bl; +http://www.semrush.com/bot.html)
109733
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
76190
Mozilla/5.0 (compatible; MJ12bot/v1.4.8; http://mj12bot.com/)
75423
Apache-HttpClient/4.5.2 (Java/1.8.0_161)
54668
Mozilla/5.0 (compatible; Bytespider; spider-feedback@bytedance.com) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.0.0
53828
Apache-HttpClient/4.5.2 (Java/1.8.0_151)
53164
Mozilla/5.0 (Linux; Android 7.0;) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; PetalBot;+https
37604
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.34 Safari/537.36
26204
Mozilla/5.0 (compatible; DotBot/1.2; +https://opensiteexplorer.org/dotbot; help@moz.com)
20835
Go-http-client/1.1
18955
jetmon/1.0 (Jetpack Site Uptime Monitor by WordPress.com)
17872
WordPress/6.5.3; https://blog.ultranurd.net
17656
Mozilla/5.0 (Linux; Android 5.0) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; Bytespider; spid
15875
facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
15635
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
11571
WordPress/6.4.3; https://blog.lanerd.com
10523
Mozilla/5.0 (compatible; Barkrowler/0.9; +https://babbar.tech/crawler)
10325
Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.66 Safari/537.36
9765
Mozilla/5.0 (compatible; AhrefsBot/7.0; +http://ahrefs.com/robot/)
8054
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36

A few obvious ones in there like the bot for Anthropic’s Claude model, Facebook, plus several web crawlers I’ve never heard of. The Jetpack monitor for our WordPress blogs is up there. Applebot is way down at 1695 hits; Googlebot had several variants spread out in the hundreds.

Of course I was wondering what those mysterious Java clients were, since they weren’t reporting themselves as standard crawlers or as web browsers…

Internet Weather

Diving in a little more, it turns out those clients are all hitting /xmlrpc.php on our blogs, primarily from IP addresses assigned to Chinese ASNs. In other words, vulnerability probing and brute force attempts. Storm winds blowing outside the door of my otherwise secured blog.

This is an older WordPress API endpoint that is still used by Jetpack; I don’t have any other reason to use it. Jetpack itself only hit it 367 times; all other user agents were over 200 times that in total. While I don’t have any default passwords or anything, and I keep WordPress updated, I want to reduce my risk and block this traffic.

I found this post explaining how best to update .htaccess to deny everyone but Jetpack and took their example but added it instead to my VirtualHost configurations. (I double checked that I had the latest Jetpack IP list.)

Get to the Blocker

After that brief detour I was ready to update my robots.txt to stop my sites from being harvested by known AI tools. I had previously stumbled across a repository containing a list of known bots. I took theirs and removed Applebot, since I’m okay with standard crawling for Siri search and Apple provided specific instructions on how an Applebot-Excluded rule would control whether they use data for generative AI training.

Finally, since I didn’t want to mess with correctly generating a dynamic one for my WordPress theme, like Dan did, I just dropped the result in the roots of my sites and appended the previous generated content from my WordPress install.

Now I have one for my website and one for my blog. Bye bots!


Comments

One response to “Blocking Bots”

  1. @nward Thanks for sharing! Looks like I've got another thing to add to my weekend to-do list.

What do you think?