forked from openwrt/packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new 'ca-bundle' dependency as all https connections are now validated by default * automatically select the download utility: 'aria2', 'curl', 'uclient-fetch' with libustream-* or wget are supported * track & ban failed LuCI login attempts as well * add a small log/banIP background monitor to block SSH/LuCI brute force attacks in realtime (disabled by default) * add a config version check (please update your default config!) * made the automatic wan detection more stable * fix the IPv6 logfile parser * fix the service status message * update readme Signed-off-by: Dirk Brenken <[email protected]>
- Loading branch information
Showing
6 changed files
with
167 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=banip | ||
PKG_VERSION:=0.2.1 | ||
PKG_VERSION:=0.3.0 | ||
PKG_RELEASE:=1 | ||
PKG_LICENSE:=GPL-3.0-or-later | ||
PKG_MAINTAINER:=Dirk Brenken <[email protected]> | ||
|
@@ -17,7 +17,7 @@ define Package/banip | |
SECTION:=net | ||
CATEGORY:=Network | ||
TITLE:=Ban incoming and/or outgoing ip adresses via ipsets | ||
DEPENDS:=+jshn +jsonfilter +ip +ipset +iptables | ||
DEPENDS:=+jshn +jsonfilter +ip +ipset +iptables +ca-bundle | ||
PKGARCH:=all | ||
endef | ||
|
||
|
@@ -45,7 +45,7 @@ endef | |
|
||
define Package/banip/install | ||
$(INSTALL_DIR) $(1)/usr/bin | ||
$(INSTALL_BIN) ./files/banip.sh $(1)/usr/bin/ | ||
$(INSTALL_BIN) ./files/banip.sh $(1)/usr/bin | ||
|
||
$(INSTALL_DIR) $(1)/etc/init.d | ||
$(INSTALL_BIN) ./files/banip.init $(1)/etc/init.d/banip | ||
|
@@ -54,9 +54,10 @@ define Package/banip/install | |
$(INSTALL_CONF) ./files/banip.conf $(1)/etc/config/banip | ||
|
||
$(INSTALL_DIR) $(1)/etc/banip | ||
$(INSTALL_CONF) ./files/banip.blacklist $(1)/etc/banip/ | ||
$(INSTALL_CONF) ./files/banip.whitelist $(1)/etc/banip/ | ||
|
||
$(INSTALL_BIN) ./files/banip.service $(1)/etc/banip | ||
$(INSTALL_CONF) ./files/banip.blacklist $(1)/etc/banip | ||
$(INSTALL_CONF) ./files/banip.whitelist $(1)/etc/banip | ||
|
||
$(INSTALL_DIR) $(1)/etc/hotplug.d/firewall | ||
$(INSTALL_DATA) ./files/banip.hotplug $(1)/etc/hotplug.d/firewall/30-banip | ||
endef | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
# log service to trace failed ssh/luci logins and conditionally refresh banIP | ||
# written by Dirk Brenken ([email protected]) | ||
|
||
# This is free software, licensed under the GNU General Public License v3. | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
LC_ALL=C | ||
PATH="/usr/sbin:/usr/bin:/sbin:/bin" | ||
|
||
if [ -r "/lib/functions.sh" ] | ||
then | ||
. "/lib/functions.sh" | ||
ban_sshdaemon="$(uci_get banip extra ban_sshdaemon "dropbear")" | ||
fi | ||
ban_ver="${1}" | ||
ban_log="$(command -v logread)" | ||
|
||
if [ -x "${ban_log}" ] | ||
then | ||
logger -p "info" -t "banIP-${ban_ver}[${$}]" "log/banIP service started" | ||
"${ban_log}" -f -e "${ban_sshdaemon}\|luci: failed login" | \ | ||
{ grep -qE "Exit before auth|luci: failed login|[0-9]+ \[preauth\]$"; [ $? -eq 0 ] && /etc/init.d/banip refresh; } | ||
else | ||
logger -p "err" -t "banIP-${ban_ver}[${$}]" "can't start log/banIP service" | ||
fi |
Oops, something went wrong.