aboutsummaryrefslogtreecommitdiff
path: root/net/adblock/files/adblock.mail
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2021-04-17 09:41:17 +0200
committerDirk Brenken <dev@brenken.org>2021-04-17 16:53:30 +0200
commitc531b6daea6962c32813b5815105343a76746147 (patch)
treee66b29ed0bab5ebd6a573363777c66d5f7eeae46 /net/adblock/files/adblock.mail
parent37f4d88cf2e1460aaa9690af47945c076531725e (diff)
adblock: update to 4.1.1
* support the RPZ trigger 'RPZ-CLIENT-IP' to always allow/block certain clients based on their IP (currently only supported by bind!) * avoid promiscuous mode in tcpdump setup for adblock reporting * speed up dns report preparation * support dns report mailing (/etc/init.d/adblock report mail) * fix bind autodetection * update LuCI-frontend (separate PR) * update readme Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'net/adblock/files/adblock.mail')
-rwxr-xr-xnet/adblock/files/adblock.mail17
1 files changed, 11 insertions, 6 deletions
diff --git a/net/adblock/files/adblock.mail b/net/adblock/files/adblock.mail
index be5d26072..010e45b2a 100755
--- a/net/adblock/files/adblock.mail
+++ b/net/adblock/files/adblock.mail
@@ -34,7 +34,7 @@ f_log()
then
"${adb_logger}" -p "${class}" -t "adblock-${adb_ver}[${$}]" "${log_msg}"
else
- printf "%s %s %s\\n" "${class}" "adblock-${adb_ver}[${$}]" "${log_msg}"
+ printf "%s %s %s\n" "${class}" "adblock-${adb_ver}[${$}]" "${log_msg}"
fi
}
@@ -44,17 +44,18 @@ then
exit ${adb_rc}
fi
-if [ "${adb_debug}" -eq 1 ]
+if [ "${adb_debug}" = "1" ]
then
debug="--debug"
fi
-adb_mailhead="From: ${adb_mailsender}\\nTo: ${adb_mailreceiver}\\nSubject: ${adb_mailtopic}\\nReply-to: ${adb_mailsender}\\nMime-Version: 1.0\\nContent-Type: text/html\\nContent-Disposition: inline\\n\\n"
+adb_mailhead="From: ${adb_mailsender}\nTo: ${adb_mailreceiver}\nSubject: ${adb_mailtopic}\nReply-to: ${adb_mailsender}\nMime-Version: 1.0\nContent-Type: text/html;charset=utf-8\nContent-Disposition: inline\n\n"
# info preparation
#
sys_info="$(strings /etc/banner 2>/dev/null; ubus call system board | sed -e 's/\"release\": {//' | sed -e 's/^[ \t]*//' | sed -e 's/[{}\",]//g' | sed -e 's/[ ]/ \t/' | sed '/^$/d' 2>/dev/null)"
adb_info="$(/etc/init.d/adblock status 2>/dev/null)"
+rep_info="${2}"
if [ -x "${adb_logread}" ]
then
log_info="$("${adb_logread}" -l 100 -e "adblock-" | awk '{NR=1;max=120;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max)}else{print substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}')"
@@ -63,9 +64,13 @@ fi
# mail body
#
adb_mailtext="<html><body><pre style='display:block;font-family:monospace;font-size:1rem;padding:20;background-color:#f3eee5;white-space:pre'>"
-adb_mailtext="${adb_mailtext}\\n<strong>++\\n++ System Information ++\\n++</strong>\\n${sys_info}"
-adb_mailtext="${adb_mailtext}\\n\\n<strong>++\\n++ Adblock Information ++\\n++</strong>\\n${adb_info}"
-adb_mailtext="${adb_mailtext}\\n\\n<strong>++\\n++ Logfile Information ++\\n++</strong>\\n${log_info}"
+adb_mailtext="${adb_mailtext}\n<strong>++\n++ System Information ++\n++</strong>\n${sys_info}"
+adb_mailtext="${adb_mailtext}\n\n<strong>++\n++ Adblock Information ++\n++</strong>\n${adb_info}"
+if [ -n "${rep_info}" ]
+then
+ adb_mailtext="${adb_mailtext}\n\n<strong>++\n++ Report Information ++\n++</strong>\n${rep_info}"
+fi
+adb_mailtext="${adb_mailtext}\n\n<strong>++\n++ Logfile Information ++\n++</strong>\n${log_info}"
adb_mailtext="${adb_mailtext}</pre></body></html>"
# send mail