banip: update 0.9.5-2
authorDirk Brenken <dev@brenken.org>
Sun, 21 Apr 2024 19:57:17 +0000 (21:57 +0200)
committerDirk Brenken <dev@brenken.org>
Sun, 21 Apr 2024 19:58:32 +0000 (21:58 +0200)
* fixed possible Set search race condition (initiated from LuCI frontend)
* fixed the "no result" Set search problem in LuCI
* removed abandoned feeds: spamhaus edrop (was merged with spamhaus drop)

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 e8ba7edc190a5016dafa40ba6c46bb7581f83d7f..14636f1b813d64c7e4643b1ec2d94d4eac948bc3 100644 (file)
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=banip
 PKG_VERSION:=0.9.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
 
index 1498c8cb0a183112b0410ec58d3cd5db7b3490df..50e805b5a41c0a46d07e7160323648f56ef8eaea 100644 (file)
@@ -1559,14 +1559,14 @@ f_search() {
                printf "%s\n%s\n%s\n" ":::" "::: no valid search input" ":::"
                return
        fi
-       printf "%s\n%s\n%s\n" ":::" "::: banIP Search" ":::"
-       printf "    %s\n" "Looking for IP '${ip}' on $(date "+%Y-%m-%d %H:%M:%S")"
-       printf "    %s\n" "---"
        cnt="1"
        for item in ${table_sets}; do
                [ -f "${result_flag}" ] && break
                (
                        if "${ban_nftcmd}" get element inet banIP "${item}" "{ ${ip} }" >/dev/null 2>&1; then
+                               printf "%s\n%s\n%s\n" ":::" "::: banIP Search" ":::"
+                               printf "    %s\n" "Looking for IP '${ip}' on $(date "+%Y-%m-%d %H:%M:%S")"
+                               printf "    %s\n" "---"
                                printf "    %s\n" "IP found in Set '${item}'"
                                : >"${result_flag}"
                        fi
@@ -1576,7 +1576,14 @@ f_search() {
                cnt="$((cnt + 1))"
        done
        wait
-       [ -f "${result_flag}" ] && rm -f "${result_flag}" || printf "    %s\n" "IP not found"
+       if [ -f "${result_flag}" ]; then
+               rm -f "${result_flag}"
+       else
+               printf "%s\n%s\n%s\n" ":::" "::: banIP Search" ":::"
+               printf "    %s\n" "Looking for IP '${ip}' on $(date "+%Y-%m-%d %H:%M:%S")"
+               printf "    %s\n" "---"
+               printf "    %s\n" "IP not found"
+       fi
 }
 
 # Set survey
index e5f817371af099ed7148db12bb1bfd293edca793..36982654ba29b25ad09d497ce555cd01352f719f 100644 (file)
                "rule_4": "/^(([0-9]{1,3}\\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])(\\/(1?[0-9]|2?[0-9]|3?[0-2]))?)[[:space:]]/{printf \"%s/%s,\\n\",$1,$3}",
                "descr": "dshield IP blocklist"
        },
-       "edrop":{
-               "url_4": "https://www.spamhaus.org/drop/edrop.txt",
-               "rule_4": "/^(([0-9]{1,3}\\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])(\\/(1?[0-9]|2?[0-9]|3?[0-2]))?)[[:space:]]/{printf \"%s,\\n\",$1}",
-               "descr": "spamhaus edrop compilation"
-       },
        "etcompromised":{
                "url_4": "https://iplists.firehol.org/files/et_compromised.ipset",
                "rule_4": "/^(([0-9]{1,3}\\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])(\\/(1?[0-9]|2?[0-9]|3?[0-2]))?)$/{printf \"%s,\\n\",$1}",
index 0aae3befab198586cad83ebe8b94c187257d52b9..2b6a526c88b93fad0710d48d964408154242d10b 100755 (executable)
@@ -23,10 +23,10 @@ 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}" = "survey" ] || [ "${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}"
+[ -d "${ban_lock}" ] && { [ "${action}" = "boot" ] || [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "lookup" ] || [ "${action}" = "search" ]; } && exit 1
+[ ! -d "${ban_lock}" ] && { [ "${action}" = "boot" ] || [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "lookup" ] || [ "${action}" = "search" ]; } && mkdir -p "${ban_lock}"
 { [ "${action}" = "boot" ] || [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "stop" ] || [ "${action}" = "report" ] || [ "${action}" = "search" ] || [ "${action}" = "survey" ] || [ "${action}" = "lookup" ] || [ "${action}" = "status" ]; } && . "${ban_funlib}"
-[ ! -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" ] || [ "${action}" = "search" ]; } && exit 1
 
 boot() {
        : >"${ban_pidfile}"
@@ -81,6 +81,7 @@ report() {
 
 search() {
        f_search "${1}"
+       rm -rf "${ban_lock}"
 }
 
 survey() {