From 720ef9f1923db7e4151335b6bd1b27a8afd5f274 Mon Sep 17 00:00:00 2001 From: Richard Scott Smith Date: Thu, 13 May 2010 01:01:07 +0200 Subject: system/samhain: Added to 13.0 repository --- system/samhain/README | 10 ++++ system/samhain/README.SLACKWARE | 46 +++++++++++++++++ system/samhain/doinst.sh | 15 ++++++ system/samhain/samhain.SlackBuild | 105 ++++++++++++++++++++++++++++++++++++++ system/samhain/samhain.info | 10 ++++ system/samhain/slack-desc | 19 +++++++ 6 files changed, 205 insertions(+) create mode 100644 system/samhain/README create mode 100644 system/samhain/README.SLACKWARE create mode 100644 system/samhain/doinst.sh create mode 100644 system/samhain/samhain.SlackBuild create mode 100644 system/samhain/samhain.info create mode 100644 system/samhain/slack-desc diff --git a/system/samhain/README b/system/samhain/README new file mode 100644 index 0000000000..9ed737c79b --- /dev/null +++ b/system/samhain/README @@ -0,0 +1,10 @@ +The samhain open source host-based intrusion detection system (HIDS) provides +file integrity checking and logfile monitoring/analysis, as well as rootkit +detection, port monitoring, detection of rogue SUID executables, and hidden +processes. + +It has been designed to monitor multiple hosts with potentially different +operating systems, providing centralized logging and maintenance, although it +can also be used as standalone application on a single host. + +See README.SLACKWARE for setup and configuration information. diff --git a/system/samhain/README.SLACKWARE b/system/samhain/README.SLACKWARE new file mode 100644 index 0000000000..e64cc6c957 --- /dev/null +++ b/system/samhain/README.SLACKWARE @@ -0,0 +1,46 @@ +README.SLACKWARE for samhain + +Edit the /etc/samhainrc file for your needs. I suggest at least +these changes, but there may be others for your particular system: +Comment out these lines: + #file = /var/lib/rpm/__db.00? + #file = /var/log/*.[0-9].gz + #file = /var/log/*/*.[0-9][0-9].gz + +I don't like Daemon mode so I switched it off, as I run in cron.daily: + # Daemon = yes + Daemon = no + +I like to see the problems again and again in case I miss a report for some +reason: + ReportOnlyOnce = False + +Set a *real* email address here and uncomment so you get problems mailed to +you when you run Samhain. It is best to use another server that handles +email to make sure it doesn't get tampered with if there really is an +intrusion: + SetMailAddress=root@localhost + +I have sendmail set up (don't you?) on my system, so I use localhost for +the relay: + SetMailRelay = localhost + +And it's a good idea to put a nice subject header in your emailed reports: + MailSubject = Samhain Report - myhostname + +Initialize the database as root. Note that this takes a while and always runs +in daemon mode regardless of your configuration! + samhain -t init + +If you want to run nightly checks, drop a script in cron.daily with something +like this in it: + #!/bin/sh + /usr/sbin/samhain -t check + +You're done. It is a little work, but now you have daily integrity checks +emailed to you about what's going on in your system, especially for +things you did not do! + +And as Pat would say... Have Fun! +--Richard Scott Smith + diff --git a/system/samhain/doinst.sh b/system/samhain/doinst.sh new file mode 100644 index 0000000000..3285ce0bcf --- /dev/null +++ b/system/samhain/doinst.sh @@ -0,0 +1,15 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/samhainrc.new + diff --git a/system/samhain/samhain.SlackBuild b/system/samhain/samhain.SlackBuild new file mode 100644 index 0000000000..537714add8 --- /dev/null +++ b/system/samhain/samhain.SlackBuild @@ -0,0 +1,105 @@ +#!/bin/sh + +# Slackware build script for samhain + +# Copyright 2009 Richard Scott smith +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=samhain +VERSION=2.6.1b +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${OUTPUT:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -f $PRGNAM-$VERSION.tar.gz{,.asc} +tar xf $CWD/$PRGNAM-current.tar.gz +rm -rf $PRGNAM-$VERSION +tar xvf $PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +# Don't clobber the config file +mv $PKG/etc/samhainrc $PKG/etc/samhainrc.new + +# No need for /var/log and /var/run directories here +rmdir $PKG/var/{log,run} + +# Stripping does not seem to work for 32 bit builds. Commenting it out +# until I can find a reason or answer. Richard Scott Smith, 1-3-2010 +#( cd $PKG +# find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ +# xargs strip --strip-unneeded 2> /dev/null || true +# find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ +# xargs strip --strip-unneeded 2> /dev/null || true +#) + +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done +) + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a COPYING LICENSE README \ + $PKG/usr/doc/$PRGNAM-$VERSION +find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \; +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/samhain/samhain.info b/system/samhain/samhain.info new file mode 100644 index 0000000000..a33e88f971 --- /dev/null +++ b/system/samhain/samhain.info @@ -0,0 +1,10 @@ +PRGNAM="samhain" +VERSION="2.6.1b" +HOMEPAGE="http://www.la-samhna.de/" +DOWNLOAD="http://www.la-samhna.de/samhain/samhain-current.tar.gz" +MD5SUM="eb0f2645829174e0223b542f8b2333cf" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Richard Scott Smith" +EMAIL="pilbender@gmail.com" +APPROVED="rworkman" diff --git a/system/samhain/slack-desc b/system/samhain/slack-desc new file mode 100644 index 0000000000..1ee31c5a58 --- /dev/null +++ b/system/samhain/slack-desc @@ -0,0 +1,19 @@ + HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +samhain: samhain (host-based intrusion detection system) +samhain: +samhain: The Samhain open source host-based intrusion detection system (HIDS) +samhain: provides file integrity checking and logfile monitoring/analysis, as +samhain: well as rootkit detection, port monitoring, detection of rogue SUID +samhain: executables, and hidden processes. It has been designed to monitor +samhain: multiple hosts with potentially different operating systems, providing +samhain: centralized logging and maintenance, although it can also be used as +samhain: a standalone application on a single host. +samhain: +samhain: Homepage: http://www.la-samhna.de/ -- cgit v1.2.3