adblock: update 3.6.5 8107/head
authorDirk Brenken <dev@brenken.org>
Sat, 2 Feb 2019 07:38:56 +0000 (08:38 +0100)
committerDirk Brenken <dev@brenken.org>
Sat, 2 Feb 2019 07:38:56 +0000 (08:38 +0100)
- fix reporting for bogus hostnames with underscores
- no longer accidently overwrite existing 'serversfile' entries in dhcp
config which reference to the adblock jail list
- remove needless 'no_mail' flag
- refined log message regarding tcpdump requirement for reporting

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/adblock/Makefile
net/adblock/files/README.md
net/adblock/files/adblock.sh

index 90f88c1a580155582de85ebe181bacaf677a552f..7e4dff09aadf12cde14b0eaf70083f83ae19d102 100644 (file)
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
-PKG_VERSION:=3.6.4
+PKG_VERSION:=3.6.5
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
index 9408f0f7457fabd88ade25bb78d67fff3999b898..a5fbead52f07aa8063f3ece893e48eeb4b298108 100644 (file)
@@ -86,7 +86,7 @@ A lot of people already use adblocker plugins within their desktop browsers, but
 * 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
@@ -104,7 +104,7 @@ A lot of people already use adblocker plugins within their desktop browsers, but
     * 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_)
@@ -198,6 +198,15 @@ To use the blocklist please modify '/etc/config/dnscrypt-proxy' per instance:
   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'.  
index e14993bceb16e723cf42fb2c67647752ebd12992..6b235c62571bde0d8e391e1c74892a8593c398de 100755 (executable)
@@ -10,7 +10,7 @@
 #
 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
@@ -325,8 +325,8 @@ f_uci()
                                ;;
                        esac
                fi
+               f_log "debug" "f_uci    ::: config: ${config}, change: ${change}"
        fi
-       f_log "debug" "f_uci    ::: config: ${config}, change: ${change}"
 }
 
 # list/overall count
@@ -362,7 +362,9 @@ f_extconf()
        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}")" ]
@@ -742,7 +744,7 @@ f_query()
 #
 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
@@ -759,8 +761,7 @@ f_jsnup()
        fi
        if [ "${status}" = "resume" ]
        then
-               no_mail=1
-               status="enabled"
+               status=""
        fi
        if [ ${adb_backup_mode} -eq 1 ]
        then
@@ -790,7 +791,7 @@ f_jsnup()
        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:-"-"}"
@@ -800,13 +801,13 @@ f_jsnup()
        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
@@ -1060,7 +1061,7 @@ f_report()
 
        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!"
@@ -1151,7 +1152,7 @@ f_report()
                                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
@@ -1160,7 +1161,7 @@ f_report()
                                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
@@ -1169,7 +1170,7 @@ f_report()
                                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