Use DNS to force youtube into restricted mode - and Pi-Hole


#42

Use this: http://35.188.83.81/UniPi.php?q=ss
Do you see how google has 300+ top level domains. Each of them needs a CNAME DNS record to enforce SafeSearch. The question I was asking was: Would I just need 1 host record for Google SafeSearch forcesafesearch.google.com so I don’t have to put it in the hosts file? I don’t understand what your regex is for either. Is it to block other websites that may expose adult content?


#43

Pi-hole has an name local.list and in the same way host-record works in DNSmasq so no need to use the hosts file.
You only need one entry as long the +300 cnames point to that.

Looking at the list it is covering TLD that Google is using. That is way use not a specific TLD in regex.
So you still need all +300 entries but you condence then to a few lines lines. As long the forcesafesearch.google.com is on the end of each line.

You can’t use regex for that and my rules protects your own privacy.


#44

So the list can be contracted a bit by putting each TLD on one line:

# /tmp/safesearch.txt generated on 12/30/2018 01:54 by pi-hole
# Google SafeSearch Implementation
host-record=forcesafesearch.google.com,216.239.38.120,2001:4860:4802:32::78
cname=google.com,www.google.com,forcesafesearch.google.com
cname=google.ad,www.google.ad,forcesafesearch.google.com
cname=google.ae,www.google.ae,forcesafesearch.google.com
cname=google.com.af,www.google.com.af,forcesafesearch.google.com
cname=google.com.ag,www.google.com.ag,forcesafesearch.google.com
cname=google.com.ai,www.google.com.ai,forcesafesearch.google.com
cname=google.al,www.google.al,forcesafesearch.google.com
cname=google.am,www.google.am,forcesafesearch.google.com
cname=google.co.ao,www.google.co.ao,forcesafesearch.google.com
cname=google.com.ar,www.google.com.ar,forcesafesearch.google.com
cname=google.as,www.google.as,forcesafesearch.google.com
cname=google.at,www.google.at,forcesafesearch.google.com
cname=google.com.au,www.google.com.au,forcesafesearch.google.com
cname=google.az,www.google.az,forcesafesearch.google.com
cname=google.ba,www.google.ba,forcesafesearch.google.com
cname=google.com.bd,www.google.com.bd,forcesafesearch.google.com
cname=google.be,www.google.be,forcesafesearch.google.com
cname=google.bf,www.google.bf,forcesafesearch.google.com
cname=google.bg,www.google.bg,forcesafesearch.google.com
cname=google.com.bh,www.google.com.bh,forcesafesearch.google.com
cname=google.bi,www.google.bi,forcesafesearch.google.com
cname=google.bj,www.google.bj,forcesafesearch.google.com
cname=google.com.bn,www.google.com.bn,forcesafesearch.google.com
cname=google.com.bo,www.google.com.bo,forcesafesearch.google.com
cname=google.com.br,www.google.com.br,forcesafesearch.google.com
cname=google.bs,www.google.bs,forcesafesearch.google.com
cname=google.bt,www.google.bt,forcesafesearch.google.com
cname=google.co.bw,www.google.co.bw,forcesafesearch.google.com
cname=google.by,www.google.by,forcesafesearch.google.com
cname=google.com.bz,www.google.com.bz,forcesafesearch.google.com
cname=google.ca,www.google.ca,forcesafesearch.google.com
cname=google.cd,www.google.cd,forcesafesearch.google.com
cname=google.cf,www.google.cf,forcesafesearch.google.com
cname=google.cg,www.google.cg,forcesafesearch.google.com
cname=google.ch,www.google.ch,forcesafesearch.google.com
cname=google.ci,www.google.ci,forcesafesearch.google.com
cname=google.co.ck,www.google.co.ck,forcesafesearch.google.com
cname=google.cl,www.google.cl,forcesafesearch.google.com
cname=google.cm,www.google.cm,forcesafesearch.google.com
cname=google.cn,www.google.cn,forcesafesearch.google.com
cname=google.com.co,www.google.com.co,forcesafesearch.google.com
cname=google.co.cr,www.google.co.cr,forcesafesearch.google.com
cname=google.com.cu,www.google.com.cu,forcesafesearch.google.com
cname=google.cv,www.google.cv,forcesafesearch.google.com
cname=google.com.cy,www.google.com.cy,forcesafesearch.google.com
cname=google.cz,www.google.cz,forcesafesearch.google.com
cname=google.de,www.google.de,forcesafesearch.google.com
cname=google.dj,www.google.dj,forcesafesearch.google.com
cname=google.dk,www.google.dk,forcesafesearch.google.com
cname=google.dm,www.google.dm,forcesafesearch.google.com
cname=google.com.do,www.google.com.do,forcesafesearch.google.com
cname=google.dz,www.google.dz,forcesafesearch.google.com
cname=google.com.ec,www.google.com.ec,forcesafesearch.google.com
cname=google.ee,www.google.ee,forcesafesearch.google.com
cname=google.com.eg,www.google.com.eg,forcesafesearch.google.com
cname=google.es,www.google.es,forcesafesearch.google.com
cname=google.com.et,www.google.com.et,forcesafesearch.google.com
cname=google.fi,www.google.fi,forcesafesearch.google.com
cname=google.com.fj,www.google.com.fj,forcesafesearch.google.com
cname=google.fm,www.google.fm,forcesafesearch.google.com
cname=google.fr,www.google.fr,forcesafesearch.google.com
cname=google.ga,www.google.ga,forcesafesearch.google.com
cname=google.ge,www.google.ge,forcesafesearch.google.com
cname=google.gg,www.google.gg,forcesafesearch.google.com
cname=google.com.gh,www.google.com.gh,forcesafesearch.google.com
cname=google.com.gi,www.google.com.gi,forcesafesearch.google.com
cname=google.gl,www.google.gl,forcesafesearch.google.com
cname=google.gm,www.google.gm,forcesafesearch.google.com
cname=google.gp,www.google.gp,forcesafesearch.google.com
cname=google.gr,www.google.gr,forcesafesearch.google.com
cname=google.com.gt,www.google.com.gt,forcesafesearch.google.com
cname=google.gy,www.google.gy,forcesafesearch.google.com
cname=google.com.hk,www.google.com.hk,forcesafesearch.google.com
cname=google.hn,www.google.hn,forcesafesearch.google.com
cname=google.hr,www.google.hr,forcesafesearch.google.com
cname=google.ht,www.google.ht,forcesafesearch.google.com
cname=google.hu,www.google.hu,forcesafesearch.google.com
cname=google.co.id,www.google.co.id,forcesafesearch.google.com
cname=google.ie,www.google.ie,forcesafesearch.google.com
cname=google.co.il,www.google.co.il,forcesafesearch.google.com
cname=google.im,www.google.im,forcesafesearch.google.com
cname=google.co.in,www.google.co.in,forcesafesearch.google.com
cname=google.iq,www.google.iq,forcesafesearch.google.com
cname=google.is,www.google.is,forcesafesearch.google.com
cname=google.it,www.google.it,forcesafesearch.google.com
cname=google.je,www.google.je,forcesafesearch.google.com
cname=google.com.jm,www.google.com.jm,forcesafesearch.google.com
cname=google.jo,www.google.jo,forcesafesearch.google.com
cname=google.co.jp,www.google.co.jp,forcesafesearch.google.com
cname=google.co.ke,www.google.co.ke,forcesafesearch.google.com
cname=google.com.kh,www.google.com.kh,forcesafesearch.google.com
cname=google.ki,www.google.ki,forcesafesearch.google.com
cname=google.kg,www.google.kg,forcesafesearch.google.com
cname=google.co.kr,www.google.co.kr,forcesafesearch.google.com
cname=google.com.kw,www.google.com.kw,forcesafesearch.google.com
cname=google.kz,www.google.kz,forcesafesearch.google.com
cname=google.la,www.google.la,forcesafesearch.google.com
cname=google.com.lb,www.google.com.lb,forcesafesearch.google.com
cname=google.li,www.google.li,forcesafesearch.google.com
cname=google.lk,www.google.lk,forcesafesearch.google.com
cname=google.co.ls,www.google.co.ls,forcesafesearch.google.com
cname=google.lt,www.google.lt,forcesafesearch.google.com
cname=google.lu,www.google.lu,forcesafesearch.google.com
cname=google.lv,www.google.lv,forcesafesearch.google.com
cname=google.com.ly,www.google.com.ly,forcesafesearch.google.com
cname=google.co.ma,www.google.co.ma,forcesafesearch.google.com
cname=google.md,www.google.md,forcesafesearch.google.com
cname=google.me,www.google.me,forcesafesearch.google.com
cname=google.mg,www.google.mg,forcesafesearch.google.com
cname=google.mk,www.google.mk,forcesafesearch.google.com
cname=google.ml,www.google.ml,forcesafesearch.google.com
cname=google.com.mm,www.google.com.mm,forcesafesearch.google.com
cname=google.mn,www.google.mn,forcesafesearch.google.com
cname=google.ms,www.google.ms,forcesafesearch.google.com
cname=google.com.mt,www.google.com.mt,forcesafesearch.google.com
cname=google.mu,www.google.mu,forcesafesearch.google.com
cname=google.mv,www.google.mv,forcesafesearch.google.com
cname=google.mw,www.google.mw,forcesafesearch.google.com
cname=google.com.mx,www.google.com.mx,forcesafesearch.google.com
cname=google.com.my,www.google.com.my,forcesafesearch.google.com
cname=google.co.mz,www.google.co.mz,forcesafesearch.google.com
cname=google.com.na,www.google.com.na,forcesafesearch.google.com
cname=google.com.nf,www.google.com.nf,forcesafesearch.google.com
cname=google.com.ng,www.google.com.ng,forcesafesearch.google.com
cname=google.com.ni,www.google.com.ni,forcesafesearch.google.com
cname=google.ne,www.google.ne,forcesafesearch.google.com
cname=google.nl,www.google.nl,forcesafesearch.google.com
cname=google.no,www.google.no,forcesafesearch.google.com
cname=google.com.np,www.google.com.np,forcesafesearch.google.com
cname=google.nr,www.google.nr,forcesafesearch.google.com
cname=google.nu,www.google.nu,forcesafesearch.google.com
cname=google.co.nz,www.google.co.nz,forcesafesearch.google.com
cname=google.com.om,www.google.com.om,forcesafesearch.google.com
cname=google.com.pa,www.google.com.pa,forcesafesearch.google.com
cname=google.com.pe,www.google.com.pe,forcesafesearch.google.com
cname=google.com.pg,www.google.com.pg,forcesafesearch.google.com
cname=google.com.ph,www.google.com.ph,forcesafesearch.google.com
cname=google.com.pk,www.google.com.pk,forcesafesearch.google.com
cname=google.pl,www.google.pl,forcesafesearch.google.com
cname=google.pn,www.google.pn,forcesafesearch.google.com
cname=google.com.pr,www.google.com.pr,forcesafesearch.google.com
cname=google.ps,www.google.ps,forcesafesearch.google.com
cname=google.pt,www.google.pt,forcesafesearch.google.com
cname=google.com.py,www.google.com.py,forcesafesearch.google.com
cname=google.com.qa,www.google.com.qa,forcesafesearch.google.com
cname=google.ro,www.google.ro,forcesafesearch.google.com
cname=google.ru,www.google.ru,forcesafesearch.google.com
cname=google.rw,www.google.rw,forcesafesearch.google.com
cname=google.com.sa,www.google.com.sa,forcesafesearch.google.com
cname=google.com.sb,www.google.com.sb,forcesafesearch.google.com
cname=google.sc,www.google.sc,forcesafesearch.google.com
cname=google.se,www.google.se,forcesafesearch.google.com
cname=google.com.sg,www.google.com.sg,forcesafesearch.google.com
cname=google.sh,www.google.sh,forcesafesearch.google.com
cname=google.si,www.google.si,forcesafesearch.google.com
cname=google.sk,www.google.sk,forcesafesearch.google.com
cname=google.com.sl,www.google.com.sl,forcesafesearch.google.com
cname=google.sn,www.google.sn,forcesafesearch.google.com
cname=google.so,www.google.so,forcesafesearch.google.com
cname=google.sm,www.google.sm,forcesafesearch.google.com
cname=google.sr,www.google.sr,forcesafesearch.google.com
cname=google.st,www.google.st,forcesafesearch.google.com
cname=google.com.sv,www.google.com.sv,forcesafesearch.google.com
cname=google.td,www.google.td,forcesafesearch.google.com
cname=google.tg,www.google.tg,forcesafesearch.google.com
cname=google.co.th,www.google.co.th,forcesafesearch.google.com
cname=google.com.tj,www.google.com.tj,forcesafesearch.google.com
cname=google.tk,www.google.tk,forcesafesearch.google.com
cname=google.tl,www.google.tl,forcesafesearch.google.com
cname=google.tm,www.google.tm,forcesafesearch.google.com
cname=google.tn,www.google.tn,forcesafesearch.google.com
cname=google.to,www.google.to,forcesafesearch.google.com
cname=google.com.tr,www.google.com.tr,forcesafesearch.google.com
cname=google.tt,www.google.tt,forcesafesearch.google.com
cname=google.com.tw,www.google.com.tw,forcesafesearch.google.com
cname=google.co.tz,www.google.co.tz,forcesafesearch.google.com
cname=google.com.ua,www.google.com.ua,forcesafesearch.google.com
cname=google.co.ug,www.google.co.ug,forcesafesearch.google.com
cname=google.co.uk,www.google.co.uk,forcesafesearch.google.com
cname=google.com.uy,www.google.com.uy,forcesafesearch.google.com
cname=google.co.uz,www.google.co.uz,forcesafesearch.google.com
cname=google.com.vc,www.google.com.vc,forcesafesearch.google.com
cname=google.co.ve,www.google.co.ve,forcesafesearch.google.com
cname=google.vg,www.google.vg,forcesafesearch.google.com
cname=google.co.vi,www.google.co.vi,forcesafesearch.google.com
cname=google.com.vn,www.google.com.vn,forcesafesearch.google.com
cname=google.vu,www.google.vu,forcesafesearch.google.com
cname=google.ws,www.google.ws,forcesafesearch.google.com
cname=google.rs,www.google.rs,forcesafesearch.google.com
cname=google.co.za,www.google.co.za,forcesafesearch.google.com
cname=google.co.zm,www.google.co.zm,forcesafesearch.google.com
cname=google.co.zw,www.google.co.zw,forcesafesearch.google.com
cname=google.cat,www.google.cat,forcesafesearch.google.com
cname=duckduckgo.com,www.duckduckgo.com,safe.duckduckgo.com
host-record=safe.duckduckgo.com,50.16.250.179
cname=duck.com,www.duck.com,safe.duckduckgo.com
host-record=strict.bing.com,204.79.197.220
cname=bing.com,www.bing.com,strict.bing.com

Or the Google part even more condensed but I think the top one is prefered:

# Google SafeSearch Implementation
cname=google.com,www.google.com,google.ad,www.google.ad,google.ae,www.google.ae,google.com.af,www.google.com.af,google.com.ag,www.google.com.ag,google.com.ai,www.google.com.ai,google.al,www.google.al,forcesafesearch.google.com
cname=google.am,www.google.am,google.co.ao,www.google.co.ao,google.com.ar,www.google.com.ar,google.as,www.google.as,google.at,www.google.at,google.com.au,www.google.com.au,google.az,www.google.az,forcesafesearch.google.com
cname=google.ba,www.google.ba,google.com.bd,www.google.com.bd,google.be,www.google.be,google.bf,www.google.bf,google.bg,www.google.bg,google.com.bh,www.google.com.bh,google.bi,www.google.bi,google.bj,www.google.bj,forcesafesearch.google.com
cname=google.com.bn,www.google.com.bn,google.com.bo,www.google.com.bo,google.com.br,www.google.com.br,google.bs,www.google.bs,google.bt,www.google.bt,google.co.bw,www.google.co.bw,google.by,www.google.by,google.com.bz,www.google.com.bz,forcesafesearch.google.com
cname=google.ca,www.google.ca,google.cd,www.google.cd,google.cf,www.google.cf,google.cg,www.google.cg,google.ch,www.google.ch,google.ci,www.google.ci,google.co.ck,www.google.co.ck,google.cl,www.google.cl,google.cm,www.google.cm,forcesafesearch.google.com
cname=google.cn,www.google.cn,google.com.co,www.google.com.co,google.co.cr,www.google.co.cr,google.com.cu,www.google.com.cu,google.cv,www.google.cv,google.com.cy,www.google.com.cy,google.cz,www.google.cz,google.de,www.google.de,forcesafesearch.google.com
cname=google.dj,www.google.dj,google.dk,www.google.dk,google.dm,www.google.dm,google.com.do,www.google.com.do,google.dz,www.google.dz,google.com.ec,www.google.com.ec,google.ee,www.google.ee,google.com.eg,www.google.com.eg,forcesafesearch.google.com
cname=google.es,www.google.es,google.com.et,www.google.com.et,google.fi,www.google.fi,google.com.fj,www.google.com.fj,google.fm,www.google.fm,google.fr,www.google.fr,google.ga,www.google.ga,google.ge,www.google.ge,forcesafesearch.google.com
cname=google.gg,www.google.gg,google.com.gh,www.google.com.gh,google.com.gi,www.google.com.gi,google.gl,www.google.gl,google.gm,www.google.gm,google.gp,www.google.gp,google.gr,www.google.gr,google.com.gt,www.google.com.gt,google.gy,www.google.gy,forcesafesearch.google.com
cname=google.com.hk,www.google.com.hk,google.hn,www.google.hn,google.hr,www.google.hr,google.ht,www.google.ht,google.hu,www.google.hu,google.co.id,www.google.co.id,google.ie,www.google.ie,google.co.il,www.google.co.il,google.im,www.google.im,forcesafesearch.google.com
cname=google.co.in,www.google.co.in,google.iq,www.google.iq,google.is,www.google.is,google.it,www.google.it,google.je,www.google.je,google.com.jm,www.google.com.jm,google.jo,www.google.jo,google.co.jp,www.google.co.jp,forcesafesearch.google.com
cname=google.co.ke,www.google.co.ke,google.com.kh,www.google.com.kh,google.ki,www.google.ki,google.kg,www.google.kg,google.co.kr,www.google.co.kr,google.com.kw,www.google.com.kw,google.kz,www.google.kz,google.la,www.google.la,forcesafesearch.google.com
cname=google.com.lb,www.google.com.lb,google.li,www.google.li,google.lk,www.google.lk,google.co.ls,www.google.co.ls,google.lt,www.google.lt,google.lu,www.google.lu,google.lv,www.google.lv,google.com.ly,www.google.com.ly,google.co.ma,www.google.co.ma,forcesafesearch.google.com
cname=google.md,www.google.md,google.me,www.google.me,google.mg,www.google.mg,google.mk,www.google.mk,google.ml,www.google.ml,google.com.mm,www.google.com.mm,google.mn,www.google.mn,google.ms,www.google.ms,google.com.mt,www.google.com.mt,forcesafesearch.google.com
cname=google.mu,www.google.mu,google.mv,www.google.mv,google.mw,www.google.mw,google.com.mx,www.google.com.mx,google.com.my,www.google.com.my,google.co.mz,www.google.co.mz,google.com.na,www.google.com.na,google.com.nf,www.google.com.nf,forcesafesearch.google.com
cname=google.com.ng,www.google.com.ng,google.com.ni,www.google.com.ni,google.ne,www.google.ne,google.nl,www.google.nl,google.no,www.google.no,google.com.np,www.google.com.np,google.nr,www.google.nr,google.nu,www.google.nu,google.co.nz,www.google.co.nz,forcesafesearch.google.com
cname=google.com.om,www.google.com.om,google.com.pa,www.google.com.pa,google.com.pe,www.google.com.pe,google.com.pg,www.google.com.pg,google.com.ph,www.google.com.ph,google.com.pk,www.google.com.pk,google.pl,www.google.pl,forcesafesearch.google.com
cname=google.pn,www.google.pn,google.com.pr,www.google.com.pr,google.ps,www.google.ps,google.pt,www.google.pt,google.com.py,www.google.com.py,google.com.qa,www.google.com.qa,google.ro,www.google.ro,google.ru,www.google.ru,forcesafesearch.google.com
cname=google.rw,www.google.rw,google.com.sa,www.google.com.sa,google.com.sb,www.google.com.sb,google.sc,www.google.sc,google.se,www.google.se,google.com.sg,www.google.com.sg,google.sh,www.google.sh,google.si,www.google.si,google.sk,www.google.sk,forcesafesearch.google.com
cname=google.com.sl,www.google.com.sl,google.sn,www.google.sn,google.so,www.google.so,google.sm,www.google.sm,google.sr,www.google.sr,google.st,www.google.st,google.com.sv,www.google.com.sv,google.td,www.google.td,google.tg,www.google.tg,forcesafesearch.google.com
cname=google.co.th,www.google.co.th,google.com.tj,www.google.com.tj,google.tk,www.google.tk,google.tl,www.google.tl,google.tm,www.google.tm,google.tn,www.google.tn,google.to,www.google.to,google.com.tr,www.google.com.tr,forcesafesearch.google.com
cname=google.tt,www.google.tt,google.com.tw,www.google.com.tw,google.co.tz,www.google.co.tz,google.com.ua,www.google.com.ua,google.co.ug,www.google.co.ug,google.co.uk,www.google.co.uk,google.com.uy,www.google.com.uy,google.co.uz,www.google.co.uz,forcesafesearch.google.com
cname=google.com.vc,www.google.com.vc,google.co.ve,www.google.co.ve,google.vg,www.google.vg,google.co.vi,www.google.co.vi,google.com.vn,www.google.com.vn,google.vu,www.google.vu,google.ws,www.google.ws,google.rs,www.google.rs,forcesafesearch.google.com
cname=google.co.za,www.google.co.za,google.co.zm,www.google.co.zm,google.co.zw,www.google.co.zw,google.cat,www.google.cat,forcesafesearch.google.com

#45

Ok, I see. You have IPV4 and IPv6 records. Could I put multiple IPV4 addresses to point to a host and dnsmasq would do it round robin? Or should I radnomly select an IP?

Happy New Year!


#47

I am working on making a python command line tool to acomplish this very task. This is turning into more of a project and I don’t think bash will do the trick anymore. I will have it done by the end of the week.


#48

Thanks, and a happy new year to you.

You can only enter one IPv4 and one IPv6 address so no round robin possible.

host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-address>][,<TTL>]
    Add A, AAAA and PTR records to the DNS. This adds one or more names to the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may appear in more than one --host-record and therefore be assigned more than one address. Only the first address creates a PTR record linking the address to the name. This is the same rule as is used reading hosts-files. --host-record options are considered to be read before host-files, so a name appearing there inhibits PTR-record creation if it appears in hosts-file also. Unlike hosts-files, names are not expanded, even when --expand-hosts is in effect. Short and long names may appear in the same --host-record, eg. --host-record=laptop,laptop.thekelleys.org,192.168.0.1,1234::100

    If the time-to-live is given, it overrides the default, which is zero or the value of --local-ttl. The value is a positive integer and gives the time-to-live in seconds.

http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

Take your time and I had the impression that host-record made things easier. You are staying in the Pi-hole/DNSmasq environment.


#49

Hi, you could do a script to go back this function? or a button to activate o deactivate? Thanks


#50

Lets hope development picks this up when ready and implement it as extra feature in Pi-hole.


#51

Yes, this is a very useful and important feature


#52

Sure thing! I was initially planning that, just wouldn’t get to it until this week. Do you want the controls to be granular, for say enable and disable Youtube, Duckduckgo, Google SafeSearch, etc? Or do you just want all of those together in the script?

Please let me know,

Thanks,

Jayke


#53

Thanks, I see. You can add multiple host-records and when you use the dig command, multiple IP addresses will be returned.

host-record=www.example.com,1.1.1.1
host-record=www.example.com,1.1.1.2
host-record=www.example.com,1.1.1.3

#54

I think it should be a feature included from the installation and the best would be if you could choose which domains to activate this function (YouTube, Duckduckgo, Google SafeSearch, etc), thank you for your time and consideration on the subject … but it is certainly helpful for families who have small children


#55

Yes, I agree. As of now, the Enable and Disable functions have been added.


#56

As you can read here, It’s a feature in AdGuard Home.


#58

Perfect! need development for web interface feature! :slight_smile:


#59

If this is a desired feature, please submit a feature request.


Use DNS to force youtube into restricted mode - and Pi-Hole
#60

okok a do it now


#61

For those having trouble getting DuckDuckGo into restricted mode, I may have found a solution to the problem. It seems only some IP addresses work, and when I tried using the script listed above it would not force restricted mode. I tried a few different IP addresses for the safe.duckduckgo.com domain, and I found an IP that works. I am also going to list the safe search DNS option for Pixabay, if you don’t want to restrict this simply copy the lines related to DuckDuckGo.

In your /etc/hosts file put the following (separate the IP and domain by a tab character):
54.241.17.246 safe.duckduckgo.com
176.9.158.70 safesearch.pixabay.com

Create a new file, unless you already have one, here: /etc/dnsmasq.d/98-restrict.conf and copy the following:
cname=www.duckduckgo.com,safe.duckduckgo.com
cname=duckduckgo.com,safe.duckduckgo.com
cname=pixabay.com,safesearch.pixabay.com

For me this has enabled safe search and removed the option to disable it. Hope this helps someone! I know I spent a while trying to figure this out, and thought I should let others know.


#62

I don’t like to use the /etc/hosts file for this.

https://discourse.pi-hole.net/t/use-dns-to-force-youtube-into-restricted-mode-and-pi-hole/1996/36