Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions packages/banip/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# banIP - ban incoming and outgoing IPs via named nftables Sets
# Copyright (c) 2018-2024 Dirk Brenken (dev@brenken.org)
# Copyright (c) 2018-2026 Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the GNU General Public License v3.

include $(TOPDIR)/rules.mk

PKG_NAME:=banip
PKG_VERSION:=1.0.1
PKG_RELEASE:=4
PKG_VERSION:=1.8.10
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>

Expand All @@ -16,7 +16,7 @@ define Package/banip
SECTION:=net
CATEGORY:=Network
TITLE:=banIP blocks IPs via named nftables Sets
DEPENDS:=+jshn +jsonfilter +firewall4 +ca-bundle +rpcd +rpcd-mod-rpcsys
DEPENDS:=+jshn +jsonfilter +firewall4 +gawk +ca-bundle +rpcd +rpcd-mod-rpcsys
PKGARCH:=all
endef

Expand Down Expand Up @@ -51,7 +51,7 @@ define Package/banip/install
$(INSTALL_BIN) ./files/banip.init $(1)/etc/init.d/banip

$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_CONF) ./files/banip-functions.sh $(1)/usr/lib
$(INSTALL_DATA) ./files/banip-functions.sh $(1)/usr/lib

$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/banip.conf $(1)/etc/config/banip
Expand All @@ -66,6 +66,9 @@ define Package/banip/install

$(INSTALL_DIR) $(1)/www/cgi-bin
$(INSTALL_BIN) ./files/banip.cgi $(1)/www/cgi-bin/banip

$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/95-banip-housekeeping $(1)/etc/uci-defaults
endef

$(eval $(call BuildPackage,banip))
42 changes: 42 additions & 0 deletions packages/banip/files/95-banip-housekeeping
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
# Copyright (c) 2015-2026 Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the GNU General Public License v3.

# (s)hellcheck exceptions
# shellcheck disable=all

export LC_ALL=C
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"

config="banip"
old_options="ban_loginput ban_logforwardwan ban_logforwardlan ban_blockinput ban_blockforwardwan ban_blockforwardlan ban_blocktype ban_blockpolicy"

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_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
;;
esac
done
uci -q delete "${config}.global.${option}"
done
[ -n "$(uci -q changes "${config}")" ] && uci -q commit "${config}"

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}"
fi
exit 0
733 changes: 478 additions & 255 deletions packages/banip/files/README.md

Large diffs are not rendered by default.

Loading
Loading