[Dnsmasq-discuss] Feature request = block-conf
Geert Stappers
stappers at stappers.nl
Sat Feb 5 13:58:15 UTC 2022
On Sat, Feb 05, 2022 at 11:32:44AM +0000, Simon Kelley wrote:
> On 04/02/2022 09:46, Ercolino de Spiacico wrote:
> > I have a feature request.
> >
> > Since dnsmasq is extremely popular on embedded devices with limited
> > resources (e.g. router) it would be a huge improvement to have a new
> > directive to block a list of domains.
> >
> > ....
> >
> > Could we please have a new directive e.g. block-file
> >
> > block-conf=/etc/dnsmasq.adblock
> >
> > where only domains are needed in the mapped file?
> >
> > baddomain.com
> > baddomain2.com
> >
> >
> > This would reduce drastically the demand on storage (so memory). Some of
> > the public adblock lists are huge hence having the adblock file
> > literally 1/2 of the original size would be amazing.
> >
> Let's try thinking out of the box here. Given the motivation to save
> storage, I was wondering if there could be a way to use compression, gzip
> etc to save more space.
>
> Building a decompressor into dnsmasq seems ugly, but then I came up with the
> option of --conf-script=/path/to/script.
>
> Analogous to --conf-file, except that the standard output of the script is
> used as the configuration.
>
>
> So you could just have a script which consisted of
>
> #!/bin/sh
> set -e
>
> gunzip block-domains.gz | sed -e "s:^:address=/:" -e "s:$:/#:"
>
>
> The sed stuff might not be necessary: a decent compression algo should hide
> the repeated information pretty successfully itself.
>
>
> That solves you problem, and is more generally useful: It's also pretty
> trivial to implement.
>
> Opinions, all?
>
Another effect of `--conf-script` is that the script could be
```
#!/bin/sh
set -e
curl http://server.lan:4242/config/magic
```
Groeten
Geert Stappers
--
Silence is hard to parse
More information about the Dnsmasq-discuss
mailing list