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.

112 lines
3.4 KiB

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