You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.3 KiB

  1. # SPDX-License-Identifier: MIT
  2. #
  3. # Copyright (C) 2021 Gerald Kerma
  4. #
  5. include $(TOPDIR)/rules.mk
  6. PKG_NAME:=crowdsec-firewall-bouncer
  7. PKG_VERSION:=0.0.15
  8. PKG_RELEASE:=$(AUTORELEASE)
  9. PKG_SOURCE_PROTO:=git
  10. PKG_SOURCE_URL:=https://github.com/crowdsecurity/cs-firewall-bouncer
  11. PKG_SOURCE_VERSION:=v$(PKG_VERSION)
  12. PKG_SOURCE_DATE:=2021903
  13. PKG_MIRROR_HASH:=2ef7e4f935056d648a6b45bb09ebb5846262ac9d745229b1442051abdd214c86
  14. PKG_LICENSE:=MIT
  15. PKG_LICENSE_FILES:=LICENSE
  16. PKG_MAINTAINER:=Gerald Kerma <gandalf@gk2.net>
  17. PKG_BUILD_DEPENDS:=golang/host
  18. PKG_BUILD_PARALLEL:=1
  19. PKG_USE_MIPS16:=0
  20. CSFB_BUILD_VERSION?=$(PKG_SOURCE_VERSION)
  21. CSFB_BUILD_GOVERSION=$(shell go version | cut -d " " -f3 | sed -r 's/[go]+//g')
  22. CWD_BUILD_TIMESTAMP:=$(SOURCE_DATE_EPOCH)
  23. CSFB_BUILD_TAG=openwrt
  24. CSFB_VERSION_PKG:=github.com/crowdsecurity/cs-firewall-bouncer/pkg/version
  25. GO_PKG:=github.com/crowdsecurity/cs-firewall-bouncer
  26. GO_PKG_LDFLAGS_X:=$(CSFB_VERSION_PKG).Version=$(CSFB_BUILD_VERSION) \
  27. $(CSFB_VERSION_PKG).BuildDate=$(CSFB_BUILD_TIMESTAMP) \
  28. $(CSFB_VERSION_PKG).Tag=$(CSFB_BUILD_TAG) \
  29. $(CSFB_VERSION_PKG).GoVersion=$(CSFB_BUILD_GOVERSION)
  30. GO_PKG_INSTALL_ALL:=1
  31. include $(INCLUDE_DIR)/package.mk
  32. include ../../lang/golang/golang-package.mk
  33. define Package/crowdsec-firewall-bouncer/Default
  34. SECTION:=net
  35. CATEGORY:=Network
  36. TITLE:=Firewall bouncer for Crowdsec
  37. URL:=https://github.com/crowdsecurity/cs-firewall-bouncer/
  38. endef
  39. define Package/crowdsec-firewall-bouncer
  40. $(call Package/crowdsec-firewall-bouncer/Default)
  41. DEPENDS:=@(PACKAGE_iptables||PACKAGE_nftables) \
  42. $(GO_ARCH_DEPENDS) \
  43. +crowdsec
  44. endef
  45. define Package/golang-crowdsec-firewall-bouncer-dev
  46. $(call Package/crowdsec-firewall-bouncer/Default)
  47. $(call GoPackage/GoSubMenu)
  48. TITLE+= (source files)
  49. DEPENDS:=$(GO_ARCH_DEPENDS)
  50. PKGARCH:=all
  51. endef
  52. define Package/crowdsec-firewall-bouncer/Default/description
  53. Crowdsec bouncer written in golang for firewalls.
  54. crowdsec-firewall-bouncer will fetch new and old decisions
  55. from a CrowdSec API to add them in a blocklist used by supported firewalls.
  56. You must install iptables+ipset or nftables.
  57. endef
  58. define Package/crowdsec-firewall-bouncer/description
  59. $(call Package/crowdsec-firewall-bouncer/Default/description)
  60. This package contains the main program.
  61. endef
  62. define Package/golang-crowdsec-firewall-bouncer-dev/description
  63. $(call Package/crowdsec-firewall-bouncer/Default/description)
  64. This package provides the source files for the program.
  65. endef
  66. define Package/crowdsec-firewall-bouncer/install
  67. $(call GoPackage/Package/Install/Bin,$(1))
  68. $(INSTALL_DIR) $(1)/etc/crowdsec/bouncers
  69. $(INSTALL_DATA) \
  70. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/crowdsec-firewall-bouncer.yaml \
  71. $(1)/etc/crowdsec/bouncers
  72. $(INSTALL_DIR) $(1)/etc/init.d
  73. $(INSTALL_BIN) \
  74. ./files/crowdsec-firewall-bouncer.initd \
  75. $(1)/etc/init.d/crowdsec-firewall-bouncer
  76. $(INSTALL_DIR) $(1)/etc
  77. $(INSTALL_BIN) \
  78. ./files/crowdsec-firewall-bouncer.firewall \
  79. $(1)/etc/firewall.cs
  80. $(INSTALL_DIR) $(1)/etc/uci-defaults
  81. $(INSTALL_BIN) \
  82. ./files/crowdsec-firewall-bouncer.defaults \
  83. $(1)/etc/uci-defaults/99_crowdsec-firewall-bouncer
  84. endef
  85. define Package/crowdsec-firewall-bouncer/conffiles
  86. /etc/crowdsec/bouncers/crowdsec-firewall-bouncer.yaml
  87. endef
  88. $(eval $(call GoBinPackage,crowdsec-firewall-bouncer))
  89. $(eval $(call BuildPackage,crowdsec-firewall-bouncer))