| 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 21 ## SUCH DAMAGE. |
21 ## SUCH DAMAGE. |
| 22 ## |
22 ## |
| 23 |
23 |
| 24 # package version |
24 # package version |
| 25 %define V_snort 2.8.6 |
25 %define V_snort 2.9.3.1 |
| 26 %define V_rules 2.4 |
26 %define V_rules 2.4 |
| 27 %define V_oinkmaster 2.0 |
27 %define V_oinkmaster 2.0 |
| |
28 %define V_pulledpork 0.6.1 |
| 28 |
29 |
| 29 # package information |
30 # package information |
| 30 Name: snort |
31 Name: snort |
| 31 Summary: Network Intrusion Detection System |
32 Summary: Network Intrusion Detection System |
| 32 URL: http://www.snort.org/ |
33 URL: http://www.snort.org/ |
| 35 Distribution: OpenPKG Community |
36 Distribution: OpenPKG Community |
| 36 Class: BASE |
37 Class: BASE |
| 37 Group: Monitoring |
38 Group: Monitoring |
| 38 License: GPL |
39 License: GPL |
| 39 Version: %{V_snort} |
40 Version: %{V_snort} |
| 40 Release: 20100427 |
41 Release: 20120800 |
| 41 |
42 |
| 42 # package options |
43 # package options |
| 43 %option with_fsl yes |
44 %option with_fsl yes |
| 44 %option with_mysql no |
45 %option with_mysql no |
| 45 %option with_pgsql no |
46 %option with_pgsql no |
| 46 |
47 |
| 47 # list of sources |
48 # list of sources |
| 48 Source0: http://dl.snort.org/snort-current/snort-%{V_snort}.tar.gz |
49 Source0: http://dl.snort.org/snort-current/snort-%{V_snort}.tar.gz |
| 49 Source1: http://www.snort.org/pub-bin/downloads.cgi/Download/vrt_pr/snortrules-pr-%{V_rules}.tar.gz |
50 Source1: http://www.snort.org/pub-bin/downloads.cgi/Download/vrt_pr/snortrules-pr-%{V_rules}.tar.gz |
| 50 Source2: http://switch.dl.sourceforge.net/sourceforge/oinkmaster/oinkmaster-%{V_oinkmaster}.tar.gz |
51 Source2: http://switch.dl.sourceforge.net/sourceforge/oinkmaster/oinkmaster-%{V_oinkmaster}.tar.gz |
| 51 Source3: snort.conf |
52 Source3: http://pulledpork.googlecode.com/files/pulledpork-%{V_pulledpork}.tar.gz |
| 52 Source4: rc.snort |
53 Source4: snort.conf |
| 53 Source5: fsl.snort |
54 Source5: rc.snort |
| 54 Source6: snort-update.sh |
55 Source6: fsl.snort |
| 55 Patch0: snort.patch |
56 Source7: snort-update.sh |
| 56 |
57 |
| 57 # build information |
58 # build information |
| 58 BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc |
59 BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc |
| 59 PreReq: OpenPKG, openpkg >= 20100101, perl, perl-www, perl-sys, perl-comp |
60 PreReq: OpenPKG, openpkg >= 20100101, perl, perl-www, perl-sys, perl-comp |
| 60 BuildPreReq: libpcap, libnet, pcre |
61 BuildPreReq: daq, libdnet, pcre |
| 61 PreReq: libpcap, libnet, pcre |
62 PreReq: daq, libdnet, pcre |
| 62 %if "%{with_fsl}" == "yes" |
63 %if "%{with_fsl}" == "yes" |
| 63 BuildPreReq: fsl |
64 BuildPreReq: fsl |
| 64 PreReq: fsl |
65 PreReq: fsl |
| 65 %endif |
66 %endif |
| 66 %if "%{with_mysql}" == "yes" |
67 %if "%{with_mysql}" == "yes" |
| 99 prog snort:oinkmaster = { |
100 prog snort:oinkmaster = { |
| 100 version = %{V_oinkmaster} |
101 version = %{V_oinkmaster} |
| 101 url = http://sourceforge.net/projects/oinkmaster/files/ |
102 url = http://sourceforge.net/projects/oinkmaster/files/ |
| 102 regex = oinkmaster-(__VER__)\.tar\.gz |
103 regex = oinkmaster-(__VER__)\.tar\.gz |
| 103 } |
104 } |
| |
105 prog snort:pulledpork = { |
| |
106 version = %{V_pulledpork} |
| |
107 url = http://sourceforge.net/projects/oinkmaster/files/ |
| |
108 url = http://pulledpork.googlecode.com/files/ |
| |
109 regex = pulledpork-(__VER__)\.tar\.gz |
| |
110 } |
| 104 |
111 |
| 105 %prep |
112 %prep |
| 106 %setup -q |
113 %setup -q |
| 107 %setup -q -D -T -a 2 |
114 %setup -q -D -T -a 2 |
| 108 %patch -p0 |
115 %setup -q -D -T -a 3 |
| 109 %{l_shtool} subst %{l_value -s -a} \ |
116 %{l_shtool} subst \ |
| |
117 -e 's;\(# define.*\)/var/log/snort;\1%{l_prefix}/var/snort;' \ |
| 110 src/snort.h |
118 src/snort.h |
| |
119 %{l_shtool} subst \ |
| |
120 -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \ |
| |
121 src/dynamic-plugins/sf_engine/sf_snort_plugin_rc4.c \ |
| |
122 src/sfutil/sf_ip.h |
| 111 |
123 |
| 112 %build |
124 %build |
| 113 # configure program |
125 # configure program |
| 114 LIBS="" |
126 LIBS="" |
| 115 %if "%{with_pgsql}" == "yes" |
127 %if "%{with_pgsql}" == "yes" |
| 124 LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ |
136 LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ |
| 125 LIBS="$LIBS %{l_fsl_libs}" \ |
137 LIBS="$LIBS %{l_fsl_libs}" \ |
| 126 ./configure \ |
138 ./configure \ |
| 127 --prefix=%{l_prefix} \ |
139 --prefix=%{l_prefix} \ |
| 128 --sysconfdir=%{l_prefix}/etc/snort \ |
140 --sysconfdir=%{l_prefix}/etc/snort \ |
| |
141 --without-odbc \ |
| |
142 --without-oracle \ |
| 129 %if "%{with_mysql}" == "yes" |
143 %if "%{with_mysql}" == "yes" |
| 130 --with-mysql=%{l_prefix} \ |
144 --with-mysql=%{l_prefix} \ |
| 131 %else |
145 %else |
| 132 --without-mysql \ |
146 --without-mysql \ |
| 133 %endif |
147 %endif |
| 134 %if "%{with_pgsql}" == "yes" |
148 %if "%{with_pgsql}" == "yes" |
| 135 --with-postgresql=%{l_prefix} \ |
149 --with-postgresql=%{l_prefix} \ |
| 136 %else |
150 %else |
| 137 --without-postgresql \ |
151 --without-postgresql \ |
| 138 %endif |
152 %endif |
| 139 --with-libpcap-includes=%{l_prefix}/include \ |
153 --with-daq-includes=%{l_prefix}/include \ |
| 140 --with-libpcap-libraries=%{l_prefix}/lib \ |
154 --with-daq-libraries=%{l_prefix}/lib \ |
| 141 --with-libnet-includes=%{l_prefix}/include \ |
|
| 142 --with-libnet-libraries=%{l_prefix}/lib \ |
|
| 143 --with-libpcre-includes=%{l_prefix}/include \ |
155 --with-libpcre-includes=%{l_prefix}/include \ |
| 144 --with-libpcre-libraries=%{l_prefix}/lib \ |
156 --with-libpcre-libraries=%{l_prefix}/lib \ |
| 145 --enable-perfmonitor |
157 --enable-perfmonitor |
| 146 |
158 |
| 147 # build program |
159 # build program |
| 148 %{l_make} %{l_mflags} |
160 %{l_make} %{l_mflags -O} |
| 149 |
161 |
| 150 %install |
162 %install |
| 151 # create installation hierarchy |
163 # create installation hierarchy |
| 152 rm -rf $RPM_BUILD_ROOT |
|
| 153 %{l_shtool} mkdir -f -p -m 755 \ |
164 %{l_shtool} mkdir -f -p -m 755 \ |
| 154 $RPM_BUILD_ROOT%{l_prefix}/sbin \ |
165 $RPM_BUILD_ROOT%{l_prefix}/sbin \ |
| 155 $RPM_BUILD_ROOT%{l_prefix}/man/man8 \ |
166 $RPM_BUILD_ROOT%{l_prefix}/man/man8 \ |
| 156 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \ |
167 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \ |
| 157 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
168 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
| 196 %endif |
207 %endif |
| 197 |
208 |
| 198 # install oinkmaster utility |
209 # install oinkmaster utility |
| 199 ( cd oinkmaster-%{V_oinkmaster} |
210 ( cd oinkmaster-%{V_oinkmaster} |
| 200 %{l_shtool} install -c -m 755 \ |
211 %{l_shtool} install -c -m 755 \ |
| 201 -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \ |
212 -e 's;#!/usr/bin/perl;#! %{l_prefix}/bin/perl;g' \ |
| 202 -e 's;/etc/oinkmaster\.conf;%{l_prefix}/etc/snort/oinkmaster.conf;' \ |
213 -e 's;/etc/oinkmaster\.conf;%{l_prefix}/etc/snort/oinkmaster.conf;' \ |
| 203 oinkmaster.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/oinkmaster |
214 oinkmaster.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/oinkmaster |
| 204 %{l_shtool} install -c -m 644 \ |
215 %{l_shtool} install -c -m 644 \ |
| 205 oinkmaster.1 $RPM_BUILD_ROOT%{l_prefix}/man/man8/oinkmaster.8 |
216 oinkmaster.1 $RPM_BUILD_ROOT%{l_prefix}/man/man8/oinkmaster.8 |
| 206 %{l_shtool} install -c -m 644 \ |
217 %{l_shtool} install -c -m 644 \ |
| 207 -e 's;^\(path = \);\1%{l_prefix}/bin:;' \ |
218 -e 's;^\(path = \);\1%{l_prefix}/bin:;' \ |
| 208 -e 's;^# tmpdir = /home/oinkmaster/tmp/;tmpdir = %{l_prefix}/var/snort/tmp;' \ |
219 -e 's;^# tmpdir = /home/oinkmaster/tmp/;tmpdir = %{l_prefix}/var/snort/tmp;' \ |
| 209 -e 's;^\(use_external_bins = 0\);\1;' \ |
220 -e 's;^\(use_external_bins = 0\);\1;' \ |
| 210 -e 's;^\(skipfile snort\.conf\);# \1;' \ |
221 -e 's;^\(skipfile snort\.conf\);# \1;' \ |
| 211 oinkmaster.conf $RPM_BUILD_ROOT%{l_prefix}/etc/snort/ |
222 oinkmaster.conf $RPM_BUILD_ROOT%{l_prefix}/etc/snort/ |
| |
223 ) || exit $? |
| |
224 |
| |
225 # install pulledpork utility |
| |
226 ( cd pulledpork-%{V_pulledpork} |
| |
227 %{l_shtool} install -c -m 755 \ |
| |
228 -e 's;/usr/local;%{l_prefix};g' \ |
| |
229 -e 's;#!/usr/bin/perl;#! %{l_prefix}/bin/perl;g' \ |
| |
230 pulledpork.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/pulledpork |
| |
231 %{l_shtool} install -c -m 644 \ |
| |
232 -e 's;\(temp_path\) *=.*;\1 = %{l_prefix}/var/snort/tmp;' \ |
| |
233 etc/*.conf $RPM_BUILD_ROOT%{l_prefix}/etc/snort/ |
| 212 ) || exit $? |
234 ) || exit $? |
| 213 |
235 |
| 214 # install rule update utility |
236 # install rule update utility |
| 215 %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
237 %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
| 216 -e 's;@V_rules@;%{V_rules};g' \ |
238 -e 's;@V_rules@;%{V_rules};g' \ |