-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathunbound_SafeSearch.sh
55 lines (54 loc) · 3.36 KB
/
unbound_SafeSearch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
VER="1.02"
# Original script http://www.snbforums.com/threads/safesearchenforcement-with-unbound.68314/ by SNBForum member @SomeWhereOverTheRainBow
URL="https://www.google.com/supported_domains"
#file="/etc/unbound/unbound.conf.d/safesearch.conf" #this can be where-ever your unbound config storage is. You will have to use include: option inside the main unbound.conf though.
FN="/opt/share/unbound/configs/unbound.conf.safesearch" #this can be where-ever your unbound config storage is. You will have to use include: option inside the main unbound.conf though. # Martineau Hack
echo "server:" > "${FN}"
echo -e "\n# $(date)\n# Google Safe Search: "$URL >> "${FN}" # @Martineau Hack
DOMAINS=$(curl $URL 2>/dev/null)
for DOMAIN in $DOMAINS;do
DOMAIN=$(echo $DOMAIN | cut -c 2-)
#printf 'local-zone: "%s" redirect \n' $DOMAIN >> "${FN}" # v1.02 Disable so Android properly recieves push notifications @SomeWhereOverTheRainBow
#printf 'local-data: "%s CNAME forcesafesearch.google.com" \n' $DOMAIN >> "${FN}" # v1.02 Disable so Android properly recieves push notifications @SomeWhereOverTheRainBow
printf 'local-zone: "www.%s" redirect \n' $DOMAIN >> "${FN}"
printf 'local-data: "www.%s CNAME forcesafesearch.google.com" \n' $DOMAIN >> "${FN}"
done
echo -e "\n# Youtube Safe Search:" >> "${FN}" # @Martineau Hack
#for DOMAIN in youtube; do
for PREFIX in www.youtube m.youtube youtubei.googleapis youtube.googleapis www.youtube-nocookie;do # v1.02 @SomeWhereOverTheRainBow @Martineau Hack
printf 'local-zone: "%s.com" redirect \n' $PREFIX >> "${FN}"
printf 'local-data: "%s.com CNAME restrictmoderate.youtube.com" \n' $PREFIX >> "${FN}"
done
#done
echo -e "\n# Yandex Safe Search: " >> "${FN}" # @Martineau Hack
#for DOMAIN in yandex;do # @Martineau Hack
for SUFFIX in com ru ua by kz;do
printf 'local-zone: "yandex.%s" redirect \n' $SUFFIX >> "${FN}"
printf 'local-data: "yandex.%s CNAME familysearch.yandex.%s" \n' $SUFFIX $SUFFIX >> "${FN}"
done
#done
echo -e "\n# duckduckgo Safe Search:" >> "${FN}" # @Martineau Hack
#for DOMAIN in duckduckgo;do # @Martineau Hack
for PREFIX in duckduckgo www.duckduckgo start.duckduckgo duck www.duck;do # Martineau Hack
printf 'local-zone: "%s.com" redirect \n' $PREFIX >> "${FN}"
printf 'local-data: "%s.com CNAME safe.duckduckgo.com" \n' $PREFIX >> "${FN}"
done
#done
echo -e "\n# Bing Safe Search:" >> "${FN}" # @Martineau Hack
#for DOMAIN in bing;do # @Martineau Hack
for PREFIX in bing www.bing;do # Martineau Hac
printf 'local-zone: "%s.com" redirect \n' $PREFIX >> "${FN}"
printf 'local-data: "%s.com CNAME strict.bing.com" \n' $PREFIX >> "${FN}"
done
#done
echo -e "\n# QWant Safe Api:" >> "${FN}" # @Martineau Hack
#for DOMAIN in qwant;do
for PREFIX in api.qwant.com;do
printf 'local-zone: "%s" redirect \n' $PREFIX >> "${FN}"
printf 'local-data: "%s CNAME safe%s" \n' $PREFIX $PREFIX >> "${FN}"
done
#done
echo -e "\n# pixabay Safe Search:" >> "${FN}" # @Martineau Hack
printf 'local-zone: "pixabay.com" redirect \n' >> "${FN}"
printf 'local-data: "pixabay.com CNAME safesearch.pixabay.com" \n' >> "${FN}"