mirror of
https://github.com/openwrt/packages.git
synced 2026-12-04 11:15:36 +04:00
banip: release 1.8.6-1
* fixed the initialization of the banIP rundir (reported in the forum) * sanitize possible windows line endings in local block- and allowlist * refine the cpu/core detection * code clean-up/linting Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
7 files changed
+646
-681
No files matched your search
+2
-2
@@ -5,8 +5,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=banip
|
||||
PKG_VERSION:=1.8.5
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=1.8.6
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||
|
||||
|
||||
@@ -15,18 +15,18 @@ for option in ${old_options}; do
|
||||
old_values="$(uci -q get "${config}.global.${option}" 2>/dev/null)"
|
||||
for value in ${old_values}; do
|
||||
case "${option}" in
|
||||
"ban_loginput" | "ban_logforwardwan")
|
||||
uci -q set "${config}".global.ban_loginbound="${value}"
|
||||
"ban_loginput" | "ban_logforwardwan")
|
||||
uci -q set "${config}".global.ban_loginbound="${value}"
|
||||
;;
|
||||
"ban_logforwardlan")
|
||||
uci -q set "${config}".global.ban_logoutbound="${value}"
|
||||
"ban_logforwardlan")
|
||||
uci -q set "${config}".global.ban_logoutbound="${value}"
|
||||
;;
|
||||
"ban_blockpolicy")
|
||||
if printf "%s" "${old_values}" | grep -qw "input\|forwardwan\|forwardlan"; then
|
||||
break
|
||||
else
|
||||
continue 2
|
||||
fi
|
||||
"ban_blockpolicy")
|
||||
if printf '%s' "${old_values}" | grep -qw "input\|forwardwan\|forwardlan"; then
|
||||
break
|
||||
else
|
||||
continue 2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -37,6 +37,6 @@ done
|
||||
custom_feed="/etc/banip/banip.custom.feeds"
|
||||
if grep -q '"rule_4"' "${custom_feed}"; then
|
||||
mv -f "${custom_feed}" "${custom_feed}.backup.$(date "+%Y%m%d%H%M%S")"
|
||||
: > "${custom_feed}"
|
||||
: >"${custom_feed}"
|
||||
fi
|
||||
exit 0
|
||||
+598
-636
File diff suppressed because it is too large.
Load diff
@@ -7,7 +7,7 @@
|
||||
# shellcheck disable=all
|
||||
|
||||
ban_action="${1}"
|
||||
read -r ban_starttime _ < "/proc/uptime"
|
||||
read -r ban_starttime _ <"/proc/uptime"
|
||||
ban_starttime="${ban_starttime%%.*}"
|
||||
ban_funlib="/usr/lib/banip-functions.sh"
|
||||
[ -z "${ban_bver}" ] && . "${ban_funlib}"
|
||||
@@ -64,17 +64,17 @@ for feed in allowlist ${ban_feed} blocklist; do
|
||||
#
|
||||
if [ "${ban_allowlistonly}" = "1" ]; then
|
||||
case "${ban_feedin}" in
|
||||
*" allowlist "*)
|
||||
;;
|
||||
*" allowlist "*) ;;
|
||||
|
||||
*)
|
||||
case "${ban_feedout}" in
|
||||
*" allowlist "*) ;;
|
||||
|
||||
*)
|
||||
case "${ban_feedout}" in
|
||||
*" allowlist "*)
|
||||
;;
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -94,7 +94,7 @@ for feed in allowlist ${ban_feed} blocklist; do
|
||||
|
||||
# skip incomplete feeds
|
||||
#
|
||||
if { [ -z "${feed_url_4}" ] && [ -z "${feed_url_6}" ]; } || \
|
||||
if { [ -z "${feed_url_4}" ] && [ -z "${feed_url_6}" ]; } ||
|
||||
{ { [ -n "${feed_url_4}" ] || [ -n "${feed_url_6}" ]; } && [ -z "${feed_rule}" ]; }; then
|
||||
f_log "info" "skip incomplete feed '${feed}'"
|
||||
continue
|
||||
|
||||
@@ -34,13 +34,13 @@ request_decode() {
|
||||
# validate value as an IP address, otherwise ignore the request
|
||||
#
|
||||
case "${value}" in
|
||||
[0-9]*.[0-9]*.[0-9]*.[0-9]*)
|
||||
;;
|
||||
[0-9A-Fa-f]*:*[0-9A-Fa-f])
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
[0-9]*.[0-9]*.[0-9]*.[0-9]*) ;;
|
||||
|
||||
[0-9A-Fa-f]*:*[0-9A-Fa-f]) ;;
|
||||
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# only log if token matches and banip is running, otherwise ignore the request
|
||||
|
||||
+12
-12
@@ -22,20 +22,20 @@ ban_lock="/var/run/banIP/banIP.lock"
|
||||
|
||||
if [ -z "${IPKG_INSTROOT}" ]; then
|
||||
case "${action}" in
|
||||
"boot")
|
||||
"${ban_init}" running && exit 0
|
||||
;;
|
||||
"stop"|"report"|"content")
|
||||
"${ban_init}" running || exit 0
|
||||
;;
|
||||
"boot")
|
||||
"${ban_init}" running && exit 0
|
||||
;;
|
||||
"stop" | "report" | "content")
|
||||
"${ban_init}" running || exit 0
|
||||
;;
|
||||
esac
|
||||
case "${action}" in
|
||||
"boot"|"start"|"restart"|"reload"|"search")
|
||||
if [ -d "${ban_lock}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "${ban_lock}"
|
||||
;;
|
||||
"boot" | "start" | "restart" | "reload" | "search")
|
||||
if [ -d "${ban_lock}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "${ban_lock}"
|
||||
;;
|
||||
esac
|
||||
. "${ban_funlib}"
|
||||
fi
|
||||
|
||||
@@ -16,8 +16,11 @@ fi
|
||||
#
|
||||
banip_info="$(/etc/init.d/banip status 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}')"
|
||||
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
|
||||
#
|
||||
|
||||
Reference in new issue
Block a user