* suspend & resume adblock actions temporarily without blocklist reloading
* provide comprehensive runtime information via LuCI or via 'status' init command
* provide a detailed DNS Query Report with dns related information about client requests, top (blocked) domains and more
-* query function to quickly identify blocked (sub-)domains, e.g. for whitelisting
+* provide a query function to quickly identify blocked (sub-)domains, e.g. for whitelisting. This function is also able to search in adblock backups, to get back the set of blocking lists sources for a certain domain
* force dns requests to local resolver
* force overall sort / duplicate removal for low memory devices (handle with care!)
* automatic blocklist backup & restore, they will be used in case of download errors or during startup in backup mode
* for limited devices with real memory constraints, adblock provides also a 'http only' option and supports wget-nossl and uclient-fetch (without libustream-ssl) as well
* for more configuration options see examples below
* email notification (optional): for email notification support you need to install and configure the additional 'msmtp' package
-* DNS Query Report (optional): for this detailed report you need to install the additional package 'tcpdump-mini'
+* DNS Query Report (optional): for this detailed report you need to install the additional package 'tcpdump' or 'tcpdump-mini'
## Installation & Usage
* install 'adblock' (_opkg install adblock_)
list blacklist 'domains:/tmp/adb_list.overall'
</code></pre>
+**reference the jail block list manually in a 'kidsafe' dhcp config:**
+
+The additional 'Jail' blocklist (by default in /tmp/adb_list.jail) block access to all domains except those listed in the whitelist file.
+<pre><code>
+config dnsmasq 'kidsafe'
+ [...]
+ option serversfile '/tmp/adb_list.jail'
+</code></pre>
+
**enable email notification via msmtp:**
To use the email notification you have to install & configure the package 'msmtp'.
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-adb_ver="3.6.4"
+adb_ver="3.6.5"
adb_sysver="unknown"
adb_enabled=0
adb_debug=0
;;
esac
fi
+ f_log "debug" "f_uci ::: config: ${config}, change: ${change}"
fi
- f_log "debug" "f_uci ::: config: ${config}, change: ${change}"
}
# list/overall count
case "${adb_dns}" in
dnsmasq)
uci_config="dhcp"
- if [ ${adb_enabled} -eq 1 ] && [ -z "$(uci_get dhcp "@dnsmasq[${adb_dnsinstance}]" serversfile | grep -Fo "${adb_dnsdir}/${adb_dnsfile}")" ]
+ if [ ${adb_enabled} -eq 1 ] && [ -n "$(uci_get dhcp "@dnsmasq[${adb_dnsinstance}]")" ] && \
+ [ -z "$(uci_get dhcp "@dnsmasq[${adb_dnsinstance}]" serversfile | grep -Fo "${adb_dnsdir}/${adb_dnsfile}")" ] && \
+ [ -z "$(uci_get dhcp "@dnsmasq[${adb_dnsinstance}]" serversfile | grep -Fo "${adb_dnsdir}/${adb_dnsjail}")" ]
then
uci_set dhcp "@dnsmasq[${adb_dnsinstance}]" serversfile "${adb_dnsdir}/${adb_dnsfile}"
elif [ ${adb_enabled} -eq 0 ] && [ -n "$(uci_get dhcp "@dnsmasq[${adb_dnsinstance}]" serversfile | grep -Fo "${adb_dnsdir}/${adb_dnsfile}")" ]
#
f_jsnup()
{
- local run_time bg_pid status="${1:-"enabled"}" mode="normal mode" no_mail=0
+ local run_time bg_pid status="${1:-"enabled"}" mode="normal mode"
if [ ${adb_rc} -gt 0 ]
then
fi
if [ "${status}" = "resume" ]
then
- no_mail=1
- status="enabled"
+ status=""
fi
if [ ${adb_backup_mode} -eq 1 ]
then
json_load_file "${adb_rtfile}" >/dev/null 2>&1
json_init
json_add_object "data"
- json_add_string "adblock_status" "${status}"
+ json_add_string "adblock_status" "${status:-"enabled"}"
json_add_string "adblock_version" "${adb_ver}"
json_add_string "overall_domains" "${adb_cnt:-0} (${mode})"
json_add_string "fetch_utility" "${adb_fetchinfo:-"-"}"
json_close_object
json_dump > "${adb_rtfile}"
- if [ ${adb_notify} -eq 1 ] && [ ${no_mail} -eq 0 ] && [ -x /etc/adblock/adblock.notify ] && \
+ if [ ${adb_notify} -eq 1 ] && [ -x /etc/adblock/adblock.notify ] && \
([ "${status}" = "error" ] || ([ "${status}" = "enabled" ] && [ ${adb_cnt} -le ${adb_notifycnt} ]))
then
(/etc/adblock/adblock.notify >/dev/null 2>&1)&
bg_pid=${!}
fi
- f_log "debug" "f_jsnup ::: status: ${status}, mode: ${mode}, cnt: ${adb_cnt}, notify: ${adb_notify}, notify_cnt: ${adb_notifycnt}, notify_pid: ${bg_pid:-"-"}"
+ f_log "debug" "f_jsnup ::: status: ${status:-"-"}, mode: ${mode}, cnt: ${adb_cnt}, notify: ${adb_notify}, notify_cnt: ${adb_notifycnt}, notify_pid: ${bg_pid:-"-"}"
}
# write to syslog
if [ ${adb_report} -eq 1 ] && [ ! -x "${adb_reputil}" ]
then
- f_log "info" "Please install the package 'tcpdump-mini' to use the adblock reporting feature!"
+ f_log "info" "Please install the package 'tcpdump' or 'tcpdump-mini' to use the adblock reporting feature!"
elif [ ${adb_report} -eq 0 ] && [ "${adb_action}" = "report" ]
then
f_log "info" "Please enable the extra option 'adb_report' to use the adblock reporting feature!"
for client in ${rep_clients}
do
json_add_object
- json_add_string "count" "${client%_*}"
+ json_add_string "count" "${client%%_*}"
json_add_string "address" "${client#*_}"
json_close_object
done
for domain in ${rep_domains}
do
json_add_object
- json_add_string "count" "${domain%_*}"
+ json_add_string "count" "${domain%%_*}"
json_add_string "address" "${domain#*_}"
json_close_object
done
for block in ${rep_blocked}
do
json_add_object
- json_add_string "count" "${block%_*}"
+ json_add_string "count" "${block%%_*}"
json_add_string "address" "${block#*_}"
json_close_object
done