blob: a47928dc091ada39139b51e464ae26491d227ea9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
NESSUS_NAME="Nessus"
NESSUS_PRODUCT="nessus"
NESSUS_PREFIX="/opt/nessus"
NESSUS_SERVICE_NAME="nessusd"
NESSUS_SERVICE_BIN="${NESSUS_PREFIX}/sbin/nessus-service"
NESSUSD_BIN="${NESSUS_PREFIX}/sbin/nessusd"
pre_install() {
if [[ -f /usr/lib/systemd/system/${NESSUS_SERVICE_NAME}.service ]]; then
systemctl stop ${NESSUS_SERVICE_NAME}.service
fi
# Because we did not used to shut down on uninstall, we might have some random nessusd's running on the system (see NES-3585)
# We therefore need to do a killall before we install a new nessusd
# Look at all the proc entries and kill all nessus-service and nessusd processes with the correct path
for dir in /proc/[0-9]*; do
full_exe_path=$(readlink ${dir}/exe)
pid=$(basename ${dir})
if [[ "$full_exe_path" == "$NESSUS_SERVICE_BIN"* || "$full_exe_path" == "$NESSUSD_BIN"* ]]; then
kill $pid
fi
done
}
post_install() {
if [ "$NESSUS_PRODUCT" != "agent" ]; then
echo "Unpacking $NESSUS_NAME Core Components..."
${NESSUS_PREFIX}/sbin/nessuscli install ${NESSUS_PREFIX}/var/nessus/plugins-core.tar.gz
fi
test -f ${NESSUS_PREFIX}/etc/nessus/nessusd.conf || ${NESSUS_PREFIX}/sbin/nessusd -g
test -f ${NESSUS_PREFIX}/etc/nessus/nessus-fetch.rc && {
echo "Fetching the newest plugins from nessus.org..."
rm -f ${NESSUS_PREFIX}/lib/nessus/plugins/MD5
${NESSUS_PREFIX}/sbin/nessuscli update --plugins-only
${NESSUS_PREFIX}/sbin/nessusd -R
}
if [ "$NESSUS_PRODUCT" = "agent" ]; then
echo " - First, link this agent to the Nessus Manager with the '$NESSUS_PREFIX/sbin/nessuscli agent' command."
echo " Type '$NESSUS_PREFIX/sbin/nessuscli agent help' for more info."
echo " - You can start $NESSUS_NAME by typing systemctl start $NESSUS_SERVICE_NAME"
else
echo
echo " - You can start $NESSUS_NAME by typing systemctl start $NESSUS_SERVICE_NAME"
echo " - Then go to https://"$(hostname)":8834/ to configure your scanner"
echo
fi
echo " - See https://wiki.archlinux.org/index.php/Nessus for documentation."
echo
echo "### License Agreement ###"
echo "Please read the License Agreement at /usr/share/licenses/nessus/LICENSE"
echo "because it was automatically accepted for you in order to provide an"
echo "automatic install."
echo "By using Nessus you wil agree with the License Terms."
echo "If you don't agree with the License please uninstall nessus."
echo
ldconfig
}
post_upgrade() {
echo
echo "### License Agreement ###"
echo "Please read the License Agreement at /usr/share/licenses/nessus/LICENSE"
echo "because it was automatically accepted for you in order to provide an"
echo "automatic install."
echo "By using Nessus you wil agree with the License Terms."
echo "If you don't agree with the License please uninstall nessus."
echo
}
pre_remove() {
if [[ -f /usr/lib/systemd/system/${NESSUS_SERVICE_NAME}.service ]]; then
systemctl stop ${NESSUS_SERVICE_NAME}.service
fi
}
post_remove() {
test -f ${NESSUS_PREFIX}/sbin/nessusd || { \
rm -f ${NESSUS_PREFIX}/var/nessus/plugins-code.db
rm -f ${NESSUS_PREFIX}/var/nessus/plugins-desc.db
}
}
|