mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-07 09:02:36 +08:00
Compare commits
2 Commits
acx/prj-cm
...
urlfilter_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
078d7f237c | ||
|
|
1337ba6d57 |
@@ -5,19 +5,19 @@
|
||||
enabled="$(uci -q get parentalcontrol.globals.enable)"
|
||||
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"
|
||||
|
||||
# if parentalcontrol is enabled, add the rules, else remove them
|
||||
# if parentalcontrol is enabled, add the rules, else remove them
|
||||
if [ "${enabled}" -eq "1" ]; then
|
||||
# this is for internet_access and profile_bedtime_schedule sections
|
||||
add_internet_schedule_rules
|
||||
# this is for urlfilter daemon
|
||||
add_iptables_nfqueue_rules
|
||||
if [ "${urlfilter}" -eq "1" ]; then
|
||||
# this for internet_access and profile_bedtime_schedule sections
|
||||
add_internet_schedule_rules
|
||||
add_iptables_nfqueue_rules
|
||||
fi
|
||||
else
|
||||
# remove internet_access and profile_bedtime_schedule rules
|
||||
remove_internet_schedule_rules
|
||||
# remove urlfilter daemon rules
|
||||
remove_iptables_nfqueue_rules
|
||||
if [ "${urlfilter}" -eq "1" ]; then
|
||||
# remove internet_access and profile_bedtime_schedule rules
|
||||
remove_internet_schedule_rules
|
||||
remove_iptables_nfqueue_rules
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -83,14 +83,13 @@ start_service() {
|
||||
config_load parentalcontrol
|
||||
validate_global_section
|
||||
|
||||
[ -n "${bundle_path}" ] && mkdir -p ${bundle_path}
|
||||
|
||||
# add default bundles
|
||||
process_default_bundles
|
||||
# add firewall rules
|
||||
configure_fw_rules
|
||||
|
||||
if [ "${urlfilter}" -eq "1" ]; then
|
||||
if [ "${urlfilter}" -eq "1" ] && [ -d "/apps" ]; then
|
||||
# add default bundles
|
||||
[ -n "${bundle_path}" ] && mkdir -p ${bundle_path}
|
||||
process_default_bundles
|
||||
enable_urlfilter_dm
|
||||
else
|
||||
disable_urlfilter_dm
|
||||
@@ -100,7 +99,7 @@ start_service() {
|
||||
# then /tmp/dhcp.leases will be empty until clients try to get a lease,
|
||||
# in that case, hostnames will not be processed by the daemon,
|
||||
# for this we copy /tmp/dhcp.leases to /etc/parentalcontrol/dhcp.leases
|
||||
# which will be persistent acrros reboots and upgrade where settings are kept
|
||||
# which will be persistent across reboots and upgrade (with keep settings)
|
||||
# and will be used as a backup in case /tmp/dhcp.leases is empty
|
||||
copy_dhcp_leases
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# if /apps partition is not present then we don't support urlfiltering
|
||||
[ -d "/apps" ] || exit 0
|
||||
|
||||
COUNT=1
|
||||
|
||||
add_urlbundle()
|
||||
|
||||
@@ -13,7 +13,7 @@ IP_RULE=""
|
||||
ACL_FILE=""
|
||||
parentalcontrol_ipv4_forward=""
|
||||
parentalcontrol_ipv6_forward=""
|
||||
default_bundle_dir="/tmp/parentalcontrol/default/"
|
||||
default_bundle_dir="/apps/parentalcontrol/default/"
|
||||
bundle_archive="/etc/parentalcontrol/urlbundles.tar.xz"
|
||||
|
||||
log() {
|
||||
|
||||
@@ -8,7 +8,7 @@ LOCKFILE="/tmp/sync_bundles.lock"
|
||||
# if its a remote file, then it would be downloaded and placed in bundle_dir
|
||||
bundle_path="$(uci -q get parentalcontrol.globals.bundle_path)"
|
||||
if [ -z "${bundle_path}" ]; then
|
||||
bundle_path="/tmp/parentalcontrol"
|
||||
bundle_path="/apps/parentalcontrol"
|
||||
fi
|
||||
|
||||
stringstore_dir="${bundle_path}/stringstore"
|
||||
@@ -227,8 +227,8 @@ handle_filter_for_bundles() {
|
||||
local urlfilter
|
||||
|
||||
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"
|
||||
if [ "${urlfilter}" -ne "1" ]; then
|
||||
logger -p info "urlbundle not supported"
|
||||
# if urlfilter is not enabled or apps partition is not present, then return
|
||||
if [ "${urlfilter}" -ne "1" ] || [ ! -d "/apps" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user