2 # Copyright (C) 2006-2012 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://snort.org/dl/snort-current/
16 PKG_MD5SUM:=4254389550e3be31afebc70e64e6002f
18 PKG_BUILD_DEPENDS:=librpc
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
23 include $(INCLUDE_DIR)/package.mk
25 define Package/snort/Default
29 DEPENDS:=+libpcap +libpcre +libdnet +libdaq +libpthread +libuuid +zlib
30 TITLE:=Lightweight Network Intrusion Detection System
31 URL:=http://www.snort.org/
34 define Package/snort/Default/description
35 Snort is an open source network intrusion detection and prevention system.
36 It is capable of performing real-time traffic analysis, alerting, blocking
37 and packet logging on IP networks. It utilizes a combination of protocol
38 analysis and pattern matching in order to detect anomalies, misuse and
43 $(call Package/snort/Default)
47 define Package/snort/description
48 $(call Package/snort/Default/description)
51 define Package/snort-mysql
52 $(call Package/snort/Default)
53 DEPENDS+= +libmysqlclient
58 define Package/snort-mysql/description
59 $(call Package/snort/Default/description)
60 This package contains snort with support for logging to a MySQL database.
63 define Package/snort-pgsql
64 $(call Package/snort/Default)
65 DEPENDS+= +libpq +libuuid
70 define Package/snort-pgsql/description
71 $(call Package/snort/Default/description)
72 This package contains snort with support for logging to a PostgreSQL database.
79 --with-dnet-includes="$(STAGING_DIR)/usr/include" \
80 --with-dnet-libraries="$(STAGING_DIR)/usr/lib" \
81 --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
82 --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
83 --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
84 --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
85 --with-daq-includes="$(STAGING_DIR)/usr/include" \
86 --with-daq-libraries="$(STAGING_DIR)/usr/lib" \
90 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
91 LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
92 PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" \
97 ifeq ($(BUILD_VARIANT),basic)
101 --without-postgresql \
104 ifeq ($(BUILD_VARIANT),mysql)
106 mysql_has_reconnect=yes
109 --with-mysql="$(STAGING_DIR)/usr" \
110 --without-postgresql \
113 ifeq ($(BUILD_VARIANT),pgsql)
117 --with-postgresql="$(STAGING_DIR)/usr" \
121 define Build/InstallDev
122 $(INSTALL_DIR) $(STAGING_DIR)/usr/include/snort/dynamic_preproc
124 $(PKG_INSTALL_DIR)/usr/include/snort/dynamic_preproc/* \
125 $(STAGING_DIR)/usr/include/snort/dynamic_preproc/
126 $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort/dynamic_preproc
128 $(PKG_INSTALL_DIR)/usr/lib/snort/dynamic_preproc/* \
129 $(STAGING_DIR)/usr/lib/snort/dynamic_preproc/
130 $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicengine
132 $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/* \
133 $(STAGING_DIR)/usr/lib/snort_dynamicengine/
134 $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor
136 $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/* \
137 $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor/
140 define Package/snort/conffiles
142 /etc/snort/snort.conf
143 /etc/snort/threshold.conf
146 define Package/snort/install
147 $(INSTALL_DIR) $(1)/usr/bin
148 $(CP) $(PKG_INSTALL_DIR)/usr/bin/snort $(1)/usr/bin/snort.bin
149 $(CP) $(PKG_INSTALL_DIR)/usr/bin/u2{boat,spewfoo} $(1)/usr/bin
150 $(INSTALL_BIN) ./files/snort.bin $(1)/usr/bin/snort
151 $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicengine
152 $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/libsf_engine.so* $(1)/usr/lib/snort_dynamicengine/
153 $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicpreprocessor
154 $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/libsf*.so* $(1)/usr/lib/snort_dynamicpreprocessor/
155 $(INSTALL_DIR) $(1)/etc/snort
156 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/snort.conf $(1)/etc/snort/
157 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/attribute_table.dtd $(1)/etc/snort/
158 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/classification.config $(1)/etc/snort/
159 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/gen-msg.map $(1)/etc/snort/
160 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/reference.config $(1)/etc/snort/
161 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/threshold.conf $(1)/etc/snort/
162 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/unicode.map $(1)/etc/snort/
163 $(INSTALL_DIR) $(1)/etc/snort/preproc_rules
164 $(INSTALL_DATA) $(PKG_BUILD_DIR)/preproc_rules/*.rules $(1)/etc/snort/preproc_rules/
165 $(INSTALL_DIR) $(1)/etc/snort/rules
166 $(INSTALL_DATA) ./files/snort.local.rules $(1)/etc/snort/rules/local.rules
167 $(INSTALL_DIR) $(1)/etc/default
168 $(INSTALL_DATA) ./files/snort.default $(1)/etc/default/snort
169 $(INSTALL_DIR) $(1)/etc/init.d
170 $(INSTALL_BIN) ./files/snort.init $(1)/etc/init.d/snort
173 Package/snort-mysql/conffiles = $(Package/snort/conffiles)
174 Package/snort-mysql/install = $(Package/snort/install)
176 Package/snort-pgsql/conffiles = $(Package/snort/conffiles)
177 Package/snort-pgsql/install = $(Package/snort/install)
179 $(eval $(call BuildPackage,snort))
180 $(eval $(call BuildPackage,snort-mysql))
181 $(eval $(call BuildPackage,snort-pgsql))