Solved Force SafeSearch in DuckDuckGo

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

macster2075

Senior Member
Hi,
I currently have a few scripts that force SafeSearch in Google and Bing wich work great...
For Google I am using this

echo address=/www.google.com/216.239.38.120 > /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq

DuckduckGo does not have an IP address for safe.duckduckgo.com -
I have tried the jffs below, but it doesn't work...

echo address=/www.duckduckgo.com/safe.duckduckgo.com > /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq

Any help on this?
Thanks.
 

intr0

Regular Contributor
Hi,
I currently have a few scripts that force SafeSearch in Google and Bing wich work great...
For Google I am using this

echo address=/www.google.com/216.239.38.120 > /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq

DuckduckGo does not have an IP address for safe.duckduckgo.com -
I have tried the jffs below, but it doesn't work...

echo address=/www.duckduckgo.com/safe.duckduckgo.com > /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq

Any help on this?
Thanks.
try
echo address=/duckduckgo.com/safe.duckduckgo.com > /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq
 

macster2075

Senior Member
try
echo address=/duckduckgo.com/safe.duckduckgo.com > /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq
Thanks bud...this was already resolved...but I appreciate it man!
 

SomeWhereOverTheRainBow

Very Senior Member
here is a better block for duckduckgo.com
Code:
{
    echo 'address=/duckduckgo.com/safe.duckduckgo.com'
    echo 'address=/www.duckduckgo.com/safe.duckduckgo.com'
    echo 'address=/start.duckduckgo.com/safe.duckduckgo.com'
    echo 'address=/duck.com/safe.duckduckgo.com'
    echo 'address=/www.duck.com/safe.duckduckgo.com'
} >> /jffs/configs/dnsmasq.conf.add
 
Last edited:

lordtech

Occasional Visitor
here is a better block for duckduckgo.com
Code:
{
    echo 'address=/duckduckgo.com/safe.duckduckgo.com'
    echo 'address=/www.duckduckgo.com/safe.duckduckgo.com'
    echo 'address=/start.duckduckgo.com/safe.duckduckgo.com'
    echo 'address=/duck.com/safe.duckduckgo.com'
    echo 'address=/www.duck.com/safe.duckduckgo.com'
} >> /jffs/configs/dnsmasq.conf.add

Hi @SomeWhereOverTheRainBow, when I added these lines to dnsmasq.conf.add I get an error after I run the service restart_dnsmasq command:

Code:
Mar  4 12:45:31 dnsmasq[20586]: bad address at line 51 of /etc/dnsmasq.conf
Mar  4 12:45:31 dnsmasq[20586]: FAILED to start up

Line 51 is where the "address" lines start...
 

SomeWhereOverTheRainBow

Very Senior Member
Hi @SomeWhereOverTheRainBow, when I added these lines to dnsmasq.conf.add I get an error after I run the service restart_dnsmasq command:

Code:
Mar  4 12:45:31 dnsmasq[20586]: bad address at line 51 of /etc/dnsmasq.conf
Mar  4 12:45:31 dnsmasq[20586]: FAILED to start up

Line 51 is where the "address" lines start...
you have to copy and paste those lines into the terminal.. don't add them directly to dnsmasq.conf.add


For best results, use the script 1 from this link


Code:
touch enforcesafe.sh && cat > "enforcesafe.sh" <<'EOF'
#!/bin/sh
URL="https://www.google.com/supported_domains"
FILE="/jffs/configs/dnsmasq.conf.add"

[ ! -f "$FILE" ] && touch $FILE
echo -e "\n# Enforced Safe Search:\n" >> "${FILE}"
DOMAINS="$(curl $URL 2>/dev/null)"
for DOMAIN in $DOMAINS; do
    DOMAIN=$(echo $DOMAIN | cut -c 2-)
    printf 'cname=www.%s,forcesafesearch.google.com \n' $DOMAIN >> "${FILE}"
done
#this version uses restrictmoderate.youtube.com
for DOMAIN in youtube; do
    printf 'cname=www.%s.com,restrictmoderate.%s.com \n' $DOMAIN $DOMAIN >> "${FILE}"
    printf 'cname=m.%s.com,restrictmoderate.%s.com \n' $DOMAIN $DOMAIN >> "${FILE}"
    printf 'cname=%si.googleapis.com,restrictmoderate.%s.com \n' $DOMAIN $DOMAIN >> "${FILE}"
    printf 'cname=%s.googleapis.com,restrictmoderate.%s.com \n' $DOMAIN $DOMAIN >> "${FILE}"
    printf 'cname=www.%s-nocookie.com,restrictmoderate.%s.com \n' $DOMAIN $DOMAIN >> "${FILE}"
done
for DOMAIN in bing.com; do
    printf 'cname=%s,www.%s,strict.%s \n' $DOMAIN $DOMAIN $DOMAIN >> "${FILE}"
done
for DOMAIN in pixabay.com; do
    printf 'cname=%s,safesearch.%s \n' $DOMAIN $DOMAIN >> "${FILE}"
done
for DOMAIN in duckduckgo.com; do
    printf 'cname=%s,www.%s,start.%s,safe.%s \n' $DOMAIN $DOMAIN $DOMAIN $DOMAIN >> "${FILE}"
    printf 'cname=duck.com,www.duck.com,safe.%s \n' $DOMAIN >> "${FILE}"
done
for DOMAIN in qwant.com; do
    printf 'cname=api.%s,safeapi.%s \n' $DOMAIN $DOMAIN >> "${FILE}"
done
YANDEX="com ru ua by kz"
for DOMAIN in $YANDEX; do
    printf 'cname=yandex.%s,www.yandex.%s,familysearch.yandex.ru \n' $DOMAIN $DOMAIN >> "${FILE}"
done
for DOMAIN in forcesafesearch.google.com safe.duckduckgo.com restrictmoderate.youtube.com strict.bing.com safesearch.pixabay.com safeapi.qwant.com familysearch.yandex.ru; do
IPS="$(nslookup $DOMAIN | grep "Address" | grep -oE "\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" | sed -n 2p)"
    if [ "$DOMAIN" = "forcesafesearch.google.com" ]; then
        printf 'host-record=%s,restrict.youtube.com,%s,::ffff:%s \n' $DOMAIN $IPS $IPS >> "${FILE}"
    else
        printf 'host-record=%s,%s,::ffff:%s \n' $DOMAIN $IPS $IPS >> "${FILE}"
    fi
done
echo -e "\n# End of Enforced Safe Search #\n" >> "${FILE}"
service restart_dnsmasq >/dev/null 2>&1
EOF
sh enforcesafe.sh && rm -rf enforcesafe.sh


Copy and paste this script directly into the ssh terminal and press enter.

all of your safesearch needs will be covered.
 
Last edited:

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top