hectorm / hblock

Improve your security and privacy by blocking ads, tracking and malware domains.
https://hblock.molinero.dev
MIT License
1.63k stars 104 forks source link

Wildcard blocking in hosts_rpz.txt #97

Closed mdosch closed 2 years ago

mdosch commented 2 years ago

Dear maintainer,

I use the hosts_rpz.txt created by hblock with kresd to block tracking on DNS level. Some tracking companies give subdomains to their user and while siteintercept.qualtrics.com is included in the block list zn0lxkzethotizctx-bahn.siteintercept.qualtrics.com is still resolved. Is it possible to use wildcards in the generated hosts_rpz.txt to also block the tracking by those subdomains?

mdosch commented 2 years ago

Sorry for the bug label, I tried to remove it and choose enhancement or something like that, but wasn't able to.

hectorm commented 2 years ago

Knot Resolver supports the use of *. in its RPZ implementation, so it should be possible to generate an RPZ file that achieves your goal by invoking hBlock with these arguments:

hblock --output ./blocklist.rpz --header ./header.rpz --footer none --redirection '.' --template '%D CNAME %R\n*.%D CNAME %R' --comment ';' --filter-subdomains
mdosch commented 2 years ago

That works, thank you. :)