banip: update 0.9.2-3

* fix the urlhaus regex
* fix a possible init race condition

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken 2023-11-25 08:22:42 +01:00
parent bc0db51e43
commit 1557ddfe83
No known key found for this signature in database
GPG Key ID: 9D71CD547BFAE684
4 changed files with 7 additions and 7 deletions

View 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>

View 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}"
}

View File

@ -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":{

View File

@ -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