safe-search: Dynamic Updates

Ensure that the best available IP is always used for all supported
safe-search providers. This is accomplished by periodically checking
DNS for the most recent list of IP addresses associated with each
provider.

Signed-off-by: Gregory L. Dietsche <gregory.dietsche@cuw.edu>
This commit is contained in:
Gregory L. Dietsche
2021-01-11 11:59:46 -06:00
committed by Paul Spooren
parent 0f21ed774c
commit f2837d7470
9 changed files with 936 additions and 462 deletions
+14 -3
View File
@@ -1,13 +1,13 @@
#
# Copyright (c) 2018 Gregory L. Dietsche <Gregory.Dietsche@cuw.edu>
# Copyright (c) 2021 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.2
PKG_RELEASE:=2
PKG_VERSION:=2.0.0
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_MAINTAINER:=Gregory L. Dietsche <Gregory.Dietsche@cuw.edu>
@@ -44,18 +44,29 @@ define Package/safe-search/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/safe-search-update $(1)/usr/sbin/safe-search-update
$(INSTALL_BIN) ./files/safe-search-maintenance $(1)/usr/sbin/safe-search-maintenance
$(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/postinst
#!/bin/sh
if [ -z "$${IPGK_INSTROOT}" ]; then
echo "0 * * * * /bin/nice /usr/sbin/safe-search-maintenance>/dev/null 2>&1">>/etc/crontabs/root
/etc/init.d/cron restart
fi
exit 0
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
crontab -l | grep -v "safe-search-maintenance" | sort | uniq | crontab -
fi
exit 0
endef