|
|
@@ -23,8 +23,9 @@
|
|
|
##
|
|
|
|
|
|
# package version
|
|
|
-%define V_snort 2.4.0
|
|
|
-%define V_rules 2.4
|
|
|
+%define V_snort 2.4.0
|
|
|
+%define V_rules 2.4
|
|
|
+%define V_oinkmaster 1.2
|
|
|
|
|
|
# package information
|
|
|
Name: snort
|
|
|
@@ -37,26 +38,34 @@ Class: PLUS
|
|
|
Group: Network
|
|
|
License: GPL
|
|
|
Version: %{V_snort}
|
|
|
-Release: 20050729
|
|
|
+Release: 20050903
|
|
|
|
|
|
# package options
|
|
|
+%option with_fsl yes
|
|
|
%option with_mysql no
|
|
|
%option with_pgsql no
|
|
|
|
|
|
# list of sources
|
|
|
Source0: http://www.snort.org/dl/current/snort-%{V_snort}.tar.gz
|
|
|
Source1: http://www.snort.org/pub-bin/downloads.cgi/Download/vrt_pr/snortrules-pr-%{V_rules}.tar.gz
|
|
|
-Source2: snort.conf
|
|
|
-Source3: rc.snort
|
|
|
+Source2: http://osdn.dl.sourceforge.net/sourceforge/oinkmaster/oinkmaster-%{V_oinkmaster}.tar.gz
|
|
|
+Source3: snort.conf
|
|
|
+Source4: rc.snort
|
|
|
+Source5: fsl.snort
|
|
|
+Source6: snort-update.sh
|
|
|
Patch0: snort.patch
|
|
|
|
|
|
# build information
|
|
|
Prefix: %{l_prefix}
|
|
|
BuildRoot: %{l_buildroot}
|
|
|
BuildPreReq: OpenPKG, openpkg >= 20040130, make, gcc
|
|
|
-PreReq: OpenPKG, openpkg >= 20040130
|
|
|
+PreReq: OpenPKG, openpkg >= 20040130, perl, perl-www, perl-sys, perl-comp
|
|
|
BuildPreReq: libpcap, libnet, pcre
|
|
|
PreReq: libpcap, libnet, pcre
|
|
|
+%if "%{with_fsl}" == "yes"
|
|
|
+BuildPreReq: fsl >= 1.2.0
|
|
|
+PreReq: fsl >= 1.2.0
|
|
|
+%endif
|
|
|
%if "%{with_mysql}" == "yes"
|
|
|
BuildPreReq: mysql
|
|
|
PreReq: mysql
|
|
|
@@ -87,10 +96,15 @@ AutoReqProv: no
|
|
|
url = http://www.snort.org/dl/
|
|
|
regex = snort-(\d+\.\d+\.\d+)\.tar\.gz
|
|
|
}
|
|
|
+ prog snort:oinkmaster = {
|
|
|
+ version = %{V_oinkmaster}
|
|
|
+ url = http://prdownloads.sourceforge.net/oinkmaster/
|
|
|
+ regex = oinkmaster-(__VER__)\.tar\.gz
|
|
|
+ }
|
|
|
|
|
|
%prep
|
|
|
%setup -q
|
|
|
- %setup -q -D -T -a 1
|
|
|
+ %setup -q -D -T -a 2
|
|
|
%patch -p0
|
|
|
%{l_shtool} subst %{l_value -s -a} \
|
|
|
src/snort.h
|
|
|
@@ -107,8 +121,8 @@ AutoReqProv: no
|
|
|
CC="%{l_cc}" \
|
|
|
CFLAGS="%{l_cflags -O}" \
|
|
|
CPPFLAGS="%{l_cppflags}" \
|
|
|
- LDFLAGS="%{l_ldflags}" \
|
|
|
- LIBS="$LIBS" \
|
|
|
+ LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
|
|
|
+ LIBS="$LIBS %{l_fsl_libs}" \
|
|
|
./configure \
|
|
|
--prefix=%{l_prefix} \
|
|
|
--sysconfdir=%{l_prefix}/etc/snort \
|
|
|
@@ -139,12 +153,12 @@ AutoReqProv: no
|
|
|
%{l_shtool} mkdir -f -p -m 755 \
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/sbin \
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/man/man8 \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/etc/snort \
|
|
|
- $RPM_BUILD_ROOT%{l_prefix}/share/snort/etc \
|
|
|
- $RPM_BUILD_ROOT%{l_prefix}/share/snort/map \
|
|
|
- $RPM_BUILD_ROOT%{l_prefix}/share/snort/rules \
|
|
|
- $RPM_BUILD_ROOT%{l_prefix}/var/snort
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/share/snort \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/var/snort/rules \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/var/snort/tmp
|
|
|
|
|
|
# install program and manual page
|
|
|
%{l_shtool} install -c -s -m 755 \
|
|
|
@@ -152,33 +166,23 @@ AutoReqProv: no
|
|
|
%{l_shtool} install -c -m 644 \
|
|
|
snort.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
|
|
|
|
|
|
- # install default configuration and rules files
|
|
|
- %{l_shtool} install -c -m 644 \
|
|
|
- -e 's;\(var HOME_NET\) any;\1 $(HOME_NET:-any);' \
|
|
|
- -e 's;\(var EXTERNAL_NET\) any;\1 $(EXTERNAL_NET:-any);' \
|
|
|
- -e 's;\(var RULE_PATH\).*;\1 %{l_prefix}/share/snort/rules;g' \
|
|
|
- -e 's;include classification.config;include %{l_prefix}/share/snort/etc/classification.config;' \
|
|
|
- -e 's;include reference.config;include %{l_prefix}/share/snort/etc/reference.config;' \
|
|
|
- -e 's;iis_unicode_map unicode.map;iis_unicode_map %{l_prefix}/share/snort/map/unicode.map;' \
|
|
|
- etc/snort.conf \
|
|
|
- $RPM_BUILD_ROOT%{l_prefix}/share/snort/etc/
|
|
|
- %{l_shtool} install -c -m 644 \
|
|
|
- etc/reference.config etc/classification.config etc/threshold.conf \
|
|
|
- $RPM_BUILD_ROOT%{l_prefix}/share/snort/etc/
|
|
|
- %{l_shtool} install -c -m 644 \
|
|
|
- etc/unicode.map etc/gen-msg.map etc/sid-msg.map \
|
|
|
- $RPM_BUILD_ROOT%{l_prefix}/share/snort/map/
|
|
|
- %{l_shtool} install -c -m 644 \
|
|
|
- rules/*.rules $RPM_BUILD_ROOT%{l_prefix}/share/snort/rules/
|
|
|
-
|
|
|
# install default configuration
|
|
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \
|
|
|
%{SOURCE snort.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/snort/
|
|
|
|
|
|
+ # install default ruleset tarball
|
|
|
+ %{l_shtool} install -c -m 644 \
|
|
|
+ %{SOURCE snortrules-pr-%{V_rules}.tar.gz} \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/share/snort/rules.tar.gz
|
|
|
+
|
|
|
# install run-command script
|
|
|
%{l_shtool} install -c -m 755 %{l_value -s -a} \
|
|
|
%{SOURCE rc.snort} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
|
|
|
|
|
|
+ # install OSSP fsl configuration
|
|
|
+ %{l_shtool} install -c -m 644 %{l_value -s -a} \
|
|
|
+ %{SOURCE fsl.snort} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
|
|
|
+
|
|
|
# install optional/additional files
|
|
|
%if "%{with_mysql}" == "yes"
|
|
|
%{l_shtool} install -c -m 644 \
|
|
|
@@ -191,11 +195,35 @@ AutoReqProv: no
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/share/snort/
|
|
|
%endif
|
|
|
|
|
|
+ # install oinkmaster utility
|
|
|
+ ( cd oinkmaster-%{V_oinkmaster}
|
|
|
+ %{l_shtool} install -c -m 755 \
|
|
|
+ -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
|
|
|
+ -e 's;/etc/oinkmaster\.conf;%{l_prefix}/etc/snort/oinkmaster.conf;' \
|
|
|
+ oinkmaster.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/oinkmaster
|
|
|
+ %{l_shtool} install -c -m 644 \
|
|
|
+ oinkmaster.1 $RPM_BUILD_ROOT%{l_prefix}/man/man8/oinkmaster.8
|
|
|
+ %{l_shtool} install -c -m 644 \
|
|
|
+ -e 's;^\(path = \);\1%{l_prefix}/bin:;' \
|
|
|
+ -e 's;^# tmpdir = /home/oinkmaster/tmp/;tmpdir = %{l_prefix}/var/snort/tmp;' \
|
|
|
+ -e 's;^# \(use_external_bins = 0\);\1;' \
|
|
|
+ -e 's;^\(skipfile snort\.conf\);# \1;' \
|
|
|
+ oinkmaster.conf $RPM_BUILD_ROOT%{l_prefix}/etc/snort/
|
|
|
+ ) || exit $?
|
|
|
+
|
|
|
+ # install rule update utility
|
|
|
+ %{l_shtool} install -c -m 755 %{l_value -s -a} \
|
|
|
+ -e 's;@V_rules@;%{V_rules};g' \
|
|
|
+ %{SOURCE snort-update.sh} \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/sbin/snort-update
|
|
|
+
|
|
|
# determine installation files
|
|
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
|
|
|
%{l_files_std} \
|
|
|
'%config %{l_prefix}/etc/snort/*' \
|
|
|
- '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/snort'
|
|
|
+ '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/snort' \
|
|
|
+ '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/snort/rules' \
|
|
|
+ '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/snort/tmp'
|
|
|
|
|
|
%files -f files
|
|
|
|
|
|
@@ -209,6 +237,30 @@ AutoReqProv: no
|
|
|
echo "\"snort_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the"
|
|
|
echo "used network interface."
|
|
|
) | %{l_rpmtool} msg -b -t notice
|
|
|
+ ( echo "To use Snort as an IDS, its rules HAVE to be ALWAYS up to date."
|
|
|
+ echo "But this package just ships with the latest PUBLIC version of the"
|
|
|
+ echo "\"Sourcefire VRT Certified Rules\" for UNREGISTERED Snort users."
|
|
|
+ echo "This means your rules are NOT covering the latest known attacks."
|
|
|
+ echo ""
|
|
|
+ echo "Hence, we strongly recommend to become at least a REGISTERED Snort"
|
|
|
+ echo "user (see http://www.snort.org/ for details). This way you receive"
|
|
|
+ echo "a so-called \"oinkcode\" (a sequence of 40 hexadecimal numbers)"
|
|
|
+ echo "which you can configure in the file"
|
|
|
+ echo " $RPM_INSTALL_PREFIX/etc/rc.conf"
|
|
|
+ echo "via the directives"
|
|
|
+ echo " snort_update_time=\"daily\""
|
|
|
+ echo " snort_update_source=\"oinkcode:XXXX...\""
|
|
|
+ echo "to update your Snort rules in"
|
|
|
+ echo " $RPM_INSTALL_PREFIX/var/snort/rules/"
|
|
|
+ echo "automatically once per day with the latest version of the"
|
|
|
+ echo "\"Sourcefire VRT Certified Rules\" for REGISTERED Snort users."
|
|
|
+ ) | %{l_rpmtool} msg -b -t notice
|
|
|
+ fi
|
|
|
+
|
|
|
+ # trigger a ruleset update
|
|
|
+ snort_update_source=`%{l_rc} -q snort_update_source`
|
|
|
+ if [ ".$snort_update_source" != . ]; then
|
|
|
+ su - %{l_rusr} -c "$RPM_INSTALL_PREFIX/sbin/snort-update \"$snort_update_source\""
|
|
|
fi
|
|
|
|
|
|
# after upgrade, restart service
|
|
|
@@ -224,5 +276,7 @@ AutoReqProv: no
|
|
|
rm -f $RPM_INSTALL_PREFIX/var/snort/*.pid >/dev/null 2>&1 || true
|
|
|
rm -f $RPM_INSTALL_PREFIX/var/snort/*.log >/dev/null 2>&1 || true
|
|
|
rm -f $RPM_INSTALL_PREFIX/var/snort/*.cap >/dev/null 2>&1 || true
|
|
|
+ rm -f $RPM_INSTALL_PREFIX/var/snort/rules/* >/dev/null 2>&1 || true
|
|
|
+ rm -f $RPM_INSTALL_PREFIX/var/snort/tmp/* >/dev/null 2>&1 || true
|
|
|
exit 0
|
|
|
|