1################################################################################ 2# 3# fail2ban 4# 5################################################################################ 6 7FAIL2BAN_VERSION = 0.11.2 8FAIL2BAN_SITE = $(call github,fail2ban,fail2ban,$(FAIL2BAN_VERSION)) 9FAIL2BAN_LICENSE = GPL-2.0+ 10FAIL2BAN_LICENSE_FILES = COPYING 11FAIL2BAN_CPE_ID_VENDOR = fail2ban 12FAIL2BAN_SELINUX_MODULES = fail2ban 13FAIL2BAN_SETUP_TYPE = distutils 14 15# 0001-fixed-possible-RCE-vulnerability-unset-escape-variable.patch 16FAIL2BAN_IGNORE_CVES += CVE-2021-32749 17 18ifeq ($(BR2_PACKAGE_PYTHON3),y) 19define FAIL2BAN_PYTHON_2TO3 20 $(HOST_DIR)/bin/2to3 --write --nobackups --no-diffs $(@D)/bin/* $(@D)/fail2ban 21endef 22FAIL2BAN_DEPENDENCIES += host-python3 23# We can't use _POST_PATCH_HOOKS because dependencies are not guaranteed 24# to build and install before _POST_PATCH_HOOKS run. 25FAIL2BAN_PRE_CONFIGURE_HOOKS += FAIL2BAN_PYTHON_2TO3 26endif 27 28define FAIL2BAN_FIX_DEFAULT_CONFIG 29 $(SED) '/^socket/c\socket = /run/fail2ban.sock' $(TARGET_DIR)/etc/fail2ban/fail2ban.conf 30 $(SED) '/^pidfile/c\pidfile = /run/fail2ban.pid' $(TARGET_DIR)/etc/fail2ban/fail2ban.conf 31 $(SED) '/^dbfile/c\dbfile = None' $(TARGET_DIR)/etc/fail2ban/fail2ban.conf 32endef 33FAIL2BAN_POST_INSTALL_TARGET_HOOKS += FAIL2BAN_FIX_DEFAULT_CONFIG 34 35# fail2ban-python points to host python 36define FAIL2BAN_FIX_FAIL2BAN_PYTHON_SYMLINK 37 ln -snf $(if $(BR2_PACKAGE_PYTHON),python,python3) \ 38 $(TARGET_DIR)/usr/bin/fail2ban-python 39endef 40FAIL2BAN_POST_INSTALL_TARGET_HOOKS += FAIL2BAN_FIX_FAIL2BAN_PYTHON_SYMLINK 41 42define FAIL2BAN_INSTALL_INIT_SYSV 43 $(INSTALL) -D -m 755 package/fail2ban/S60fail2ban \ 44 $(TARGET_DIR)/etc/init.d/S60fail2ban 45endef 46 47define FAIL2BAN_INSTALL_INIT_SYSTEMD 48 $(INSTALL) -D -m 0644 $(@D)/files/fail2ban.service.in \ 49 $(TARGET_DIR)/usr/lib/systemd/system/fail2ban.service 50 $(SED) 's,@BINDIR@,/usr/bin,g' $(TARGET_DIR)/usr/lib/systemd/system/fail2ban.service 51 $(SED) '/^PIDFile/c\PIDFile=/run/fail2ban.pid' $(TARGET_DIR)/usr/lib/systemd/system/fail2ban.service 52endef 53 54$(eval $(python-package)) 55