OpenWRT + SafeSearch

I’ve got an OpenWRT router, and here’s how I configured it to enable safesearch on my home network.

uci add dhcp cname
uci set dhcp.@cname[-1].cname="www.google.com"
uci set dhcp.@cname[-1].target="forcesafesearch.google.com"
uci commit dhcp

uci add dhcp cname
uci set dhcp.@cname[-1].cname="www.bing.com"
uci set dhcp.@cname[-1].target="strict.bing.com"
uci commit dhcp

uci add dhcp cname
uci set dhcp.@cname[-1].cname="duckduckgo.com"
uci set dhcp.@cname[-1].target="safe.duckduckgo.com"
uci commit dhcp

for name in www.youtube.com m.youtube.com youtubei.googleapis.com youtube.googleapis.com www.youtube-nocookie.com ; do
    uci add dhcp cname
    uci set dhcp.@cname[-1].cname="$name"
    uci set dhcp.@cname[-1].target="restrict.youtube.com"
    uci commit dhcp
done

service dnsmasq restart

See the configuration:

grep -A2 cname /etc/config/dhcp