Shhhhhh! This post is for RSS subscribers only. Look here for more information (and to join in on the fun).
--
Did you know that there's a Wikipedia page that lists all of the assigned /8 IPV4 address blocks?
A person, if they were so inclined, could take this list (or a subset of it) and block all of those IP addresses from accessing their website using Caddy's remote_ip matcher (or whatever the equivalent is in your web server of choice).
As an example, let's say that we want to block all of the IP addresses that are assigned to the United States Department of Defense for no particular reason whatsoever.
To do that, we can add the following lines to our Caddyfile:
@blocked_ips {
remote_ip 6.0.0.0/8 7.0.0.0/8 11.0.0.0/8 21.0.0.0/8 22.0.0.0/8 26.0.0.0/8 28.0.0.0/8 29.0.0.0/8 30.0.0.0/8 33.0.0.0/8 55.0.0.0/8 214.0.0.0/8 215.0.0.0/8
}
handle @blocked_ips {
respond 403
}
If we want to be really cheeky (as the cartoon dogs my kids are obsessed with like to say), we could even redirect them to another website:
handle @blocked_ips {
redir https://www.archives.gov/founding-docs/constitution-transcript 302
}
Before I get emails about how pointless this probably is, I already know.
It won't prevent someone from accessing your site—or cause anyone to care about your site—if they use a VPN or Tor or their home network or their smartphone, but for a few lines of config, it's nothing if not a statement that I'd argue is worth making these days.
--
If you like this post or one of my projects, you can buy me a coffee, or send me a note. I'd love to hear from you!