From 786ab4f9053ad46f39f74e4d861c5df0d6bb52b5 Mon Sep 17 00:00:00 2001 From: Michal Ambroz Date: Mar 28 2011 21:20:11 +0000 Subject: Renamed initd and logrotate scripts to allow the same naming convention for the openvas-manager --- diff --git a/openvas-initd.sh b/openvas-initd.sh deleted file mode 100644 index c19d2a0..0000000 --- a/openvas-initd.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash - -# This is an implementation of a start-script for OpenVAS Scanner. - -# Make RedHat happy: -# -# chkconfig: - 91 9 -# Description: OpenVAS is a vulnerability Scanner -# - -### BEGIN INIT INFO -# Provides: openvas-scanner -# Required-Start: $local_fs $network $syslog -# Required-Stop: $local_fs $network $syslog -# Default-Start: -# Default-Stop: 0 1 2 3 4 5 6 -# Short-Description: start|stop|status|restart|condrestart|reloadplugins OpenVAS Scanner -# Description: control OpenVAS Scanner -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - -exec="/usr/sbin/openvassd" -prog="openvassd" -progname="openvas-scanner" -config=/etc/openvas/openvassd.conf -lockfile=/var/lock/subsys/openvas-scanner - -[ -e /etc/sysconfig/$progname ] && . /etc/sysconfig/$progname - - -rh_status() { - # run checks to determine if the service is running or use generic status - status -p /var/run/$prog.pid $progname -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -start() { - - # Build parameters - [ -n "$SCANNER_LISTEN" ] && PARAMS="$PARAMS --listen=$SCANNER_LISTEN" - [ -n "$SCANNER_PORT" ] && PARAMS="$PARAMS --port=$SCANNER_PORT" - [ -n "$SCANNER_SRCIP" ] && PARAMS="$PARAMS --src-ip=$SCANNER_SRCIP" - - grep -q ca_file $config >& /dev/null - if [ $? -ne 0 ]; then - echo "No certificate specified in configuration file. Did you run openvas-mkcert tool?" - exit 6 - fi - - CACERT=`grep ca_file $config | cut -d= -f2` - if [ \! -z "$CACERT" -a \! -f "$CACERT" ]; then - echo "Certificate specified in the configuration file not found. Did you run openvas-mkcert tool?" - exit 6 - fi - - echo "Starting $progname:" - daemon --pidfile=/var/run/$prog.pid $prog -q $PARAMS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch $lockfile - return $RETVAL -} - -stop() { - echo -n "Stopping $progname: " - killproc $prog - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f $lockfile - return $RETVAL -} - -restart() { - stop - start -} - -reloadplugins() { - echo -n "Reloading OpenVAS plugins: " - killproc $prog -HUP - echo -} - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - - stop) - rh_status_q || exit 0 - $1 - ;; - - restart) - $1 - ;; - - condrestart|try-restart) - rh_status_q || exit 0 - $1 - ;; - - reload) - ;; - - reloadplugins) - rh_status_q || exit 0 - $1 - ;; - - status) - status -p /var/run/$prog.pid $progname - ;; - - *) - echo "Usage: $0 {start|stop|status|restart|condrestart|reload|reloadplugins}" - exit 1 -esac - -exit 0 diff --git a/openvas-scanner.initd b/openvas-scanner.initd new file mode 100644 index 0000000..c19d2a0 --- /dev/null +++ b/openvas-scanner.initd @@ -0,0 +1,126 @@ +#!/bin/bash + +# This is an implementation of a start-script for OpenVAS Scanner. + +# Make RedHat happy: +# +# chkconfig: - 91 9 +# Description: OpenVAS is a vulnerability Scanner +# + +### BEGIN INIT INFO +# Provides: openvas-scanner +# Required-Start: $local_fs $network $syslog +# Required-Stop: $local_fs $network $syslog +# Default-Start: +# Default-Stop: 0 1 2 3 4 5 6 +# Short-Description: start|stop|status|restart|condrestart|reloadplugins OpenVAS Scanner +# Description: control OpenVAS Scanner +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +exec="/usr/sbin/openvassd" +prog="openvassd" +progname="openvas-scanner" +config=/etc/openvas/openvassd.conf +lockfile=/var/lock/subsys/openvas-scanner + +[ -e /etc/sysconfig/$progname ] && . /etc/sysconfig/$progname + + +rh_status() { + # run checks to determine if the service is running or use generic status + status -p /var/run/$prog.pid $progname +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +start() { + + # Build parameters + [ -n "$SCANNER_LISTEN" ] && PARAMS="$PARAMS --listen=$SCANNER_LISTEN" + [ -n "$SCANNER_PORT" ] && PARAMS="$PARAMS --port=$SCANNER_PORT" + [ -n "$SCANNER_SRCIP" ] && PARAMS="$PARAMS --src-ip=$SCANNER_SRCIP" + + grep -q ca_file $config >& /dev/null + if [ $? -ne 0 ]; then + echo "No certificate specified in configuration file. Did you run openvas-mkcert tool?" + exit 6 + fi + + CACERT=`grep ca_file $config | cut -d= -f2` + if [ \! -z "$CACERT" -a \! -f "$CACERT" ]; then + echo "Certificate specified in the configuration file not found. Did you run openvas-mkcert tool?" + exit 6 + fi + + echo "Starting $progname:" + daemon --pidfile=/var/run/$prog.pid $prog -q $PARAMS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $lockfile + return $RETVAL +} + +stop() { + echo -n "Stopping $progname: " + killproc $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $lockfile + return $RETVAL +} + +restart() { + stop + start +} + +reloadplugins() { + echo -n "Reloading OpenVAS plugins: " + killproc $prog -HUP + echo +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + + stop) + rh_status_q || exit 0 + $1 + ;; + + restart) + $1 + ;; + + condrestart|try-restart) + rh_status_q || exit 0 + $1 + ;; + + reload) + ;; + + reloadplugins) + rh_status_q || exit 0 + $1 + ;; + + status) + status -p /var/run/$prog.pid $progname + ;; + + *) + echo "Usage: $0 {start|stop|status|restart|condrestart|reload|reloadplugins}" + exit 1 +esac + +exit 0 diff --git a/openvas-scanner.logrotate b/openvas-scanner.logrotate new file mode 100644 index 0000000..026d7a1 --- /dev/null +++ b/openvas-scanner.logrotate @@ -0,0 +1,11 @@ +# logrotate for openvas +/var/log/openvas/*.log { + rotate 4 + weekly + compress + delaycompress + missingok + postrotate + /bin/kill -HUP `pidof openvassd` + endscript +} diff --git a/openvas-scanner.spec b/openvas-scanner.spec index 2ca2fd7..87f6024 100644 --- a/openvas-scanner.spec +++ b/openvas-scanner.spec @@ -1,15 +1,15 @@ Name: openvas-scanner Summary: Open Vulnerability Assessment (OpenVAS) Scanner Version: 3.2.2 -Release: 2%{?dist} +Release: 3%{?dist} URL: http://www.openvas.org License: GPLv2 Group: System Environment/Libraries Source0: http://wald.intevation.org/frs/download.php/852/%{name}-%{version}.tar.gz -Source1: openvas-initd.sh +Source1: openvas-scanner.initd Source2: openvassd.conf -Source3: openvas.logrotate +Source3: openvas-scanner.logrotate Source4: openvas-scanner.sysconfig Source5: openvas-nvt-sync-cron Source6: openvas-nvt-sync-cronjob @@ -210,6 +210,9 @@ fi #attr(644,root,root) _{_libdir}/openvas/plugins/*.nes %changelog +* Mon Mar 28 2011 Michal Ambroz - 3.2.2-3 +- rename intrd and logrotate to allow same naming convention for openvas-manager + * Sat Mar 26 2011 Michal Ambroz - 3.2.2-2 - patch to fix compile time errors about set but not used variables diff --git a/openvas.logrotate b/openvas.logrotate deleted file mode 100644 index 026d7a1..0000000 --- a/openvas.logrotate +++ /dev/null @@ -1,11 +0,0 @@ -# logrotate for openvas -/var/log/openvas/*.log { - rotate 4 - weekly - compress - delaycompress - missingok - postrotate - /bin/kill -HUP `pidof openvassd` - endscript -}