We currently get quite a lot of noise as the result of Meta/Facebook's bots.
They connect using IPv6 and we get a different IP each time:
- 2a03:2880:3ff:72::
- 2a03:2880:3ff:71::
- 2a03:2880:11ff:9::
- 2a03:2880:2ff:7::
et cetera.
It generates quite a lot of noise and there's limited value in blocking individual IPv6 addresses.
What I'd like to be able to do is to mark an entire subnet to be blocked.
Given the current set of detections, that could take two forms
- Functionality changes so we can advertise the supernet and ignore any other matches within it
- or (as a short term fix) allow me to allowlist the supernet so there's no further noise (I can then update notes for the existing matches)
- or (as a complete hack) add an inverse grep to the log parsing to exclude that specific subnet from inputs (though that'll screw regenerations etc)
Activity
08-Jul-25 09:07
whois
gives the following information for this block08-Jul-25 09:13
Just for confirmation, we don't currently have the ability to exclude via subnet - it looks for exact matches:
I wonder whether the answer is to have
calcFileName
do the swap?I could have a manual config list of prefixes and have the function override the filename if there's a match.
That would also prevent toots from being sent, the state file will exist.
08-Jul-25 09:14
changed the description
08-Jul-25 09:16
If I do ^ we also need to think about what will happen during receipt regeneration.
It looks like it should be OK, but we need to make sure that the attribute
ip
in the state file is an IP rather than the subnet (otherwise various lookups may fail)08-Jul-25 09:39
mentioned in commit misc/python-mastodon-snitch-bot@80fce5c549a1ede84a55a8f3754b15d893a91b52
Message
feat: allow IP prefixes to be grouped into a single state and receipt file misc/python-mastodon-snitch-bot#7
08-Jul-25 09:44
The basic functionality is implemented, it's possible to provide a list of string prefixes:
This isn't going to be massively useful to people though. The aim of that config is to block
2a03:2880:300::/40
.I deliberately went with string matching rather than IP parsing to keep the check cheap, but we need a way to communicate to users which subnet they should be blocking.
One option would be to list subnets and check whether the IP is in it, the other would be to make the config more verbose
I think it's probably best to do it properly and parse IPs and Networks - otherwise we'll only end up overblocking by accident
08-Jul-25 09:50
mentioned in commit misc/python-mastodon-snitch-bot@68fb3994d54ba8bb1ec27a783771f0e7a1056717
Message
feat: group by subnet rather that a string prefix (misc/python-mastodon-snitch-bot#7)
08-Jul-25 09:53
OK, the logic is in place then - what we need to look at now is how to go about exposing information to the user.
The state and receipt filename has a
-subnet
suffix (e.g.state-2a03-2880-300--40-subnet.txt
), but we probably want the receipt contents to note that it's a subnet match.We should also hide various bits of information
user_agents
will be correct but may be incomplete (if different UA's are used by different IPs within the subnet)08-Jul-25 10:05
mentioned in commit misc/python-mastodon-snitch-bot@460cee180fe1bd0f2049d53f3980d0804e8bad86
Message
feat: receipt files should correctly reflect that the match is for a subnet (misc/python-mastodon-snitch-bot#7)
08-Jul-25 10:09
Receipt files now reflect that they are for a subnet match:
08-Jul-25 10:10
We should probably adjust the toot text too.
08-Jul-25 10:15
mentioned in commit misc/python-mastodon-snitch-bot@3d890efc69dc1a2378d72709cde737efbd9ca209
Message
feat: adjust the toot text if the match is for a subnet (misc/python-mastodon-snitch-bot#7)
08-Jul-25 10:15
I think we should probably log a flag too, that way people can look it up on the wiki and understand why the receipt file is different.
08-Jul-25 10:20
mentioned in commit misc/python-mastodon-snitch-bot@ce1f798c1d92cbf98af688067155ae0bd5813df6
Message
feat: add flag
Subnet-Match
(misc/python-mastodon-snitch-bot#7)08-Jul-25 10:21
assigned to @btasker
08-Jul-25 10:22
Cool, this seems to be working - I've tested against the last 48hrs of events.
Wiki has been updated
08-Jul-25 10:25
moved from misc/python-mastodon-snitch-bot#7
08-Jul-25 10:26
Closing ready to cut a release
08-Jul-25 10:33
Just for my own reference in future, when adding a subnet to the config, it's also possible to pre-stage some additional notes.
For example, for
2a03:2880:300::/40
I did08-Jul-25 10:44
FTR, other observed facebook subnets are
Realistically, we probably want to group that into
2a03:2880::/32