banip: update 0.9.2-3
authorDirk Brenken <dev@brenken.org>
Sat, 25 Nov 2023 07:22:42 +0000 (08:22 +0100)
committerDirk Brenken <dev@brenken.org>
Sat, 25 Nov 2023 07:24:36 +0000 (08:24 +0100)
* fix the urlhaus regex
* fix a possible init race condition

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/banip/Makefile
net/banip/files/banip-functions.sh
net/banip/files/banip.feeds
net/banip/files/banip.init

index 7c559458f2435485e9b07ecaa463033abb07d1d5..c89df331e673926654c156d1c84023acd827690a 100644 (file)
@@ -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 <dev@brenken.org>
 
index db2c15f6bb4cf75ca2c9dec2fae7e254d04b2935..1a1266d03554897813d0fe15110bb9825de9a2b6 100644 (file)
@@ -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}"
 }
index cfe1a70cc690f4ed7f89433f4def2ec9226b5dfc..72177cd3f7096a081a7c9730ec562b1f0d54479a 100644 (file)
        },
        "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":{
index a934b4a9196708cebca58da85abebd74c800dad8..4ef70e3d0c0071a83194b403f9fd01b53b223cb7 100755 (executable)
@@ -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