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.

202 lines
5.5 KiB

  1. #
  2. # Copyright (C) 2006-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=snort
  9. PKG_VERSION:=2.9.7.2
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://www.snort.org/downloads/snort/
  13. PKG_MD5SUM:=b01e9964827394c39194a0147bc15705
  14. PKG_BUILD_DEPENDS:=librpc
  15. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  16. PKG_FIXUP:=autoreconf
  17. PKG_INSTALL:=1
  18. include $(INCLUDE_DIR)/package.mk
  19. define Package/snort/Default
  20. SUBMENU:=Firewall
  21. SECTION:=net
  22. CATEGORY:=Network
  23. DEPENDS:=+libdaq +libdnet +libopenssl +libpcap +libpcre +libpthread +libuuid +zlib
  24. TITLE:=Lightweight Network Intrusion Detection System
  25. URL:=http://www.snort.org/
  26. endef
  27. define Package/snort/Default/description
  28. Snort is an open source network intrusion detection and prevention system.
  29. It is capable of performing real-time traffic analysis, alerting, blocking
  30. and packet logging on IP networks. It utilizes a combination of protocol
  31. analysis and pattern matching in order to detect anomalies, misuse and
  32. attacks.
  33. endef
  34. define Package/snort
  35. $(call Package/snort/Default)
  36. VARIANT:=basic
  37. endef
  38. define Package/snort/description
  39. $(call Package/snort/Default/description)
  40. endef
  41. define Package/snort-mysql
  42. $(call Package/snort/Default)
  43. DEPENDS+= +libmysqlclient
  44. TITLE+= (MySQL)
  45. VARIANT:=mysql
  46. endef
  47. define Package/snort-mysql/description
  48. $(call Package/snort/Default/description)
  49. This package contains snort with support for logging to a MySQL database.
  50. endef
  51. define Package/snort-pgsql
  52. $(call Package/snort/Default)
  53. DEPENDS+= +libpq +libuuid
  54. TITLE+= (PostgreSQL)
  55. VARIANT:=pgsql
  56. endef
  57. define Package/snort-pgsql/description
  58. $(call Package/snort/Default/description)
  59. This package contains snort with support for logging to a PostgreSQL database.
  60. endef
  61. CONFIGURE_ARGS += \
  62. --prefix="/usr" \
  63. --enable-flexresp \
  64. --with-dnet-includes="$(STAGING_DIR)/usr/include" \
  65. --with-dnet-libraries="$(STAGING_DIR)/usr/lib" \
  66. --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
  67. --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
  68. --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
  69. --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
  70. --with-daq-includes="$(STAGING_DIR)/usr/include" \
  71. --with-daq-libraries="$(STAGING_DIR)/usr/lib" \
  72. --disable-static-daq
  73. CONFIGURE_VARS += \
  74. CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
  75. LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
  76. PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH"
  77. MAKE_FLAGS += \
  78. extra_incl=""
  79. ifeq ($(BUILD_VARIANT),basic)
  80. CONFIGURE_ARGS += \
  81. --without-mysql \
  82. --without-postgresql
  83. endif
  84. ifeq ($(BUILD_VARIANT),mysql)
  85. CONFIGURE_VARS += \
  86. mysql_has_reconnect=yes
  87. CONFIGURE_ARGS += \
  88. --with-mysql="$(STAGING_DIR)/usr" \
  89. --without-postgresql
  90. endif
  91. ifeq ($(BUILD_VARIANT),pgsql)
  92. CONFIGURE_ARGS += \
  93. --without-mysql \
  94. --with-postgresql="$(STAGING_DIR)/usr"
  95. endif
  96. define Build/InstallDev
  97. $(INSTALL_DIR) $(STAGING_DIR)/usr/include/snort/dynamic_preproc
  98. $(CP) \
  99. $(PKG_INSTALL_DIR)/usr/include/snort/dynamic_preproc/* \
  100. $(STAGING_DIR)/usr/include/snort/dynamic_preproc/
  101. $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort/dynamic_preproc
  102. $(CP) \
  103. $(PKG_INSTALL_DIR)/usr/lib/snort/dynamic_preproc/* \
  104. $(STAGING_DIR)/usr/lib/snort/dynamic_preproc/
  105. $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicengine
  106. $(CP) \
  107. $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/* \
  108. $(STAGING_DIR)/usr/lib/snort_dynamicengine/
  109. $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor
  110. $(CP) \
  111. $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/* \
  112. $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor/
  113. endef
  114. define Package/snort/conffiles
  115. /etc/config/snort
  116. /etc/snort/snort.conf
  117. endef
  118. Package/snort-mysql/conffiles = $(Package/snort/conffiles)
  119. Package/snort-mysql/install = $(Package/snort/install)
  120. Package/snort-pgsql/conffiles = $(Package/snort/conffiles)
  121. Package/snort-pgsql/install = $(Package/snort/install)
  122. define Package/snort/install
  123. $(INSTALL_DIR) $(1)/usr/bin
  124. $(INSTALL_BIN) \
  125. $(PKG_INSTALL_DIR)/usr/bin/snort \
  126. $(1)/usr/bin/snort
  127. $(INSTALL_BIN) \
  128. $(PKG_INSTALL_DIR)/usr/bin/u2{boat,spewfoo} \
  129. $(1)/usr/bin
  130. $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicengine
  131. $(CP) \
  132. $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/libsf_engine.so* \
  133. $(1)/usr/lib/snort_dynamicengine/
  134. $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicpreprocessor
  135. $(CP) \
  136. $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/libsf*.so* \
  137. $(1)/usr/lib/snort_dynamicpreprocessor/
  138. $(INSTALL_DIR) $(1)/etc/snort
  139. $(INSTALL_CONF) \
  140. $(PKG_BUILD_DIR)/etc/snort.conf \
  141. $(1)/etc/snort/
  142. $(INSTALL_CONF) \
  143. $(PKG_BUILD_DIR)/etc/attribute_table.dtd \
  144. $(1)/etc/snort/
  145. $(INSTALL_CONF) \
  146. $(PKG_BUILD_DIR)/etc/classification.config \
  147. $(1)/etc/snort/
  148. $(INSTALL_CONF) \
  149. $(PKG_BUILD_DIR)/etc/gen-msg.map \
  150. $(1)/etc/snort/
  151. $(INSTALL_CONF) \
  152. $(PKG_BUILD_DIR)/etc/reference.config \
  153. $(1)/etc/snort/
  154. $(INSTALL_CONF) \
  155. $(PKG_BUILD_DIR)/etc/unicode.map \
  156. $(1)/etc/snort/
  157. $(INSTALL_DIR) $(1)/etc/snort/preproc_rules
  158. $(INSTALL_CONF) \
  159. $(PKG_BUILD_DIR)/preproc_rules/*.rules \
  160. $(1)/etc/snort/preproc_rules/
  161. $(INSTALL_DIR) $(1)/etc/init.d
  162. $(INSTALL_BIN) \
  163. ./files/snort.init \
  164. $(1)/etc/init.d/snort
  165. $(INSTALL_DIR) $(1)/etc/config
  166. $(INSTALL_CONF) \
  167. ./files/snort.config \
  168. $(1)/etc/config/snort
  169. endef
  170. $(eval $(call BuildPackage,snort))
  171. $(eval $(call BuildPackage,snort-mysql))
  172. $(eval $(call BuildPackage,snort-pgsql))