Return-Path: Received: from mail-ob0-f170.google.com (mail-ob0-f170.google.com [209.85.214.170]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 80701E01554 for ; Fri, 13 Sep 2013 08:19:04 -0700 (PDT) Received: by mail-ob0-f170.google.com with SMTP id va2so1223306obc.1 for ; Fri, 13 Sep 2013 08:19:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=AoUUnc7pLZJcnan+ABpEckdZvEMz2yh9lGeDbPk7F0E=; b=j+20PN1lLxDHcABe7hKravAWh6UE0MRK5PbZKB6arzXha/3H0PsiPyqUHwv30yR7ga XfokfiGhCTufKwrV8N9nxIsEoL1Hco235Nt6CVHc1tp8gC7QcYeF+7hOf9LSbeFuXY5d /ue5qT3PFDNUd+QKVi2DnViT5RL4ZFeepg1Ah0JYeFGHkj71blVMdq7h9ABRq7Y6XNxB /gkqXiT+cX8D83R2IOIsHxFMBKPBhfD74fnzYqZtBcPZCZDJy05DK7LdigkVI9LNQIGC /32tNsvdDtDBqIHS4gmWUBCzHo9MYh2W3NdtU6vFCjz+8HXsGQBwVo8ZNcsb/klEF0DC uawg== X-Gm-Message-State: ALoCoQmMwZLpte8v088bk99zzkpjtFVP42kM51squVD1YRpjjzgR8OnPtAnxI1zsufHf5TJQE5ae X-Received: by 10.60.52.244 with SMTP id w20mr12692308oeo.30.1379085543298; Fri, 13 Sep 2013 08:19:03 -0700 (PDT) Received: from deserted.net (198-84-238-35.cpe.teksavvy.com. [198.84.238.35]) by mx.google.com with ESMTPSA id rr6sm15089820oeb.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 08:19:02 -0700 (PDT) Date: Fri, 13 Sep 2013 08:18:57 -0700 From: Joe MacDonald To: b40290@freescale.com Message-ID: <20130913151854.GA6908@deserted.net> References: <1378966183-2859-1-git-send-email-b40290@freescale.com> MIME-Version: 1.0 In-Reply-To: <1378966183-2859-1-git-send-email-b40290@freescale.com> X-URL: http://github.com/joeythesaint/joe-s-common-environment/tree/master X-Configuration: git://github.com/joeythesaint/joe-s-common-environment.git X-Editor: Vim-703 http://www.vim.org User-Agent: Mutt/1.5.21 (2010-09-15) Cc: yocto@yoctoproject.org Subject: Re: [Meta-security][PATCH v2] snort: add recipe X-BeenThere: yocto@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Discussion of all things Yocto Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 15:19:09 -0000 X-Groupsio-MsgNum: 16038 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J2SCkAp4GZ/dPZZf" Content-Disposition: inline --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [[yocto] [Meta-security][PATCH v2] snort: add recipe] On 13.09.12 (Thu 14:0= 9) b40290@freescale.com wrote: > From: Chunrong Guo >=20 > *snort - a free lightweight network intrusion detection > system for UNIX and Windows >=20 > Signed-off-by: Chunrong Guo I might have mentioned this before (I know I did, but I don't recall if it was on one of these lists or not) but I thought snort would fit well in meta-networking as it has a lot in common with other networking tools like nmap and wireshark. -J. > --- > recipes-security/snort/files/default | 42 ++ > .../snort/files/disable-dap-address-space-id.patch | 52 +++ > .../snort/files/disable-inaddr-none.patch | 75 ++++ > recipes-security/snort/files/logrotate | 12 + > recipes-security/snort/files/snort.init | 425 ++++++++++++++= ++++++ > recipes-security/snort/files/volatiles | 2 + > recipes-security/snort/snort_2.9.4.6.bb | 86 ++++ > 7 files changed, 694 insertions(+), 0 deletions(-) > create mode 100644 recipes-security/snort/files/default > create mode 100644 recipes-security/snort/files/disable-dap-address-spac= e-id.patch > create mode 100644 recipes-security/snort/files/disable-inaddr-none.patch > create mode 100644 recipes-security/snort/files/logrotate > create mode 100755 recipes-security/snort/files/snort.init > create mode 100644 recipes-security/snort/files/volatiles > create mode 100644 recipes-security/snort/snort_2.9.4.6.bb >=20 > diff --git a/recipes-security/snort/files/default b/recipes-security/snor= t/files/default > new file mode 100644 > index 0000000..afd3840 > --- /dev/null > +++ b/recipes-security/snort/files/default > @@ -0,0 +1,42 @@ > +# Parameters for the daemon > +# Add any additional parameteres here. > +PARAMS=3D"-m 027 -D -d " > +# > +# Snort user > +# This user will be used to launch snort. Notice that the=20 > +# preinst script of the package might do changes to the user=20 > +# (home directory, User Name) when the package is upgraded or > +# reinstalled. So, do *not* change this to 'root' or to any other user= =20 > +# unless you are sure there is no problem with those changes being intro= duced. > +#=20 > +SNORTUSER=3D"snort" > +# > +# Logging directory > +# Snort logs will be dropped here and this will be the home > +# directory for the SNORTUSER. If you change this value you should > +# change the /etc/logrotate.d/snort definition too, otherwise logs > +# will not be rotated properly. > +# > +LOGDIR=3D"/var/log/snort" > +# > +# Snort group > +# This is the group that the snort user will be added to. > +# > +SNORTGROUP=3D"snort" > +#=20 > +# Allow Snort's init.d script to work if the configured interfaces > +# are not available. Set this to yes if you configure Snort with > +# multiple interfaces but some might not be available on boot > +# (e.g. wireless interfaces) > +#=20 > +# Note: In order for this to work the 'iproute' package needs to=20 > +# be installed. > +ALLOW_UNAVAILABLE=3D"no" > + > +# Local configs > +# > +LOCAL_SNORT_STARTUP=3Dboot > +LOCAL_SNORT_HOME_NET=3D"192.168.0.0/16" > +LOCAL_SNORT_INTERFACE=3D"" > +LOCAL_SNORT_STATS_RCPT=3D"root" > +LOCAL_SNORT_STATS_THRESHOLD=3D"1" > diff --git a/recipes-security/snort/files/disable-dap-address-space-id.pa= tch b/recipes-security/snort/files/disable-dap-address-space-id.patch > new file mode 100644 > index 0000000..39e5c9c > --- /dev/null > +++ b/recipes-security/snort/files/disable-dap-address-space-id.patch > @@ -0,0 +1,52 @@ > +Upstream-Status:Inappropriate [embedded specific] > + > +fix the below error: > +checking for dap address space id... configure:=20 > +configure: error: cannot run test program while cross compiling > + > + > +Signed-off-by: Chunrong Guo > + > +--- a/configure.in 2013-08-23 00:06:37.239361932 -0500 > ++++ b/configure.in 2013-08-23 00:07:32.860266534 -0500 > +@@ -679,23 +679,23 @@ > +=20 > + AC_CHECK_FUNCS([daq_hup_apply] [daq_acquire_with_meta]) > +=20 > +-AC_MSG_CHECKING([for daq address space ID]) > +-AC_RUN_IFELSE( > +-[AC_LANG_PROGRAM( > +-[[ > +-#include > +-]], > +-[[ > +- DAQ_PktHdr_t hdr; > +- hdr.address_space_id =3D 0; > +-]])], > +-[have_daq_address_space_id=3D"yes"], > +-[have_daq_address_space_id=3D"no"]) > +-AC_MSG_RESULT($have_daq_address_space_id) > +-if test "x$have_daq_address_space_id" =3D "xyes"; then > +- AC_DEFINE([HAVE_DAQ_ADDRESS_SPACE_ID],[1], > +- [DAQ version supports address space ID in header.]) > +-fi > ++#AC_MSG_CHECKING([for daq address space ID]) > ++#AC_RUN_IFELSE( > ++#[AC_LANG_PROGRAM( > ++#[[ > ++##include > ++#]], > ++#[[ > ++# DAQ_PktHdr_t hdr; > ++# hdr.address_space_id =3D 0; > ++#]])], > ++have_daq_address_space_id=3D"yes" > ++#[have_daq_address_space_id=3D"no"]) > ++#AC_MSG_RESULT($have_daq_address_space_id) > ++#if test "x$have_daq_address_space_id" =3D "xyes"; then > ++# AC_DEFINE([HAVE_DAQ_ADDRESS_SPACE_ID],[1], > ++# [DAQ version supports address space ID in header.]) > ++#fi > +=20 > + # any sparc platform has to have this one defined. > + AC_MSG_CHECKING(for sparc) > diff --git a/recipes-security/snort/files/disable-inaddr-none.patch b/rec= ipes-security/snort/files/disable-inaddr-none.patch > new file mode 100644 > index 0000000..9dafe63 > --- /dev/null > +++ b/recipes-security/snort/files/disable-inaddr-none.patch > @@ -0,0 +1,75 @@ > +Upstream-Status: Inappropriate [embedded specific] > + > +fix the below error: > +checking for INADDR_NONE... configure: > +configure: error: cannot run test program while cross compiling > + > +Signed-off-by: Chunrong Guo > + > + > +--- a/configure.in 2013-08-21 03:56:17.197414789 -0500 > ++++ b/configure.in 2013-08-21 23:19:05.298553560 -0500 > +@@ -281,25 +281,7 @@ > + AC_CHECK_TYPES([boolean]) > +=20 > + # In case INADDR_NONE is not defined (like on Solaris) > +-have_inaddr_none=3D"no" > +-AC_MSG_CHECKING([for INADDR_NONE]) > +-AC_RUN_IFELSE( > +-[AC_LANG_PROGRAM( > +-[[ > +-#include > +-#include > +-#include > +-]], > +-[[ > +- if (inet_addr("10,5,2") =3D=3D INADDR_NONE); > +- return 0; > +-]])], > +-[have_inaddr_none=3D"yes"], > +-[have_inaddr_none=3D"no"]) > +-AC_MSG_RESULT($have_inaddr_none) > +-if test "x$have_inaddr_none" =3D "xno"; then > +- AC_DEFINE([INADDR_NONE],[-1],[For INADDR_NONE definition]) > +-fi > ++have_inaddr_none=3D"yes" > +=20 > + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ > + #include > +@@ -397,21 +379,21 @@ > + fi > + fi > +=20 > +-AC_MSG_CHECKING([for pcap_lex_destroy]) > +-AC_RUN_IFELSE( > +-[AC_LANG_PROGRAM( > +-[[ > +-#include > +-]], > +-[[ > +- pcap_lex_destroy(); > +-]])], > +-[have_pcap_lex_destroy=3D"yes"], > +-[have_pcap_lex_destroy=3D"no"]) > +-AC_MSG_RESULT($have_pcap_lex_destroy) > +-if test "x$have_pcap_lex_destroy" =3D "xyes"; then > +- AC_DEFINE([HAVE_PCAP_LEX_DESTROY],[1],[Can cleanup lex buffer stack= created by pcap bpf filter]) > +-fi > ++#AC_MSG_CHECKING([for pcap_lex_destroy]) > ++#AC_RUN_IFELSE( > ++#[AC_LANG_PROGRAM( > ++#[[ > ++##include > ++#]], > ++#[[ > ++# pcap_lex_destroy(); > ++#]])], > ++have_pcap_lex_destroy=3D"yes" > ++#[have_pcap_lex_destroy=3D"no"]) > ++#AC_MSG_RESULT($have_pcap_lex_destroy) > ++#if test "x$have_pcap_lex_destroy" =3D "xyes"; then > ++# AC_DEFINE([HAVE_PCAP_LEX_DESTROY],[1],[Can cleanup lex buffer stac= k created by pcap bpf filter]) > ++#fi > +=20 > + AC_MSG_CHECKING([for pcap_lib_version]) > + AC_LINK_IFELSE( > diff --git a/recipes-security/snort/files/logrotate b/recipes-security/sn= ort/files/logrotate > new file mode 100644 > index 0000000..ef3e4af > --- /dev/null > +++ b/recipes-security/snort/files/logrotate > @@ -0,0 +1,12 @@ > +/var/log/snort/*.log /var/log/snort/alert { > + size 1M > + missingok > + compress > + delaycompress > + rotate 10 > + sharedscripts > + postrotate > + /etc/init.d/snort restart > + endscript > +} > + > diff --git a/recipes-security/snort/files/snort.init b/recipes-security/s= nort/files/snort.init > new file mode 100755 > index 0000000..af66619 > --- /dev/null > +++ b/recipes-security/snort/files/snort.init > @@ -0,0 +1,425 @@ > +#!/bin/sh -e > +# > +# Init.d script for Snort in OpenEmbedded, based on Debian's script > +# > +# Copyright (c) 2009 Roman I Khimov > +# > +# Copyright (c) 2001 Christian Hammers=20 > +# Copyright (c) 2001-2002 Robert van der Meulen > +# Copyright (c) 2002-2004 Sander Smeenk > +# Copyright (c) 2004-2007 Javier Fernandez-Sanguino > +# > +# This is free software; you may redistribute it and/or modify > +# it under the terms of the GNU General Public License as > +# published by the Free Software Foundation; either version 2, > +# or (at your option) any later version. > +# > +# This is distributed in the hope that it will be useful, but > +# WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License with > +# the Debian operating system, in /usr/share/common-licenses/GPL; if > +# not, write to the Free Software Foundation, Inc., 59 Temple Place, > +# Suite 330, Boston, MA 02111-1307 USA > +# > +### BEGIN INIT INFO > +# Provides: snort > +# Required-Start: $time $network $local_fs > +# Required-Stop: =20 > +# Should-Start: $syslog > +# Should-Stop: =20 > +# Default-Start: 2 3 4 5 > +# Default-Stop: 0 1 6 > +# Short-Description: Lightweight network intrusion detection system > +# Description: Intrusion detection system that will > +# capture traffic from the network cards and will > +# match against a set of known attacks. > +### END INIT INFO > + > +PATH=3D/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin > + > +test $DEBIAN_SCRIPT_DEBUG && set -v -x > + > +DAEMON=3D/usr/bin/snort > +NAME=3Dsnort > +DESC=3D"Network Intrusion Detection System" > + > +. /etc/default/snort > +COMMON=3D"$PARAMS -l $LOGDIR -u $SNORTUSER -g $SNORTGROUP" > + > +test -x $DAEMON || exit 0 > +test -z "$LOCAL_SNORT_HOME_NET" && LOCAL_SNORT_HOME_NET=3D"192.168.0.0/1= 6" > + > +# to find the lib files > +cd /etc/snort > + > +running() > +{ > + PIDFILE=3D$1 > +# No pidfile, probably no daemon present > + [ ! -f "$PIDFILE" ] && return 1 > + pid=3D`cat $PIDFILE` > +# No pid, probably no daemon present > + [ -z "$pid" ] && return 1 > + [ ! -d /proc/$pid ] && return 1 > + cmd=3D`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d= : -f 1` > +# No daemon > + [ "$cmd" !=3D "$DAEMON" ] && return 1 > + return 0 > +} > + > + > +check_log_dir() { > +# Does the logging directory belong to Snort? > + # If we cannot determine the logdir return without error > + # (we will not check it) > + # This will only be used by people using /etc/default/snort > + [ -n "$LOGDIR" ] || return 0 > + [ -n "$SNORTUSER" ] || return 0 > + if [ ! -e "$LOGDIR" ] ; then > + echo "ERR: logging directory $LOGDIR does not exist" > + return 1 > + elif [ ! -d "$LOGDIR" ] ; then > + echo "ERR: logging directory $LOGDIR does not exist" > + return 1 > + else > + # Don't worry, be happy > + true > + fi > + return 0 > +} > + > +check_root() { > + if [ "$(id -u)" !=3D "0" ]; then > + echo "You must be root to start, stop or restart $NAME." > + exit 4 > + fi > +} > + > +case "$1" in > + start) > + check_root > + echo "Starting $DESC " "$NAME" > + > + if [ -e /etc/snort/db-pending-config ] ; then > + echo "/etc/snort/db-pending-config file found" > + echo "Snort will not start as its database is not yet configured." > + echo "Please configure the database as described in" > + echo "/usr/share/doc/snort-{pgsql,mysql}/README-database.Debian" > + echo "and remove /etc/snort/db-pending-config" > + exit 6 > + fi > + > + if ! check_log_dir; then > + echo " will not start $DESC!" > + exit 5 > + fi > + if [ "$LOCAL_SNORT_STARTUP" =3D "dialup" ]; then > + shift > + set +e > + /etc/ppp/ip-up.d/snort "$@" > + ret=3D$? > + if [ $ret -eq 0 ] ; then > + echo 0 > + else > + echo 1 > + fi > + exit $ret > + fi > + > + # Usually, we start all interfaces > + interfaces=3D"$LOCAL_SNORT_INTERFACE" > + > + # If we are requested to start a specific interface... > + test "$2" && interfaces=3D"$2" > + > + # If the interfaces list is empty stop (no error) > + if [ -z "$interfaces" ] ; then > + echo "no interfaces configured, will not start" > + echo 0 > + exit 0 > + fi > + > + myret=3D0 > + got_instance=3D0 > + for interface in $interfaces; do > + got_instance=3D1 > + echo "($interface" > + > + # Check if the interface is available: > + # - only if iproute is available > + # - the interface exists=20 > + # - the interface is up > + if ! [ -x /sbin/ip ] || ( ip link show dev "$interface" = >/dev/null 2>&1 && [ -n "`ip link show up "$interface" 2>/dev/null`" ] ) ; = then > + > + PIDFILE=3D/var/run/snort_$interface.pid > + CONFIGFILE=3D/etc/snort/snort.$interface.conf > + > + # Defaults: > + fail=3D"failed (check /var/log/syslog and /var/log/snort)" > + run=3D"yes" > + > + if [ -e "$PIDFILE" ] && running $PIDFILE; then > + run=3D"no"=20 > + # Do not start this instance, it is already runi= ng > + fi > + > + if [ "$run" =3D "yes" ] ; then > + if [ ! -e "$CONFIGFILE" ]; then > + echo "no /etc/snort/snort.$interface.conf found,= defaulting to snort.conf" > + CONFIGFILE=3D/etc/snort/snort.conf > + fi > + > + set +e > + /sbin/start-stop-daemon --start --quiet \ > + --pidfile "$PIDFILE" \ > + --exec $DAEMON -- $COMMON $LOCAL_SNORT_OPTIONS \ > + -c $CONFIGFILE \ > + -S "HOME_NET=3D[$LOCAL_SNORT_HOME_NET]" \ > + -i $interface >/dev/null > + ret=3D$? > + case "$ret" in > + 0) > + echo "...done)" > + ;; > + *) > + echo "...ERROR: $fail)" > + myret=3D$(expr "$myret" + 1) > + ;; > + esac > + set -e > + else > + echo "...already running)" > + fi > + > + else > + # What to do if the interface is not available > + # or is not up > + if [ "$ALLOW_UNAVAILABLE" !=3D "no" ] ; then=20 > + echo "...interface not available)" > + else=20 > + echo "...ERROR: interface not available)" > + myret=3D$(expr "$myret" + 1) > + fi > + fi > + done > + > + if [ "$got_instance" =3D 0 ] && [ "$ALLOW_UNAVAILABLE" =3D "no" ]; then > + echo "No snort instance found to be started!" >&2 > + exit 6 > + fi > + > + if [ $myret -eq 0 ] ; then > + echo 0 > + else > + echo 1 > + fi > + exit $myret > + ;; > + stop) > + check_root > + echo "Stopping $DESC " "$NAME" > + =20 > + if [ "$LOCAL_SNORT_STARTUP" =3D "dialup" ]; then > + shift > + set +e > + /etc/ppp/ip-down.d/snort "$@" > + ret=3D$? > + if [ $ret -eq 0 ] ; then > + echo 0 > + else > + echo 1 > + fi > + exit $ret > + fi > + > + # Usually, we stop all current running interfaces > + pidpattern=3D/var/run/snort_*.pid > + > + # If we are requested to stop a specific interface... > + test "$2" && pidpattern=3D/var/run/snort_"$2".pid > + > + got_instance=3D0 > + myret=3D0 > + for PIDFILE in $pidpattern; do > + # This check is also needed, if the above pattern doesn't match > + test -f "$PIDFILE" || continue > + > + got_instance=3D1 > + interface=3D$(basename "$PIDFILE" .pid | sed -e 's/^snort_//') > + > + echo "($interface" > + > + set +e > + if [ ! -e "$PIDFILE" -o -r "$PIDFILE" ] ; then > +# Change ownership of the pidfile > + /sbin/start-stop-daemon --stop --retry 5 --quiet --oknodo \ > + --pidfile "$PIDFILE" --exec $DAEMON >/dev/null > + ret=3D$? > + rm -f "$PIDFILE" > + rm -f "$PIDFILE.lck" > + else > + echo "cannot read $PIDFILE" > + ret=3D4 > + fi > + case "$ret" in > + 0) > + echo "...done)" > + ;; > + *) > + echo "...ERROR)" > + myret=3D$(expr "$myret" + 1) > + ;; > + esac > + set -e > + > + done > + > + if [ "$got_instance" =3D 0 ]; then > + log_warning_msg "No running snort instance found" > + exit 0 # LSB demands we don't exit with error here > + fi > + if [ $myret -eq 0 ] ; then > + echo 0 > + else > + echo 1 > + fi > + exit $myret > + ;; > + restart|force-restart|reload|force-reload) > + check_root > + # Usually, we restart all current running interfaces > + pidpattern=3D/var/run/snort_*.pid > + > + # If we are requested to restart a specific interface... > + test "$2" && pidpattern=3D/var/run/snort_"$2".pid > + > + got_instance=3D0 > + for PIDFILE in $pidpattern; do > + # This check is also needed, if the above pattern doesn't match > + test -f "$PIDFILE" || continue > + > + got_instance=3D1 > + interface=3D$(basename "$PIDFILE" .pid | sed -e 's/^snort_//') > + $0 stop $interface || true > + $0 start $interface || true > + done > + > + if [ "$got_instance" =3D 0 ]; then > + echo "No snort instance found to be stopped!" >&2 > + exit 6 > + fi > + ;; > + status) > +# Non-root users can use this (if allowed to) > + echo "Status of snort daemon(s)" > + interfaces=3D"$LOCAL_SNORT_INTERFACE" > + # If we are requested to check for a specific interface... > + test "$2" && interfaces=3D"$2" > + err=3D0 > + pid=3D0 > + for interface in $interfaces; do > + echo " $interface " > + pidfile=3D/var/run/snort_$interface.pid > + if [ -f "$pidfile" ] ; then > + if [ -r "$pidfile" ] ; then > + pidval=3D`cat $pidfile` > + pid=3D$(expr "$pid" + 1) > + if ps -p $pidval | grep -q snort; then > + echo "OK" > + else > + echo "ERROR" > + err=3D$(expr "$err" + 1) > + fi > + else > + echo "ERROR: cannot read status file" > + err=3D$(expr "$err" + 1) > + fi > + else > + echo "ERROR" > + err=3D$(expr "$err" + 1) > + fi > + done > + if [ $err -ne 0 ] ; then > + if [ $pid -ne 0 ] ; then > +# More than one case where pidfile exists but no snort daemon > +# LSB demands a '1' exit value here > + echo 1 > + exit 1 > + else > +# No pidfiles at all > +# LSB demands a '3' exit value here > + echo 3 > + exit 3 > + fi > + fi > + echo 0 > + ;; > + config-check) > + echo "Checking $DESC configuration"=20 > + if [ "$LOCAL_SNORT_STARTUP" =3D "dialup" ]; then > + echo "Config-check is currently not supported for snort in Dialup conf= iguration" > + echo 3 > + exit 3 > + fi > + > + # usually, we test all interfaces > + interfaces=3D"$LOCAL_SNORT_INTERFACE" > + # if we are requested to test a specific interface... > + test "$2" && interfaces=3D"$2" > + > + myret=3D0 > + got_instance=3D0 > + for interface in $interfaces; do > + got_instance=3D1 > + echo "interface $interface" > + > + CONFIGFILE=3D/etc/snort/snort.$interface.conf > + if [ ! -e "$CONFIGFILE" ]; then > + CONFIGFILE=3D/etc/snort/snort.conf > + fi > + COMMON=3D`echo $COMMON | sed -e 's/-D//'` > + set +e > + fail=3D"INVALID" > + if [ -r "$CONFIGFILE" ]; then > + $DAEMON -T $COMMON $LOCAL_SNORT_OPTIONS \ > + -c $CONFIGFILE \ > + -S "HOME_NET=3D[$LOCAL_SNORT_HOME_NET]" \ > + -i $interface >/dev/null 2>&1 > + ret=3D$? > + else > + fail=3D"cannot read $CONFIGFILE" > + ret=3D4 > + fi > + set -e > + > + case "$ret" in > + 0) > + echo "OK" > + ;; > + *) > + echo "$fail" > + myret=3D$(expr "$myret" + 1) > + ;; > + esac > + done > + if [ "$got_instance" =3D 0 ]; then > + echo "no snort instance found to be started!" >&2 > + exit 6 > + fi > + > + if [ $myret -eq 0 ] ; then > + echo 0 > + else > + echo 1 > + fi > + exit $myret > + ;; > + *) > + echo "Usage: $0 {start|stop|restart|force-restart|reload|force-reload|s= tatus|config-check}" > + exit 1 > + ;; > +esac > +exit 0 > diff --git a/recipes-security/snort/files/volatiles b/recipes-security/sn= ort/files/volatiles > new file mode 100644 > index 0000000..e3ab51d > --- /dev/null > +++ b/recipes-security/snort/files/volatiles > @@ -0,0 +1,2 @@ > +# > +d snort snort 0755 /var/log/snort none > \ No newline at end of file > diff --git a/recipes-security/snort/snort_2.9.4.6.bb b/recipes-security/s= nort/snort_2.9.4.6.bb > new file mode 100644 > index 0000000..5a165ef > --- /dev/null > +++ b/recipes-security/snort/snort_2.9.4.6.bb > @@ -0,0 +1,86 @@ > +DESCRIPTION =3D "snort - a free lightweight network intrusion detection = system for UNIX and Windows." > +HOMEPAGE =3D "http://www.snort.org/" > +LICENSE =3D "GPL" > +LIC_FILES_CHKSUM =3D "file://COPYING;md5=3D78fa8ef966b48fbf9095e13cc9237= 7c5" > + > +DEPENDS =3D "libpcap libpcre daq libdnet" > + > +SRC_URI =3D " ${GENTOO_MIRROR}/${BP}.tar.gz;name=3Dtarball \ > + file://disable-inaddr-none.patch \ > + file://disable-dap-address-space-id.patch \=20 > + file://snort.init \ > + file://default \ > + file://logrotate \ > + file://volatiles \ > + " > +SRC_URI[tarball.md5sum] =3D "4111df01a4f21bd1d328a18b76d625bd" > +SRC_URI[tarball.sha256sum] =3D "cfaa5390b1840aaaa68a6c05a7077dd92cb916e6= 186a014baa451d43cdb0b3bc" > + > +inherit autotools gettext=20 > + > +EXTRA_OECONF =3D " \ > + --enable-gre \ =20 > + --enable-linux-smp-stats \ > + --enable-reload \ > + --enable-reload-error-restart \ > + --enable-targetbased \ > + --disable-static-daq \ > + " > + > +do_install_append() { > + install -d ${D}/${sysconfdir}/snort/rules > + install -d ${D}/${sysconfdir}/snort/preproc_rules > + install -d ${D}/${sysconfdir}/default/volatiles > + mkdir -p ${D}/${sysconfdir}/init.d > + for i in map config conf dtd; do > + cp ${S}/etc/*.$i ${D}/${sysconfdir}/snort/ > + done > + cp ${S}/preproc_rules/*.rules ${D}/${sysconfdir}/snort/preproc_rules/ > + install -m 0644 ${WORKDIR}/default ${D}/${sysconfdir}/default/snort > + install -m 0644 ${WORKDIR}/volatiles ${D}/${sysconfdir}/default/volatil= es/snort > + install -m 0755 ${WORKDIR}/snort.init ${D}/${sysconfdir}/init.d/snort > + mkdir -p ${D}/${localstatedir}/log/snort > + install -d ${D}${sysconfdir}/logrotate.d > + install -m 0644 ${WORKDIR}/logrotate ${D}${sysconfdir}/logrotate.d/snort > +} > + > +pkg_postinst_${PN}() { > + grep -q ^snort: /etc/group || addgroup snort > + grep -q ^snort: /etc/passwd || \ > + adduser --disabled-password --home=3D/var/log/snort/ --system \ > + --ingroup snort --no-create-home -g "snort" snort > + ${sysconfdir}/init.d/populate-volatile.sh update > +} > + > +PACKAGES =3D+ "${PN}-logrotate" > +FILES_${PN}-logrotate =3D "${sysconfdir}/logrotate.d/snort" > +FILES_${PN} +=3D " \ > + ${libdir}/snort_dynamicengine/*.so.* \ > + ${libdir}/snort_dynamicpreprocessor/*.so.* \ > + ${libdir}/snort_dynamicrules/*.so.* \ > + " > +FILES_${PN}-dbg +=3D " \ > + ${libdir}/snort_dynamicengine/.debug \ > + ${libdir}/snort_dynamicpreprocessor/.debug \ > + ${libdir}/snort_dynamicrules/.debug \ > + " > +FILES_${PN}-staticdev +=3D " \ > + ${libdir}/snort_dynamicengine/*.a \ > + ${libdir}/snort_dynamicpreprocessor/*.a \ > + ${libdir}/snort_dynamicrules/*.a \ > + ${libdir}/snort/dynamic_preproc/*.a \ > + ${libdir}/snort/dynamic_output/*.a \ > + " > +FILES_${PN}-dev +=3D " \ > + ${libdir}/snort_dynamicengine/*.la \ > + ${libdir}/snort_dynamicpreprocessor/*.la \ > + ${libdir}/snort_dynamicrules/*.la \ > + ${libdir}/snort_dynamicengine/*.so \ > + ${libdir}/snort_dynamicpreprocessor/*.so \ > + ${libdir}/snort_dynamicrules/*.so \ > + ${prefix}/src/snort_dynamicsrc \ > + " > + > +RRECOMMENDS_${PN} +=3D "${PN}-logrotate" > +RRECOMMENDS_${PN} +=3D "barnyard" > +RSUGGESTS_${PN}-logrotate +=3D "logrotate" --=20 -Joe MacDonald. :wq --J2SCkAp4GZ/dPZZf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlIzLNYACgkQwFvcllog0XxzxQCgtpFYns/K1xf1sq1jPZ3z56x2 8j8AnjjPnz4HzVQsGUp+Ub8Uqj+wdocg =i09s -----END PGP SIGNATURE----- --J2SCkAp4GZ/dPZZf--