From 1557ddfe83fb1045237fb882b6a80860726b1d0f Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sat, 25 Nov 2023 08:22:42 +0100 Subject: [PATCH] banip: update 0.9.2-3 * fix the urlhaus regex * fix a possible init race condition Signed-off-by: Dirk Brenken --- net/banip/Makefile | 2 +- net/banip/files/banip-functions.sh | 6 +++--- net/banip/files/banip.feeds | 2 +- net/banip/files/banip.init | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/net/banip/Makefile b/net/banip/Makefile index 7c559458f2..c89df331e6 100644 --- a/net/banip/Makefile +++ b/net/banip/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=banip PKG_VERSION:=0.9.2 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Dirk Brenken diff --git a/net/banip/files/banip-functions.sh b/net/banip/files/banip-functions.sh index db2c15f6bb..1a1266d035 100644 --- a/net/banip/files/banip-functions.sh +++ b/net/banip/files/banip-functions.sh @@ -194,10 +194,10 @@ f_rmpid() { for pid in ${pids}; do pids="${pids} $(pgrep -P "${pid}" 2>/dev/null)" done + for pid in ${pids}; do + kill -INT "${pid}" >/dev/null 2>&1 + done fi - for pid in ${pids}; do - kill -INT "${pid}" >/dev/null 2>&1 - done : >"${ban_rdapfile}" : >"${ban_pidfile}" } diff --git a/net/banip/files/banip.feeds b/net/banip/files/banip.feeds index cfe1a70cc6..72177cd3f7 100644 --- a/net/banip/files/banip.feeds +++ b/net/banip/files/banip.feeds @@ -256,7 +256,7 @@ }, "urlhaus":{ "url_4": "https://urlhaus.abuse.ch/downloads/ids/", - "rule_4": "match($0,/(([0-9]{1,3}\\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5]))/){printf \"%s,\\n\",substr($0,RSTART,RLENGTH)}", + "rule_4": "match($0,/(content:\"([0-9]{1,3}\\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\")/){printf \"%s,\\n\",substr($0,RSTART+9,RLENGTH-9)}", "descr": "urlhaus IDS IPs" }, "urlvir":{ diff --git a/net/banip/files/banip.init b/net/banip/files/banip.init index a934b4a919..4ef70e3d0c 100755 --- a/net/banip/files/banip.init +++ b/net/banip/files/banip.init @@ -22,6 +22,7 @@ ban_lock="/var/run/banip.lock" [ "${action}" = "boot" ] && "${ban_init}" running && exit 0 { [ "${action}" = "stop" ] || [ "${action}" = "report" ] || [ "${action}" = "search" ] || [ "${action}" = "survey" ] || [ "${action}" = "lookup" ]; } && ! "${ban_init}" running && exit 0 +[ ! -r "${ban_funlib}" ] && { [ "${action}" = "boot" ] || [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "stop" ] || [ "${action}" = "report" ] || [ "${action}" = "search" ] || [ "${action}" = "lookup" ] || [ "${action}" = "status" ]; } && exit 1 [ -d "${ban_lock}" ] && { [ "${action}" = "boot" ] || [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "lookup" ]; } && exit 1 [ ! -d "${ban_lock}" ] && { [ "${action}" = "boot" ] || [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "lookup" ]; } && mkdir -p "${ban_lock}" @@ -31,8 +32,8 @@ boot() { } start_service() { + [ -z "$(command -v "f_system")" ] && . "${ban_funlib}" if "${ban_init}" enabled; then - [ -z "$(command -v "f_system")" ] && . "${ban_funlib}" f_rmpid procd_open_instance "banip-service" procd_set_param command "${ban_service}" "${@:-"${action}"}" @@ -43,7 +44,6 @@ start_service() { procd_set_param stderr 1 procd_close_instance else - [ -z "$(command -v "f_system")" ] && . "${ban_funlib}" f_log "err" "banIP service autostart is disabled" rm -rf "${ban_lock}" fi -- 2.30.2