Using BIND RPZs gives me exactly what I'm looking for to alter queries. However, my recursive DNS server is in use by hundreds of clients and I am looking for a way to allow each client some level of customization. There's possibly a couple hundred zones a client might want to enable making for thousands of different possible combinations.
It appears I am limited to 32 RPZ zones (of seemingly infinite length) but that alone won't work -- each user needs the ability to opt-in to specific zones. Even with massive zones for each client it will still hit the 32 limit.
I've looked briefly at Unbound which appears to have a similar sort of RPZ setup with local-data transparency, but the fun seems to have ended when looking for a way to separate things into views so I can only serve them to specific clients.
Surely there's a way to accomplish this without reinventing the wheel? I see commercial providers offering similar setups, like OpenDNS for example where thousands of customers can toggle various lists. What's the secret sauce?
First, it helps to understand why the limitation exists.
I've emphasized the relevant verbiage. The only way to change the limit of 32 is to update the algorithm to use a larger bitfield, or gut the optimization code entirely. Even if you were to double the size of the bitfield to 64 (or re-double to 128, etc.), you're still dealing with a static limitation imposed by the radix tree optimization. Since I'm not familiar with the innards of this algorithm, I also can't say how effective such an attempt would be to begin with.
You can get around this by using views that match your individual customers, which will give you 32 RPZ zones per customer, but that's as far as you're going to get without diving into the source code.