5
# Originally written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
6
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
7
# Modified for nessusd by Luca Andreucci <andrew@andrew.org>
8
# Further changes by Javier Fernandez-Sanguino <jfs@debian.org> for the
9
# Debian GNU/Linux distribution
10
# Even more changes for Debian GNU/Linux openvas-server package by
11
# Tim Brown <timb@nth-dimension.org.uk>
14
# Provides: openvas-server
15
# Required-Start: $remote_fs
16
# Required-Stop: $remote_fs
21
# Short-Description: Start and stop the OpenVAS daemon
22
# Description: Controls the main OpenVAS daemon "openvasd".
25
# daemon options (-D implied, not needed)
27
# time to wait for daemons death, in seconds
28
# don't set it too low or you might not let openvasd die gracefully
30
[ -r /etc/default/openvas-server ] && . /etc/default/openvas-server
32
DAEMON=/usr/sbin/openvasd
33
PIDFILE=/var/run/openvasd.pid
35
LABEL="OpenVAS daemon"
37
test -x $DAEMON || exit 0
42
# No pidfile, probably no daemon present
44
[ ! -f "$PIDFILE" ] && return 1
47
# No pid, probably no daemon present
48
[ -z "$pid" ] && return 1
50
[ ! -d /proc/$pid ] && return 1
51
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
53
[ "$cmd" != "$NAME" ] && return 1
59
echo -n "WARN: The (expected) certificate file $1 is not available." >&2
60
echo -n "The OpenVAS daemon might not start up." >&2
64
if [ -z "`grep ^ca_file /etc/openvas/openvasd.conf`" ] ; then
65
echo -n "WARN: The openvasd configuration file does not contain certificate settings. Have you run openvas-mkcert? (openvasd might not start)" >&2
67
CERTDIR=/var/lib/openvas/CA/
68
PRIVCERTDIR=/var/lib/openvas/private/CA/
69
for cert in cacert.pem servercert.pem; do
70
[ ! -r "$CERTDIR/$cert" ] && warn_cert_file "$CERTDIR/$cert"
72
for cert in cakey.pem serverkey.pem; do
73
[ ! -r "$PRIVCERTDIR/$cert" ] && warn_cert_file "$CERTDIR/$cert"
78
if [ ! -r /etc/openvas/openvasd.conf ] ; then
79
echo -n "ERROR: Cannot read openvas configuration file, are you root?" >&2
83
start-stop-daemon --start --exec $DAEMON -- $DAEMONOPTS -D 2>&1 >/dev/null
85
# If we don't sleep then running() might not see the pidfile
91
[ ! -e "$PIDFILE" ] && return
100
echo "Cannot kill $LABEL (pid=$pid)!"
110
echo -n "Starting $LABEL: "
111
if openvas_start && running ; then
119
echo -n "Stopping $LABEL: "
121
start-stop-daemon --stop --pidfile $PIDFILE --quiet --oknodo --exec $DAEMON
130
echo -n "Restarting $LABEL: "
132
start-stop-daemon --stop --pidfile $PIDFILE --quiet --oknodo --exec $DAEMON
138
if openvas_start && running ; then
146
echo -n "Reloading $LABEL configuration files: "
147
start-stop-daemon --stop --pidfile $PIDFILE --signal 1 --exec $DAEMON
166
echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|status}"