net/safe-search: new package

This package forces the use of Google and Bing safe search by default.
It does this by adding hosts files for dnsmasq to use. These hosts replace the
normal IP addresses for Google and Bing with addresses that force safe
search to be turned on all the time.

Google and Bing Safe Search are suitable for most businesses, schools, and
families who wish to block adult content. This package also offers
YouTube's restricted and 'restricted moderate' via a configuration
option. The reason that this is not enabled is that it is probably more
suitable for children rather than a wide audience.

This package is designed so that other services that offer safe search can be
added easily in the future.

For more information about safe search please visit these URLs:
- https://support.google.com/websearch/answer/186669
- https://help.bing.microsoft.com/#apex/18/en-US/10003/0
- https://support.google.com/a/answer/6212415

Signed-off-by: Gregory L. Dietsche <gregory.dietsche@cuw.edu>
This commit is contained in:
Gregory L. Dietsche
2018-10-01 17:03:12 -05:00
committed by Yousong Zhou
parent e5477e3dec
commit ed6c58b84d
9 changed files with 993 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
#
# Copyright (c) 2018 Gregory L. Dietsche <Gregory.Dietsche@cuw.edu>
# This is free software, licensed under the MIT License
#
include $(TOPDIR)/rules.mk
PKG_NAME:=safe-search
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_MAINTAINER:=Gregory L. Dietsche <Gregory.Dietsche@cuw.edu>
include $(INCLUDE_DIR)/package.mk
define Package/safe-search
SECTION:=net
CATEGORY:=Network
TITLE:=Safe Search
PKGARCH:=all
endef
define Package/safe-search/description
This package prevents adult content from appearing in search results by
configuring dnsmasq to force all devices on your network to use Google and
Bing's Safe Search IP addresses. This is designed to be approperiate for most
businesses and families. The default filtering rules do not interfere with
normal web browsing.
endef
define Package/safe-search/conffiles
/etc/config/safe-search
endef
define Build/Compile
endef
define Package/safe-search/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(CP) ./files/safe-search.defaults $(1)/etc/uci-defaults/safe-search
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/safe-search.conf $(1)/etc/config/safe-search
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/safe-search-update $(1)/usr/sbin/safe-search-update
$(INSTALL_DIR) $(1)/etc/safe-search/enabled
$(INSTALL_DIR) $(1)/etc/safe-search/available
$(INSTALL_DATA) ./files/hosts/* $(1)/etc/safe-search/available/
endef
define Package/safe-search/prerm
#!/bin/sh
if [ -z "$${IPGK_INSTROOT}" ]; then
uci del_list dhcp.@dnsmasq[0].addnhosts=/etc/safe-search/enabled
uci commit dhcp
/etc/init.d/dnsmasq reload
fi
exit 0
endef
define Package/safe-search/postrm
#!/bin/sh
if [ -z "$${IPGK_INSTROOT}" ]; then
rm -rf /etc/safe-search/enabled
rmdir /etc/safe-search/available
rmdir /etc/safe-search/
fi
exit 0
endef
$(eval $(call BuildPackage,safe-search))