[packages_10.03.2] lsof, portmap, transocks, dsniff, snort, ipcad, nfs-server, unfs3...
[10.03/packages.git] / net / snort / Makefile
1 #
2 # Copyright (C) 2006-2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=snort
11 PKG_VERSION:=2.8.4.1
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://dl.snort.org/snort-current/
16 PKG_MD5SUM:=63f4e76ae96a2d133f4c7b741bad5458
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19 PKG_FIXUP:=autoreconf
20 PKG_INSTALL:=1
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/snort/Default
25   SUBMENU:=Firewall
26   SECTION:=net
27   CATEGORY:=Network
28   DEPENDS:=+libnet0 +libpcap +libpcre
29   TITLE:=Lightweight Network Intrusion Detection System
30   URL:=http://www.snort.org/
31 endef
32
33 define Package/snort/Default/description
34   Snort is an open source network intrusion detection and prevention system.
35   It is capable of performing real-time traffic analysis, alerting, blocking
36   and packet logging on IP networks.  It utilizes a combination of protocol
37   analysis and pattern matching in order to detect anomalies, misuse and
38   attacks.
39 endef
40
41 define Package/snort
42   $(call Package/snort/Default)
43   VARIANT:=basic
44 endef
45
46 define Package/snort/description
47   $(call Package/snort/Default/description)
48 endef
49
50 define Package/snort-mysql
51   $(call Package/snort/Default)
52   DEPENDS+= +libmysqlclient
53   TITLE+= (MySQL)
54   VARIANT:=mysql
55 endef
56
57 define Package/snort-mysql/description
58   $(call Package/snort/Default/description)
59   This package contains snort with support for logging to a MySQL database.
60 endef
61
62 define Package/snort-pgsql
63   $(call Package/snort/Default)
64   DEPENDS+= +libpq
65   TITLE+= (PostgreSQL)
66   VARIANT:=pgsql
67 endef
68
69 define Package/snort-pgsql/description
70   $(call Package/snort/Default/description)
71   This package contains snort with support for logging to a PostgreSQL database.
72 endef
73
74
75 CONFIGURE_ARGS += \
76         --enable-flexresp \
77         --with-libnet-includes="$(STAGING_DIR)/usr/lib/libnet-1.0.x/include" \
78         --with-libnet-libraries="$(STAGING_DIR)/usr/lib/libnet-1.0.x/lib" \
79         --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
80         --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
81         --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
82         --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
83
84 CONFIGURE_VARS += \
85         CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
86         LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
87         PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" \
88
89 MAKE_FLAGS += \
90         extra_incl="" \
91
92 ifeq ($(BUILD_VARIANT),basic)
93
94   CONFIGURE_ARGS += \
95         --without-mysql \
96         --without-postgresql \
97
98 endif
99 ifeq ($(BUILD_VARIANT),mysql)
100
101   CONFIGURE_ARGS += \
102         --with-mysql="$(STAGING_DIR)/usr" \
103         --without-postgresql \
104
105 endif
106 ifeq ($(BUILD_VARIANT),pgsql)
107
108   CONFIGURE_ARGS += \
109         --without-mysql \
110         --with-postgresql="$(STAGING_DIR)/usr" \
111
112 endif
113
114
115 define Package/snort/conffiles
116 /etc/default/snort
117 /etc/snort/snort.conf
118 /etc/snort/threshold.conf
119 endef
120
121 define Package/snort/install
122         $(INSTALL_DIR) $(1)/usr/bin
123         $(CP) $(PKG_INSTALL_DIR)/usr/bin/snort $(1)/usr/bin/
124         $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicengine
125         $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/libsf_engine.so* $(1)/usr/lib/snort_dynamicengine/
126         $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicpreprocessor
127         $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/libsf_{dce2,dcerpc,dns,ftptelnet,smtp,ssh,ssl}_preproc.so* $(1)/usr/lib/snort_dynamicpreprocessor/
128         $(INSTALL_DIR) $(1)/etc/snort
129         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/snort.conf $(1)/etc/snort/
130         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/classification.config $(1)/etc/snort/
131         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/gen-msg.map $(1)/etc/snort/
132         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/reference.config $(1)/etc/snort/
133         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/sid-msg.map $(1)/etc/snort/
134         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/threshold.conf $(1)/etc/snort/
135         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/unicode.map $(1)/etc/snort/
136         $(INSTALL_DIR) $(1)/etc/snort/preproc_rules
137         $(INSTALL_DATA) $(PKG_BUILD_DIR)/preproc_rules/*.rules $(1)/etc/snort/preproc_rules/
138         $(INSTALL_DIR) $(1)/etc/snort/rules
139         $(INSTALL_DATA) ./files/snort.local.rules $(1)/etc/snort/rules/local.rules
140         $(INSTALL_DIR) $(1)/etc/default
141         $(INSTALL_DATA) ./files/snort.default $(1)/etc/default/snort
142         $(INSTALL_DIR) $(1)/etc/init.d
143         $(INSTALL_BIN) ./files/snort.init $(1)/etc/init.d/snort
144 endef
145
146 Package/snort-mysql/conffiles = $(Package/snort/conffiles)
147 Package/snort-mysql/install = $(Package/snort/install)
148
149 Package/snort-pgsql/conffiles = $(Package/snort/conffiles)
150 Package/snort-pgsql/install = $(Package/snort/install)
151
152 $(eval $(call BuildPackage,snort))
153 $(eval $(call BuildPackage,snort-mysql))
154 $(eval $(call BuildPackage,snort-pgsql))