banip: update 1.8.5-2

* fixed two issues in the mail template, reported in the forum
* tweak the f_report function
* changed the f_actual function to reduce subshell calls
* further optimize the monitor function:
  * fixed a possible RDAP rate-limit race condition,
    serialize the rdap_tsfile via flock
  * block_cache bounded growth, when the cache reaches 500
    entries it resets to empty, preventing unbounded string growth
    in the monitor loop
* set the printf format string in single quotes (overall)

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken
2026-04-11 18:43:09 +02:00
parent 684e738cab
commit 79f2db6cc5
4 changed files with 314 additions and 280 deletions

View File

@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=banip
PKG_VERSION:=1.8.5
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>

File diff suppressed because it is too large Load Diff

View File

@@ -44,7 +44,7 @@ fi
#
f_log "info" "start banIP download processes"
f_getfeed
[ "${ban_deduplicate}" = "1" ] && printf "\n" >"${ban_tmpfile}.deduplicate"
[ "${ban_deduplicate}" = "1" ] && printf '\n' >"${ban_tmpfile}.deduplicate"
# handle downloads
#

View File

@@ -7,7 +7,7 @@ local banip_info report_info log_info system_info mail_text
# log info preparation
#
if [ -f "${ban_logreadfile}" ] && [ -x "${ban_logreadcmd}" ] && [ "${ban_logreadcmd##*/}" = "tail" ]; then
log_info="$("${ban_logreadcmd}" -qn "${ban_loglimit}" "${ban_logreadfile}" 2>/dev/null | "${ban_grepcmd}" -e "banIP/" 2>/dev/null)"
log_info="$("${ban_logreadcmd}" -qn "${ban_loglimit}" "${ban_logreadfile}" 2>/dev/null | "${ban_grepcmd}" -e "banIP-" 2>/dev/null)"
elif [ -x "${ban_logreadcmd}" ] && [ "${ban_logreadcmd##*/}" = "logread" ]; then
log_info="$("${ban_logreadcmd}" -l "${ban_loglimit}" -e "banIP-" 2>/dev/null)"
fi
@@ -15,33 +15,33 @@ fi
# banIP status and report info preparation
#
banip_info="$(/etc/init.d/banip status 2>/dev/null)"
report_info="$(< "${ban_reportdir}/ban_report.txt")" 2>/dev/null
report_info="$("${ban_catcmd}" "${ban_reportdir}/ban_report.txt" 2>/dev/null)"
system_info="$(strings /etc/banner 2>/dev/null; "${ban_ubuscmd}" call system board | \
"${ban_awkcmd}" 'BEGIN{FS="[{}\"]"}{if($2=="kernel"||$2=="hostname"||$2=="system"||$2=="model"||$2=="description")printf " + %-12s: %s\n",$2,$4}')"
# mail text preparation
#
mail_text="$(
printf "%s\n" "<html><body><pre style='font-family:monospace;padding:20;background-color:#f3eee5;white-space:pre-wrap;overflow-x:auto;' >"
printf "\n%s\n" "<strong>++
printf '%s\n' "<html><body><pre style='font-family:monospace;padding:20;background-color:#f3eee5;white-space:pre-wrap;overflow-x:auto;' >"
printf '\n%s\n' "<strong>++
++ System Information ++
++</strong>"
printf "%s\n" "${system_info:-"-"}"
printf "\n%s\n" "<strong>++
printf '%s\n' "${system_info:-"-"}"
printf '\n%s\n' "<strong>++
++ banIP Status ++
++</strong>"
printf "%s\n" "${banip_info:-"-"}"
printf '%s\n' "${banip_info:-"-"}"
[ -n "${report_info}" ] && {
printf "\n%s\n" "<strong>++
printf '\n%s\n' "<strong>++
++ banIP Report ++
++</strong>"
printf "%s\n" "${report_info}"
printf '%s\n' "${report_info}"
}
[ -n "${log_info}" ] && {
printf "\n%s\n" "<strong>++
printf '\n%s\n' "<strong>++
++ Logfile Information ++
++</strong>"
printf "%s\n" "${log_info}"
printf '%s\n' "${log_info}"
}
printf "%s\n" "</pre></body></html>"
printf '%s\n' "</pre></body></html>"
)"