snort : add recipe
PATCH 1/3 snort : add recipe
From: Chunrong Guo <[email protected]>
*snort - a free lightweight network intrusion detection
system for UNIX and Windows
--- .../recipes-connectivity/snort/files/default | 42 ++ .../snort/files/disable-dap-address-space-id.patch | 52 +++ .../snort/files/disable-inaddr-none.patch | 75 ++++ .../recipes-connectivity/snort/files/logrotate | 12 + .../recipes-connectivity/snort/files/snort.init | 425 ++++++++++++++++++++ .../recipes-connectivity/snort/files/volatiles | 2 + .../recipes-connectivity/snort/snort_2.9.4.6.bb | 83 ++++ 7 files changed, 691 insertions(+), 0 deletions(-) create mode 100644 meta-networking/recipes-connectivity/snort/files/default create mode 100644 meta-networking/recipes-connectivity/snort/files/disable-dap-address-space-id.patch create mode 100644 meta-networking/recipes-connectivity/snort/files/disable-inaddr-none.patch create mode 100644 meta-networking/recipes-connectivity/snort/files/logrotate create mode 100755 meta-networking/recipes-connectivity/snort/files/snort.init create mode 100644 meta-networking/recipes-connectivity/snort/files/volatiles create mode 100644 meta-networking/recipes-connectivity/snort/snort_2.9.4.6.bb
meta-networking/recipes-connectivity/snort/files/default new file +42 -0
@@ -0,0 +1,42 @@ +# Parameters for the daemon +# Add any additional parameteres here. +PARAMS="-m 027 -D -d " +# +# Snort user +# This user will be used to launch snort. Notice that the +# preinst script of the package might do changes to the user +# (home directory, User Name) when the package is upgraded or +# reinstalled. So, do *not* change this to 'root' or to any other user +# unless you are sure there is no problem with those changes being introduced. +# +SNORTUSER="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="/var/log/snort" +# +# Snort group +# This is the group that the snort user will be added to. +# +SNORTGROUP="snort" +# +# 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) +# +# Note: In order for this to work the 'iproute' package needs to +# be installed. +ALLOW_UNAVAILABLE="no" + +# Local configs +# +LOCAL_SNORT_STARTUP=boot +LOCAL_SNORT_HOME_NET="192.168.0.0/16" +LOCAL_SNORT_INTERFACE="" +LOCAL_SNORT_STATS_RCPT="root" +LOCAL_SNORT_STATS_THRESHOLD="1"
meta-networking/recipes-connectivity/snort/files/disable-dap-address-space-id.patch new file +52 -0
52 lines not on this page · raw message
meta-networking/recipes-connectivity/snort/files/disable-inaddr-none.patch new file +75 -0
75 lines not on this page · raw message
meta-networking/recipes-connectivity/snort/files/logrotate new file +12 -0
@@ -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 +} +
meta-networking/recipes-connectivity/snort/files/snort.init new file +425 -0
425 lines not on this page · raw message
meta-networking/recipes-connectivity/snort/files/volatiles new file +2 -0
@@ -0,0 +1,2 @@ +# <type> <owner> <group> <mode> <path> <linksource> +d snort snort 0755 /var/log/snort none
meta-networking/recipes-connectivity/snort/snort_2.9.4.6.bb new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
1.7.5.4
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Op 16-10-13 09:11, [email protected] schreef:
Quoted 11 lines
From: Chunrong Guo <[email protected]>
*snort - a free lightweight network intrusion detection system for UNIX and Windows
Signed-off-by Chunrong Guo <[email protected]> ---.../recipes-connectivity/snort/files/default | 42 ++ .../snort/files/disable-dap-address-space-id.patch | 52 +++ .../snort/files/disable-inaddr-none.patch | 75 ++++ .../recipes-connectivity/snort/files/logrotate | 12 + .../recipes-connectivity/snort/files/snort.init | 425
Quoted 8 lines
++++++++++++++++++++ .../recipes-connectivity/snort/files/volatiles |
2 + .../recipes-connectivity/snort/snort_2.9.4.6.bb | 83 ++++ 7
files changed, 691 insertions(+), 0 deletions(-) create mode 100644 meta-networking/recipes-connectivity/snort/files/default create mode 100644meta-networking/recipes-connectivity/snort/files/disable-dap-address-space-id.patch
create mode 100644 meta-networking/recipes-connectivity/snort/files/disable-inaddr-none.patch
Quoted 7 lines
create mode 100644 meta-networking/recipes-connectivity/snort/files/logrotate create mode 100755 meta-networking/recipes-connectivity/snort/files/snort.init create mode 100644 meta-networking/recipes-connectivity/snort/files/volatiles create mode 100644 meta-networking/recipes-connectivity/snort/snort_2.9.4.6.bb
Quoted 7 lines
(quoted diff) +0
-0b/meta-networking/recipes-connectivity/snort/files/default new file mode 100644 index 0000000..afd3840 ---
/dev/null+++ b/meta-networking/recipes-connectivity/snort/files/default @@ -0,0 +1,42 @@+LOGDIR="/var/log/snort"
Hardcoded path
Quoted 5 lines
(quoted diff) +0
-0b/meta-networking/recipes-connectivity/snort/files/logrotate new file mode 100644 index 0000000..e394e2e ---
/dev/null+++ b/meta-networking/recipes-connectivity/snort/files/logrotate @@ -0,0 +1,12 @@ +/var/log/snort/*.log/var/log/snort/alert{
hardcoded path
Quoted 2 lines
+ size 1M + missingok + compress + delaycompress + rotate
10 + sharedscripts + postrotate +/etc/init.d/snortrestart
hardcoded path and sysvinit specific
Quoted 7 lines
(quoted diff) +0
-0b/meta-networking/recipes-connectivity/snort/files/snort.init new file mode 100755 index 0000000..af66619 ---
/dev/null+++ b/meta-networking/recipes-connectivity/snort/files/snort.init @@ -0,0 +1,425 @@+ +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
hardcoded paths
Quoted 1 line
+ +test $DEBIAN_SCRIPT_DEBUG && set -v -x + +DAEMON=/usr/bin/snort
hardcoded path
Quoted 2 lines
+NAME=snort +DESC="Network Intrusion Detection System" + +.
/etc/default/snort
hardcoded path
Quoted 4 lines
+COMMON="$PARAMS -l $LOGDIR -u $SNORTUSER -g $SNORTGROUP" + +test -x $DAEMON || exit 0 +test -z "$LOCAL_SNORT_HOME_NET" && LOCAL_SNORT_HOME_NET="192.168.0.0/16" + +# to find the lib files +cd
/etc/snort
hardcoded path
Quoted 2 lines
+check_root() { + if [ "$(id -u)" != "0" ]; then + echo "You
must be root to start, stop or restart $NAME." + exit 4 + fi
does this work with busybox?
Quoted 7 lines
+} + +case "$1" in + start) +
check_root+ echo "Starting $DESC "
"$NAME" + + if [ -e/etc/snort/db-pending-config] ; then + echo
"/etc/snort/db-pending-configfile 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"
Tons of hardcoded paths
Quoted 3 lines
(quoted diff) +1
-0+ exit 6 + fi + + if ! check_log_dir; then + echo " will notstart $DESC!" + exit 5 + fi + if [ "$LOCAL_SNORT_STARTUP" = "dialup" ];
then + shift + set +e +/etc/ppp/ip-up.d/snort"$@"
hardcoded path and needs RRECOMMENDS = pppd?
Quoted 7 lines
(quoted diff) +1
-0+ myret=0 + got_instance=0 + for interface in $interfaces; do +got_instance=1 + echo "($interface" + + # Check if the
interface is available: + # - only if iproute is
available + # - the interface exists + # -
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
hardcoded path and needs RDEPENDS = iputils?
Quoted 4 lines
+ + PIDFILE=/var/run/snort_$interface.pid +
CONFIGFILE=/etc/snort/snort.$interface.conf + + #
Defaults: + fail="failed (check/var/log/syslogand/var/log/snort)" +
run="yes"
paths...
Quoted 6 lines
+ + if [ -e "$PIDFILE" ] && running $PIDFILE; then +
run="no" + # Do not start this instance, it is
already runing + fi + + if [ "$run" = "yes"
] ; then + if [ ! -e "$CONFIGFILE" ]; then +
echo "no/etc/snort/snort.$interface.conffound, defaulting to
snort.conf" + CONFIGFILE=/etc/snort/snort.conf
paths...
Quoted 2 lines
+ fi + + set +e +
/sbin/start-stop-daemon--start --quiet \
start-stop-daemon is in $PATH, so no need to hardcode /sbin
Quoted 2 lines
(quoted diff) +1
-0+ if [ "$LOCAL_SNORT_STARTUP" = "dialup" ]; then + shift + set +e +
/etc/ppp/ip-down.d/snort"$@"
paths....
Quoted 2 lines
(quoted diff) +1
-0+ # Usually, we stop all current running interfaces +pidpattern=/var/run/snort_*.pid
paths and isn't that /run nowadays?
Quoted 2 lines
(quoted diff) +1
-0+ # If we are requested to stop a specific interface... + test "$2" &&pidpattern=/var/run/snort_"$2".pid
paths
Quoted 7 lines
+ + got_instance=0 + myret=0 + for PIDFILE in $pidpattern; do + #
This check is also needed, if the above pattern doesn't match + test -f
"$PIDFILE" || continue + + got_instance=1 + interface=$(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 \
paths
Quoted 3 lines
+ restart|force-restart|reload|force-reload) +
check_root+ #
Usually, we restart all current running interfaces + pidpattern=/var/run/snort_*.pid
paths and I'll stop here a sed in do_install will catch most if not all hardcodes. The start-stop-daemon ones need to get removed.
Quoted 22 lines
(quoted diff) +0
-0b/meta-networking/recipes-connectivity/snort/files/volatiles new file mode 100644 index 0000000..0f22f9b ---
/dev/null+++ b/meta-networking/recipes-connectivity/snort/files/volatiles @@ -0,0 +1,2 @@ +# <type> <owner> <group> <mode> <path> <linksource> +d snort snort 0755/var/log/snortnone diff --git a/meta-networking/recipes-connectivity/snort/snort_2.9.4.6.bb b/meta-networking/recipes-connectivity/snort/snort_2.9.4.6.bb new file mode 100644 index 0000000..c72b49b ---/dev/null+++ b/meta-networking/recipes-connectivity/snort/snort_2.9.4.6.bb @@ -0,0 +1,83 @@ +DESCRIPTION = "snort - a free lightweight network intrusion detection system for UNIX and Windows." +HOMEPAGE = "http://www.snort.org/" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://COPYING;md5=78fa8ef966b48fbf9095e13cc92377c5" + +DEPENDS = "libpcap libpcre daq libdnet" + + +SRC_URI = " ${GENTOO_MIRROR}/${BP}.tar.gz;name=tarball \ + file://disable-inaddr-none.patch \ + file://disable-dap-address-space-id.patch \ +
file://snort.init \ + file://default \ +
file://logrotate \ + file://volatiles" +(quoted diff) +2
-0+SRC_URI[tarball.md5sum] = "4111df01a4f21bd1d328a18b76d625bd" +SRC_URI[tarball.sha256sum] =
Quoted 2 lines
"
cfaa5390b1840aaaa68a6c05a7077dd92cb916e6186a014baa451d43cdb0b3bc" + +inherit autotools gettext
update-rc.d class for the sysvscript?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: GPGTools - http://gpgtools.org
iD8DBQFSXlGnMkyGM64RGpERAiuLAKCELquADUALv8QG7yjV9oWopld8xwCgtQUU 8sMwg/KHo2JzsX0Vr3AH/KM=
=jg8m
-----END PGP SIGNATURE-----