Wildcard blocking for complex domains


#1

Hello to all,

I’ve noticed that on the Roku and other device platforms, Google has been [ingeniously] deploying advertisements viz. a randomized DNS system that assigns a prefix to their googlevideo.com domain. Given that any attempts at wildcard blocking googlevideo.com results in disabling the desired video’s playback functionality, it would seem as though the randomization of DNS prefixes makes blocking such ads impossible. However, I’ve recognized that there are specific patterns to how Google produces the DNS server names. For instance, last night my Pi-Hole routed queries from these different servers:

r3—sn-o097znl6.googlevideo.com
r5—sn-5hne6nsy.googlevideo.com
r2—sn-n4v7sne7.googlevideo.com

To me, it would seem that the general trend that Google is adhering to involves mashing together a string of characters and integers produced, albeit seemingly arbitrarily, along the lines of some kind of underlying algorithm. While “cracking” this algorithm may be feasible, I was wondering if perhaps it would be better (i.e., less taxing) to code a response mechanism within Pi-Hole that identifies the first few elements of these non-English randomized series (such as Rxxxx… and so on) and proceeds to block these queries after cross-referencing them with a dictionary of “safe domains.” Essentially, I’m curious as to whether we can construct a supplementary database of sorts for singling out these erratic DNS requests and filtering them out selectively.

On a similar note, this problem brings to mind a question I had about DNS blocking in Pi-Hole and the wildcard filters built in: What are the current challenges to whitelisting a certain subset of a domain once the entire domain has been blacklisted via a wildcard blocking request? Is the creation of such an a posteriori exemption possible within the limits of Pi-Hole as it stands, or is there some issue with DNSmasq that prevents this from occurring? I’d love to help out with a solution–any solution–if I can.

PS. Thank you so very much to the devs for all the amazing work you do on this project!


#2

https://docs.pi-hole.net/ftldns/regex/overview/