Revision bump. Added patch to allow --createlogfile to accept an opt. argument (filen...
authorAaron Walker <ka0ttic@gentoo.org>
Tue, 7 Dec 2004 10:33:36 +0000 (10:33 +0000)
committerAaron Walker <ka0ttic@gentoo.org>
Tue, 7 Dec 2004 10:33:36 +0000 (10:33 +0000)
app-forensics/rkhunter/ChangeLog
app-forensics/rkhunter/Manifest
app-forensics/rkhunter/files/digest-rkhunter-1.1.7 [deleted file]
app-forensics/rkhunter/files/digest-rkhunter-1.1.8-r1 [new file with mode: 0644]
app-forensics/rkhunter/files/rkhunter-1.1.8-specify-logfile.patch [new file with mode: 0644]
app-forensics/rkhunter/files/rkhunter.bash-completion
app-forensics/rkhunter/files/rkhunter.cron
app-forensics/rkhunter/rkhunter-1.1.7.ebuild [deleted file]
app-forensics/rkhunter/rkhunter-1.1.8-r1.ebuild [new file with mode: 0644]
app-forensics/rkhunter/rkhunter-1.1.8.ebuild

index 4f3d373fc5e3e51ebd712e8b2db1c9845cfc4e8d..6a0729a03c7b5e25cce15d3c5e97e10517217f0c 100644 (file)
@@ -1,6 +1,17 @@
 # ChangeLog for app-forensics/rkhunter
 # Copyright 2000-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/ChangeLog,v 1.13 2004/11/07 02:46:48 ka0ttic Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/ChangeLog,v 1.14 2004/12/07 10:33:36 ka0ttic Exp $
+
+*rkhunter-1.1.8-r1 (07 Dec 2004)
+
+  07 Dec 2004; Aaron Walker <ka0ttic@gentoo.org>
+  +files/rkhunter-1.1.8-specify-logfile.patch,
+  files/rkhunter.bash-completion, files/rkhunter.cron,
+  -rkhunter-1.1.7.ebuild, +rkhunter-1.1.8-r1.ebuild, rkhunter-1.1.8.ebuild:
+  Revision bump. Added patch to allow --createlogfile to accept an opt.
+  argument (filename); rewrote cron script (super duper enhanced (x10)) for
+  bug 73432 - see the config section in files/rkhunter.cron for all the new
+  features. Cleaned up ebuild and removed 1.1.7.
 
   06 Nov 2004; Aaron Walker <ka0ttic@gentoo.org> rkhunter-1.1.7.ebuild,
   rkhunter-1.1.8.ebuild:
index 4880429bd03fd2d6493c547d67d42f207f3aa26a..f6daccf8a222a384b622fb13f84dbbb318aebfba 100644 (file)
@@ -1,18 +1,19 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-MD5 078e0cad87f1d38270a9065c68477064 rkhunter-1.1.7.ebuild 1445
-MD5 15f881b641ba27f16f34ca544dcd6698 ChangeLog 4195
+MD5 824b611f8625afac8de925079cddf2ac rkhunter-1.1.8-r1.ebuild 2127
+MD5 a3c87a254d42285e78fd85b40246dd04 ChangeLog 4730
 MD5 f1608c19ea0727ee36b2a692b1f3470b metadata.xml 264
-MD5 4acffd5575761c6ffefeb7b9087b3306 rkhunter-1.1.8.ebuild 1445
-MD5 bbe8224c46ee3ddd8cea79ed4b817ae4 files/rkhunter.cron 1035
-MD5 6ffd297b11dded42095078ef68ef2fb9 files/rkhunter.bash-completion 2529
-MD5 011c5df2094bff6d80ce80a90e530bb6 files/digest-rkhunter-1.1.7 66
+MD5 49fdc771f7821f883212cdf18713b211 rkhunter-1.1.8.ebuild 1545
+MD5 4aace52e301a67ef5b8b23d8d2c5ba46 files/rkhunter.cron 3855
+MD5 2473ff095ea8aa159a379872571b5d43 files/rkhunter.bash-completion 2628
+MD5 46201344c0b062b490ed6e81dcbfc48f files/rkhunter-1.1.8-specify-logfile.patch 1633
 MD5 f1345147c35da8e7f1f51ede053106e6 files/digest-rkhunter-1.1.8 66
+MD5 f1345147c35da8e7f1f51ede053106e6 files/digest-rkhunter-1.1.8-r1 66
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (GNU/Linux)
 
-iD8DBQFBjYypEZCkKN40op4RArxfAJ9JJ/PYF/zCyXOKzR6ljTbLXpPS+QCfWxGV
-Uz+ttesJClApx89J7TZMh6c=
-=fsHd
+iD8DBQFBtYcpEZCkKN40op4RAhvzAJ43x1q2zM5XD0Xku733NB2MrHScDACfT+zn
+AwPx+GLWiqTrSGLGGBCYVmU=
+=eBiX
 -----END PGP SIGNATURE-----
diff --git a/app-forensics/rkhunter/files/digest-rkhunter-1.1.7 b/app-forensics/rkhunter/files/digest-rkhunter-1.1.7
deleted file mode 100644 (file)
index 6ed9ef9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-MD5 95e8eeb46f0f2cd928180ac9cfb2dbb0 rkhunter-1.1.7.tar.gz 108223
diff --git a/app-forensics/rkhunter/files/digest-rkhunter-1.1.8-r1 b/app-forensics/rkhunter/files/digest-rkhunter-1.1.8-r1
new file mode 100644 (file)
index 0000000..1e212da
--- /dev/null
@@ -0,0 +1 @@
+MD5 91cae6f04582fb0b27c96784ffe5adae rkhunter-1.1.8.tar.gz 112615
diff --git a/app-forensics/rkhunter/files/rkhunter-1.1.8-specify-logfile.patch b/app-forensics/rkhunter/files/rkhunter-1.1.8-specify-logfile.patch
new file mode 100644 (file)
index 0000000..8203669
--- /dev/null
@@ -0,0 +1,49 @@
+--- rkhunter.orig      2004-12-06 06:19:55.000000000 -0500
++++ rkhunter   2004-12-07 01:47:27.596729320 -0500
+@@ -146,6 +146,11 @@
+       --createlogfile | --createlog | --create-log | --create-logfile)
+         DEBUG=1
+           DEBUGLOG=1
++        if [[ "$2" != -* ]]
++          then
++              shift
++              LOGFILE=$1
++          fi
+         ;;
+       --dbdir)
+           shift
+@@ -225,12 +230,21 @@
+     # Through the drain...
+     DEBUGFILE="/dev/null"
+   else
+-    if [ -d "/var/log" ]
++    if [ -n "${LOGFILE}" ]
+       then
+-        DEBUGFILE="/var/log/rkhunter.log"
++      if ( [[ "${LOGFILE}" == */* ]] && [ -d "${LOGFILE%/*}" ] ) || [ -w ./ ]
++        then
++          DEBUGFILE="${LOGFILE}"
++      fi
++      
++      elif [ -d "/var/log" ]
++        then
++        DEBUGFILE="/var/log/rkhunter.log"
++        [ -n "${LOGFILE}" ] && echo \
++          "${LOGFILE%/*} doesn't exist... trying ${DEBUGFILE}"
+       else
+         echo "/var/log doesn't exists... no log file created"
+-      DEBUGFILE="/dev/null"
++        DEBUGFILE="/dev/null"
+     fi
+     # Clear debug file
+     if [ -f ${DEBUGFILE} ]; then
+@@ -4860,7 +4874,8 @@
+     echo $ECHOOPT ""
+     echo $ECHOOPT "Valid parameters:"
+     echo $ECHOOPT "--checkall (-c)           : Check system"
+-    echo $ECHOOPT "--createlogfile*          : Create logfile"
++    echo $ECHOOPT "--createlogfile <file>*   : Create logfile (file is optional, defaults to"
++    echo $ECHOOPT "                          : /var/log/rkhunter.log)"
+     echo $ECHOOPT "--cronjob                 : Run as cronjob (removes colored layout)"
+     echo $ECHOOPT "--display-logfile         : Show logfile at end of the output"    
+     echo $ECHOOPT "--help (-h)               : Show this help"
index cab2a3067afd917433355a281eb53867f4553ec6..dca057c4d91927210e2693526e7cae6b8b3d54c7 100644 (file)
@@ -1,5 +1,5 @@
-# bash-completion script for rkhunter
-# place this file in /etc/bash_completion.d
+# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/files/rkhunter.bash-completion,v 1.2 2004/12/07 10:33:36 ka0ttic Exp $
+# rkhunter completion
 
 _rkhunter() {
        local cur prev opts
@@ -19,7 +19,8 @@ _rkhunter() {
 
        case "${prev}" in
                --createlogfile)
-                       COMPREPLY=($(compgen -W "${opts/--createlogfile}" -- "${cur}"))
+                       COMPREPLY=($(compgen -o filenames -A file -W "${opts/--createlogfile}" \
+                           -- "${cur}"))
                        ;;
                --display-logfile)
                        COMPREPLY=($(compgen -W "${opts/--display-logfile}" -- "${cur}"))
index 33e57d60891432af96a3f10395f3ed81e9e4a581..15a4dcf46a7a5769e0ed2dccab55dffa0c86364f 100644 (file)
-#!/bin/sh
+#!/bin/bash
+# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/files/rkhunter.cron,v 1.2 2004/12/07 10:33:36 ka0ttic Exp $
+# original author: Aaron Walker <ka0ttic@gentoo.org>
 
-### Begin Configuration ###
+########################## Begin Configuration ###############################
 
-# set this to 'yes' to enable
+# Default options - more options may be added depending on the
+# configuration variables you set below
+RKHUNTER_OPTS="-c --cronjob --skip-keypress"
+
+# Set this to 'yes' to enable ; this script does nothing otherwise
 ENABLE=no
 
-RKHUNTER_EXEC="/usr/bin/rkhunter"
-RKHUNTER_OPTS="--checkall --cronjob --skip-keypress"
+# Automatically update rkhunter's dat files prior to running?
+UPDATE=no
 
-# set to 'yes' if you wish the output to be mailed to you
+# Set this to 'yes' if you wish the output to be mailed to you
 SEND_EMAIL=no
 
-# NOTE: the rest of these options are only relevant 
-# if you set SEND_EMAIL to 'yes'
-
+# NOTE: the following EMAIL_* variables are only relevant if you set the
+# SEND_EMAIL variable to 'yes'
 EMAIL_SUBJECT="${HOSTNAME}: rkhunter output"
 EMAIL_RECIPIENT=root
-EMAIL_CMD="| mail -s \"${EMAIL_SUBJECT}\" ${EMAIL_RECIPIENT}"
-
-# set to 1 to recieve only warnings & errors
-# set to 2 to recieve ALL rkhunter output
-# set to 3 to recieve rkhunter report
-EMAIL_VERBOSITY=3
-
-### End Configuration ###
-
-if [ "${ENABLE}" = "yes" ]; then
-       CMD="${RKHUNTER_EXEC} ${RKHUNTER_OPTS}"
-
-       if [ "${SEND_EMAIL}" = "yes" ]; then
-               if [ "${EMAIL_VERBOSITY}" -eq 1 ]; then
-                       CMD="${CMD} --quiet ${EMAIL_CMD}"
-               elif [ "${EMAIL_VERBOSITY}" -eq 2 ]; then
-                       CMD="${CMD} ${EMAIL_CMD}"
-               else # default to report-mode
-                       CMD="${CMD} --report-mode ${EMAIL_CMD}"
-               fi
-       else
-               CMD="${CMD} &>/dev/null"
+EMAIL_CMD="|mail -s \"${EMAIL_SUBJECT}\" ${EMAIL_RECIPIENT}"
+
+# Log rkhunter output?
+LOG=no
+
+# The default log location is /var/log/rkhunter.log. Set this variable if
+# you'd like to use an alternate location.
+#LOGFILE=""
+
+# By default, the log file created by rkhunter is world-readable (0644). If
+# you'd like to modify the permissions afterwards, set this variable.  The 
+# value of this variable, must be a valid chmod argument such as '0600' or 
+# 'u+rw,go-rwx'.  See the chmod(1) manual page for more information.
+#LOGFILE_PERMS="0600"
+
+# By default, rkhunter overwrites the previous log.  Set this variable
+# to 'yes' if you'd like the log output appended to the logfile, instead
+# of overwriting it.
+SAVE_OLD_LOGS=no
+
+# Set to 1 to recieve only warnings & errors
+# Set to 2 to recieve ALL rkhunter output
+# Set to 3 to recieve rkhunter report
+VERBOSITY=3
+
+########################### End Configuration ################################
+
+# exit immediately, unless enabled
+[[ "${ENABLE}" != "yes" ]] && exit 0
+
+# debug mode?  (mainly for my benefit)
+if [ -n "$1" ] && [ "$1" = "-d" ] ; then
+       set -o verbose -o xtrace
+fi
+
+[ -z "${LOGFILE}" ] && LOGFILE="/var/log/rkhunter.log"
+
+# moved this out of config section since it'll
+# probably never need to be changed
+RKHUNTER_EXEC="/usr/bin/rkhunter"
+
+# sanity check
+if [ ! -x "${RKHUNTER_EXEC}" ] ; then
+       echo "${RKHUNTER_EXEC} does not exist or is not executable!"
+       exit 1
+fi
+
+# we create a few tmp files, so let's at least make
+# them readable/writable by root only
+umask 0077
+
+# all output goes to this temp file
+_tmpout="/tmp/rkhunter.cron.${RANDOM}"
+exec > ${_tmpout} 2>&1
+
+# update data files
+if [[ "${UPDATE}" == "yes" ]] ; then
+       # save the output of --update in a tmp file so that it can be mailed
+       # along with the scan output; otherwise the user will get 2 mails
+       ${RKHUNTER_EXEC} --update
+fi
+
+# formulate options string according to user configuration
+[[ "${LOG}" == "yes" ]] && \
+    RKHUNTER_OPTS="${RKHUNTER_OPTS} --createlogfile ${LOGFILE}"
+
+case "${VERBOSITY}" in
+       # warnings and errors only
+       1)      RKHUNTER_OPTS="${RKHUNTER_OPTS} --quiet" ;;
+       # default rkhunter output (no extra options)
+       2)      ;;
+       # default to option 3 (report-mode)
+       *)      RKHUNTER_OPTS="${RKHUNTER_OPTS} --report-mode"  ;;
+esac
+
+# save old log
+if [[ "${LOG}" == "yes" && "${SAVE_OLD_LOGS}" == "yes" ]] ; then
+       if [ -e "${LOGFILE}" ] ; then
+               _tmpfile="${LOGFILE}.${RANDOM}"
+               mv -f ${LOGFILE} ${_tmpfile}
+               echo -e "--\nrkhunter.cron commencing at: $(date)\n--" >> ${_tmpfile}
        fi
+fi
+
+# finally, run rkhunter
+CMD="${RKHUNTER_EXEC} ${RKHUNTER_OPTS}"
+eval ${CMD}
+RV=$?
+
+# email output?
+if [[ "${SEND_EMAIL}" == "yes" ]] ; then
+       CMD="cat ${_tmpout} ${EMAIL_CMD}"
+       eval ${CMD}
+fi
 
-       eval exec "${CMD}"
+# remove temp file
+[ -n "${_tmpout}" ] && rm -f ${_tmpout}
+
+[[ "${LOG}" != "yes" ]] && exit ${RV}
+
+# from this point on, we can assume logging is enabled
+
+# append new log to old log and restore
+if [ -n "${_tmpfile}" ] ; then
+       cat ${LOGFILE} >> ${_tmpfile}
+       mv ${_tmpfile} ${LOGFILE}
 fi
+
+chmod ${LOGFILE_PERMS:-0644} ${LOGFILE}
+exit ${RV}
diff --git a/app-forensics/rkhunter/rkhunter-1.1.7.ebuild b/app-forensics/rkhunter/rkhunter-1.1.7.ebuild
deleted file mode 100644 (file)
index cd910b7..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/rkhunter-1.1.7.ebuild,v 1.6 2004/11/07 02:46:48 ka0ttic Exp $
-
-inherit bash-completion
-
-DESCRIPTION="Rootkit Hunter scans for known and unknown rootkits, backdoors, and sniffers."
-HOMEPAGE="http://www.rootkit.org/"
-SRC_URI="http://downloads.rootkit.nl/${P}.tar.gz"
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="x86 ~ppc alpha ~amd64 sparc"
-IUSE=""
-S=${WORKDIR}/${PN}
-DEPEND="app-arch/tar
-       app-arch/gzip
-       virtual/mta"
-RDEPEND="app-shells/bash
-       dev-lang/perl"
-
-src_install() {
-       cd ${S}/files
-       dodir /usr/lib/rkhunter
-       dodir /usr/lib/rkhunter/db
-       insinto /usr/lib/rkhunter/db
-       doins *.dat
-       dodir /usr/lib/rkhunter/scripts
-       exeinto /usr/lib/rkhunter/scripts
-       doexe *.pl check_update.sh
-       insinto /etc
-       doins rkhunter.conf
-       dosed "s:#DBDIR=/usr/local/rkhunter/db:DBDIR=/usr/lib/rkhunter/db\nINSTALLDIR=/usr:g" /etc/rkhunter.conf
-       exeinto /usr/bin
-       doexe rkhunter
-       dodoc CHANGELOG LICENSE README WISHLIST
-
-       exeinto /etc/cron.daily
-       newexe ${FILESDIR}/rkhunter.cron rkhunter
-
-       dobashcompletion ${FILESDIR}/${PN}.bash-completion ${PN}
-}
-
-pkg_postinst() {
-       echo
-       einfo "A cron script has been installed to /etc/cron.daily/rkhunter."
-       einfo "To enable it, edit /etc/cron.daily/rkhunter and follow the"
-       einfo "directions."
-       bash-completion_pkg_postinst
-}
-
-pkg_prerm() {
-       rm -rf /usr/lib/rkhunter/tmp
-}
diff --git a/app-forensics/rkhunter/rkhunter-1.1.8-r1.ebuild b/app-forensics/rkhunter/rkhunter-1.1.8-r1.ebuild
new file mode 100644 (file)
index 0000000..7933d50
--- /dev/null
@@ -0,0 +1,74 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/rkhunter-1.1.8-r1.ebuild,v 1.1 2004/12/07 10:33:36 ka0ttic Exp $
+
+inherit eutils bash-completion
+
+DESCRIPTION="Rootkit Hunter scans for known and unknown rootkits, backdoors, and sniffers."
+HOMEPAGE="http://www.rootkit.org/"
+SRC_URI="http://downloads.rootkit.nl/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~ppc ~alpha ~amd64 ~sparc"
+IUSE=""
+
+DEPEND="app-arch/tar
+       app-arch/gzip
+       virtual/mta"
+RDEPEND="app-shells/bash
+       dev-lang/perl"
+
+S="${WORKDIR}/${PN}/files"
+
+src_unpack() {
+       unpack ${A}
+       cd ${S}
+       epatch ${FILESDIR}/${P}-specify-logfile.patch
+}
+
+src_install() {
+       insinto /usr/lib/rkhunter/db
+       doins *.dat || die "failed to install dat files"
+
+       exeinto /usr/lib/rkhunter/scripts
+       doexe *.pl check_update.sh || die "failed to install scripts"
+
+       dobin rkhunter || die "failed to install rkhunter script"
+
+       insinto /etc
+       doins rkhunter.conf || die "failed to install rkhunter.conf"
+       dosed 's:^#\(DBDIR=.*\)local\(.*\)$:\1lib\2\nINSTALLDIR=/usr:' \
+               /etc/rkhunter.conf || die "sed rkhunter.conf failed"
+
+       dodoc CHANGELOG LICENSE README WISHLIST || die "dodoc failed"
+
+       exeinto /etc/cron.daily
+       newexe ${FILESDIR}/rkhunter.cron rkhunter || \
+               die "failed to install cron script"
+       dobashcompletion ${FILESDIR}/${PN}.bash-completion ${PN}
+}
+
+pkg_preinst() {
+       # until upstream releases a new version, rkhunter complains
+       # about an unsupported OS if >=sys-apps/baselayout-1.11 is installed
+       # temporary fix until new upstream release
+       if has_version '>=sys-apps/baselayout-1.11' ; then
+               echo '510:Gentoo Linux 1.6 (powerpc):/usr/bin/md5sum:/bin:' >> \
+                       ${D}/usr/lib/rkhunter/db/os.dat
+               echo '511:Gentoo Linux 1.6 (i386):/usr/bin/md5sum:/bin:' >> \
+                       ${D}/usr/lib/rkhunter/db/os.dat
+       fi
+}
+
+pkg_postinst() {
+       echo
+       einfo "A cron script has been installed to /etc/cron.daily/rkhunter."
+       einfo "To enable it, edit /etc/cron.daily/rkhunter and follow the"
+       einfo "directions."
+       bash-completion_pkg_postinst
+}
+
+pkg_prerm() {
+       rm -rf /usr/lib/rkhunter/tmp
+}
index 7402c0de4ca4b89e76c60d4ba07a9b62cae31657..01bca0b15ef3da6bea7116fa5d3bd8bf0b106fad 100644 (file)
@@ -1,8 +1,8 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/rkhunter-1.1.8.ebuild,v 1.6 2004/11/07 02:46:48 ka0ttic Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-forensics/rkhunter/rkhunter-1.1.8.ebuild,v 1.7 2004/12/07 10:33:36 ka0ttic Exp $
 
-inherit bash-completion
+inherit eutils bash-completion
 
 DESCRIPTION="Rootkit Hunter scans for known and unknown rootkits, backdoors, and sniffers."
 HOMEPAGE="http://www.rootkit.org/"
@@ -18,6 +18,12 @@ DEPEND="app-arch/tar
 RDEPEND="app-shells/bash
        dev-lang/perl"
 
+src_unpack() {
+       unpack ${A}
+       cd ${S}/files
+       epatch ${FILESDIR}/${P}-specify-logfile.patch
+}
+
 src_install() {
        cd ${S}/files
        dodir /usr/lib/rkhunter