Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/openvas-scanner/files/, net-analyzer/openvas-scanner/
Date: Mon, 12 Aug 2019 04:54:40
Message-Id: 1565585662.8372f7b1ca8d51249a9594fdc5e8a24a73b13cc7.juippis@gentoo
1 commit: 8372f7b1ca8d51249a9594fdc5e8a24a73b13cc7
2 Author: Hasan ÇALIŞIR <hasan.calisir <AT> psauxit <DOT> com>
3 AuthorDate: Sat Aug 10 14:08:52 2019 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 12 04:54:22 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8372f7b1
7
8 net-analyzer/openvas-scanner: drop old 5.0.4
9
10 Package-Manager: Portage-2.3.69, Repoman-2.3.16
11 Signed-off-by: Hasan ÇALIŞIR <hasan.calisir <AT> psauxit.com>
12 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
13
14 net-analyzer/openvas-scanner/Manifest | 1 -
15 net-analyzer/openvas-scanner/files/first-start | 634 ---------------------
16 .../openvas-scanner/files/openvas-feed-sync | 627 --------------------
17 .../openvas-scanner/files/openvas-nvt-sync-cron | 39 --
18 .../files/openvas-scanner-4.0.3-mkcertclient.patch | 29 -
19 .../files/openvas-scanner-4.0.3-rulesdir.patch | 15 -
20 .../files/openvas-scanner-4.0.3-run.patch | 17 -
21 net-analyzer/openvas-scanner/files/openvassd | 22 -
22 .../openvas-scanner/files/openvassd-daemon.conf | 26 -
23 net-analyzer/openvas-scanner/files/openvassd.init | 25 -
24 .../openvas-scanner/files/openvassd.logrotate | 11 -
25 .../openvas-scanner/files/openvassd.service | 16 -
26 .../openvas-scanner/files/openvassd.tmpfiles.d | 1 -
27 .../openvas-scanner-5.0.4-r1.ebuild | 72 ---
28 .../openvas-scanner/openvas-scanner-5.1.3.ebuild | 4 -
29 15 files changed, 1539 deletions(-)
30
31 diff --git a/net-analyzer/openvas-scanner/Manifest b/net-analyzer/openvas-scanner/Manifest
32 index 2bb7d462564..12763409b46 100644
33 --- a/net-analyzer/openvas-scanner/Manifest
34 +++ b/net-analyzer/openvas-scanner/Manifest
35 @@ -1,2 +1 @@
36 -DIST openvas-scanner-5.0.4.tar.gz 236282 BLAKE2B 3105afe0fd819773b33c8194e0addaad70af4692578fe3bfbd76166004ca99e25f2f22a946810fe52da747242f1e45bae00766c4687676ec70df2d7349fa4509 SHA512 51267f832a104897a497b5dc71d1b804de4db77742e2234d111a00b1e0e01536613b16ff48d23a37013178b016b39408a25d18a694980c7e6fc600824e05e149
37 DIST openvas-scanner-5.1.3.tar.gz 254159 BLAKE2B d90fa15e143ead53abce66f933a3a4cac327176cca0f23bd88fe771ed7726b1891784ae980644c8335e560d348753115e43cfae83af9704e2d1d02827163563f SHA512 5712ab275058877cfd656e268ed09c81db6617ae247c17092f1fcd037f692f2018daf21b09b82401f99a7361bb485f0e0f7d63f8ff2387839cfdd5a3aaf8424e
38
39 diff --git a/net-analyzer/openvas-scanner/files/first-start b/net-analyzer/openvas-scanner/files/first-start
40 deleted file mode 100755
41 index 95811a56b19..00000000000
42 --- a/net-analyzer/openvas-scanner/files/first-start
43 +++ /dev/null
44 @@ -1,634 +0,0 @@
45 -#!/bin/bash
46 -# Copyright 1999-2019 Gentoo Authors
47 -# Distributed under the terms of the GNU General Public License v2
48 -# This is OpenVAS first-start/check-setup script which make things automatically for first time use.
49 -
50 -
51 -##################################################################################################
52 -# If you use systemd or init.d(open-rc) for OpenVAS daemons you don't need to set below settings.#
53 -# If you don't use any of them you can set the below command args to start daemons manually. #
54 -##################################################################################################
55 -
56 -# OpenVAS Manager command args
57 -OPENVAS_MANAGER_OPTIONS="" # e.g --foreground
58 -OPENVAS_MANAGER_PORT="--port=9390" # Manager listen port
59 -OPENVAS_MANAGER_LISTEN_ADDRESS="--listen=127.0.0.1" # Manager listen address
60 -OPENVAS_MANAGER_SCANNER_HOST="--scanner-host=/var/run/openvassd.sock" # Scanner unix socket
61 -OPENVAS_MANAGER_GNUTLS_PRIORITIES="--gnutls-priorities=SECURE256:+SUITEB192:+SECURE192:+SECURE128:+SUITEB128:-MD5:-SHA1:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-SSL3.0"
62 -
63 -# OpenVAS Scanner command args
64 -OPENVAS_SCANNER_OPTIONS="" # e.g --foreground
65 -OPENVAS_SCANNER_LISTEN_SOCKET="--unix-socket=/var/run/openvassd.sock" # Scanner listen socket
66 -
67 -# OpenVAS Security Assistant command args for reverse proxying | SSL PassThrough
68 -OPENVAS_SECURITY_ASSISTANT_OPTIONS="--no-redirect" # Don't listen port 80 anymore for reverse proxy
69 -OPENVAS_SECURITY_ASSISTANT_LISTEN_ADDRESS="--listen=127.0.0.1" # WebUI adress
70 -OPENVAS_SECURITY_ASSISTANT_LISTEN_PORT="--port=9392" # WebUI Port
71 -OPENVAS_SECURITY_ASSISTANT_MANAGER_LISTEN_ADDRESS="--mlisten=127.0.0.1" # WebUI Manager Address
72 -OPENVAS_SECURITY_ASSISTANT_MANAGER_PORT="--mport=9390" # WebUI Manager Port
73 -OPENVAS_SECURITY_ASSISTANT_GNUTLS_PRIORITIES="--gnutls-priorities=NORMAL" # TLS Settings
74 -
75 -#####################################################################################################
76 -
77 -# Update Environment
78 -source /etc/profile &>/dev/null
79 -source /etc/environment &>/dev/null
80 -source ~/.bash_profile &>/dev/null
81 -
82 -# Check the needed executables.They are in our environment and have +x?
83 -if ! [ -x "$(command -v openvasmd)" ] ||
84 - ! [ -x "$(command -v openvassd)" ] ||
85 - ! [ -x "$(command -v redis-server)" ] ||
86 - ! [ -x "$(command -v openvas-manage-certs)" ] ||
87 - ! [ -x "$(command -v greenbone-nvt-sync)" ] ||
88 - ! [ -x "$(command -v greenbone-scapdata-sync)" ] ||
89 - ! [ -x "$(command -v greenbone-certdata-sync)" ]; then
90 - path="1"
91 - else
92 - path="0"
93 -fi
94 -
95 -# Check Security-Assistant is exist
96 -if ! [ -x "$(command -v gsad)" ]; then
97 - gsad="1"
98 - else
99 - gsad="0"
100 -fi
101 -# Executables are not in our environment
102 -if [ $path -eq 1 ]; then
103 - echo "Can't find executables! If you installed OpenVAS to specific location e.g. /opt"
104 - echo "please add these PATHS to /etc/profile,also sure that they are executable"
105 - exit 1
106 -fi
107 -
108 -# Check systemd and enable services for Gentoo/Linux
109 -if command -v systemctl &>/dev/null; then
110 - systemctl="0"
111 - echo "systemd found."
112 - systemctl enable openvas-scanner.service &>/dev/null
113 - if [ $? -eq 0 ]; then
114 - echo "systemd.Gentoo --> openvas-scanner.service enabled."
115 - fi
116 - systemctl enable gvmd.service &>/dev/null
117 - if [ $? -eq 0 ]; then
118 - echo "systemd.Gentoo --> gvmd.service enabled."
119 - fi
120 - systemctl enable gsa.service &>/dev/null
121 - if [ $? -eq 0 ]; then
122 - echo "systemd.Gentoo --> gsa.service enabled."
123 - fi
124 - else
125 - systemctl="1"
126 -fi
127 -
128 -# Check open-rc if exist
129 -if command -v rc-service &>/dev/null; then
130 - open_rc="0"
131 - else
132 - open_rc="1"
133 -fi
134 -
135 -# open-rc variables
136 -if [ $systemctl -eq 1 ] && [ $open_rc -eq 0 ]; then
137 - echo "open-rc found."
138 - scanner_init="0"
139 - manager_init="0"
140 - assistant_init="0"
141 - redis_init="0"
142 -fi
143 -
144 -# Check status of OpenVAS-Scanner systemd unit
145 -if [ $systemctl -eq 0 ] &&
146 - ([ "$(systemctl is-active openvas-scanner.service)" = "active" ] ||
147 - [ "$(systemctl list-unit-files | grep 'enabled' | grep 'openvas-scanner.service' | awk '{print $1}')" = "openvas-scanner.service" ]); then
148 - scanner="0"
149 - else
150 - scanner="1"
151 -fi
152 -
153 -# Check status of OpenVAS-Manager systemd unit
154 -if [ $systemctl -eq 0 ] &&
155 - ([ "$(systemctl is-active gvmd.service)" = "active" ] ||
156 - [ "$(systemctl list-unit-files | grep 'enabled' | grep 'gvmd.service' | awk '{print $1}')" = "gvmd.service" ]); then
157 - manager="0"
158 - else
159 - manager="1"
160 -fi
161 -
162 -# Check status of OpenVAS-Assistant systemd unit
163 -if [ $systemctl -eq 0 ] &&
164 - ([ "$(systemctl is-active gsa.service)" = "active" ] ||
165 - [ "$(systemctl list-unit-files | grep 'enabled' | grep 'gsa.service' | awk '{print $1}')" = "gsa.service" ]); then
166 - assistant="0"
167 - else
168 - assistant="1"
169 -fi
170 -
171 -# Check status of Redis systemd unit
172 -if [ $systemctl -eq 0 ] &&
173 - ([ "$(systemctl is-active redis.service)" = "active" ] ||
174 - [ "$(systemctl list-unit-files | grep 'enabled' | grep 'redis.service' | awk '{print $1}')" = "redis.service" ]); then
175 - redis="0"
176 - else
177 - redis="1"
178 -fi
179 -
180 -# We need to find correct service name for restarting.
181 -if [ $scanner -eq 1 ] || [ $manager -eq 1 ] || [ $assistant -eq 1 ] || [ $redis -eq 1 ]; then
182 - WHICHM="ExecStart=$(type openvasmd | awk '{print $3}')"
183 - WHICHS="ExecStart=$(type openvassd | awk '{print $3}')"
184 - WHICHA="ExecStart=$(type gsad | awk '{print $3}')"
185 - WHICHR="ExecStart=$(type redis-server | awk '{print $3}')"
186 -
187 - # If you have unordinary systemd path you can add here
188 - DIR="/lib/systemd/system/
189 - /etc/systemd/system/
190 - /usr/lib/systemd/system/
191 - /usr/local/lib/systemd/system/"
192 -
193 - # Find OpenVAS daemons systemd files if exist
194 - for i in $DIR; do
195 - if [ -d "$i" ]; then
196 - grep -rilnw "$i" -e "$WHICHM" | cut -d: -f1 | grep -oP "$i\K.*" &>>/tmp/openvas_GVM_manager_service.out
197 - grep -rilnw "$i" -e "$WHICHS" | cut -d: -f1 | grep -oP "$i\K.*" &>>/tmp/openvas_GVM_scanner_service.out
198 - grep -rilnw "$i" -e "$WHICHA" | cut -d: -f1 | grep -oP "$i\K.*" &>>/tmp/openvas_GVM_assistant_service.out
199 - grep -rilnw "$i" -e "$WHICHR" | cut -d: -f1 | grep -oP "$i\K.*" &>>/tmp/openvas_GVM_redis_service.out
200 - fi
201 - done
202 -
203 - manager_service="$(while IFS= read -r service; do
204 - systemctl list-unit-files | grep -P "(^|\s)\K$service(?=\s|$)" | awk '{print $1}'
205 - done < /tmp/openvas_GVM_manager_service.out)"
206 - scanner_service="$(while IFS= read -r service; do
207 - systemctl list-unit-files | grep -P "(^|\s)\K$service(?=\s|$)" | awk '{print $1}'
208 - done < /tmp/openvas_GVM_scanner_service.out)"
209 - assistant_service="$(while IFS= read -r service; do
210 - systemctl list-unit-files | grep -P "(^|\s)\K$service(?=\s|$)" | awk '{print $1}'
211 - done < /tmp/openvas_GVM_assistant_service.out)"
212 - redis_service="$(while IFS= read -r service; do
213 - systemctl list-unit-files | grep -P "(^|\s)\K$service(?=\s|$)" | awk '{print $1}'
214 - done < /tmp/openvas_GVM_redis_service.out)"
215 -
216 - rm -rf /tmp/openvas_GVM*
217 - COUNTM=$(wc -w <<< "${manager_service}")
218 - COUNTS=$(wc -w <<< "${scanner_service}")
219 - COUNTA=$(wc -w <<< "${assistant_service}")
220 - COUNTR=$(wc -w <<< "${redis_service}")
221 -
222 - if [ -n "$manager_service" ] && [ $manager -eq 1 ]; then
223 - if [ "$(systemctl list-unit-files | grep 'enabled' | grep $manager_service | awk '{print $1}')" = "$manager_service" ]; then
224 - echo "systemd --> OpenVAS Manager '$manager_service' found."
225 - else
226 - echo "systemd --> '$manager_service' found but not enabled."
227 - echo "are you sure this is the correct systemd service for Openvas Manager"
228 - while true; do
229 - read -n 1 -p "do you want to enable '$manager_service'? --> (Y)es | (N)o | (Q)uit" answer
230 - echo
231 - case $answer in
232 - [Yy]* ) systemctl enable "$manager_service" &>/dev/null; echo "systemd --> '$manager_service' enabled"; break;;
233 - [Nn]* ) manager_service=""; echo "it seems you are not sure.ok i don't use $manager_service"; break;;
234 - [Qq]* ) exit;;
235 - * ) echo "Please answer yes,no or quit.";;
236 - esac
237 - done
238 - fi
239 - fi
240 -
241 - if [ -n "$scanner_service" ] && [ $scanner -eq 1 ]; then
242 - if [ "$(systemctl list-unit-files | grep 'enabled' | grep $scanner_service | awk '{print $1}')" = "$scanner_service" ]; then
243 - echo "systemd --> OpenVAS Scanner '$scanner_service' found."
244 - else
245 - echo "systemd --> '$scanner_service' found but not enabled."
246 - echo "are you sure this is the correct systemd service for Openvas Scanner"
247 - while true; do
248 - read -n 1 -p "do you want to enable '$scanner_service'? --> (Y)es | (N)o | (Q)uit" answer
249 - echo
250 - case $answer in
251 - [Yy]* ) systemctl enable "$scanner_service" &>/dev/null; echo "systemd --> '$scanner_service' enabled"; break;;
252 - [Nn]* ) scanner_service=""; echo "it seems you are not sure.ok i don't use $scanner_service"; break;;
253 - [Qq]* ) exit;;
254 - * ) echo "Please answer yes,no or quit.";;
255 - esac
256 - done
257 - fi
258 - fi
259 -
260 - if [ -n "$assistant_service" ] && [ $scanner -eq 1 ]; then
261 - if [ "$(systemctl list-unit-files | grep 'enabled' | grep $assistant_service | awk '{print $1}')" = "$assistant_service" ]; then
262 - echo "systemd --> GSA '$assistant_service' found."
263 - else
264 - echo "systemd --> '$assistant_service' found but not enabled."
265 - echo "are you sure this is the correct systemd service for Greenbone Security Assistant"
266 - while true; do
267 - read -n 1 -p "do you want to enable '$assistant_service'? --> (Y)es | (N)o | (Q)uit" answer
268 - echo
269 - case $answer in
270 - [Yy]* ) systemctl enable "$assistant_service" &>/dev/null; echo "systemd --> '$assistant_service' enabled"; break;;
271 - [Nn]* ) assistant_service=""; echo "it seems you are not sure.ok i don't use $assistant_service"; break;;
272 - [Qq]* ) exit;;
273 - * ) echo "please answer yes,no or quit.";;
274 - esac
275 - done
276 - fi
277 - fi
278 -
279 - if [ -n "$redis_service" ] && [ $scanner -eq 1 ]; then
280 - if [ "$(systemctl list-unit-files | grep 'enabled' | grep $redis_service | awk '{print $1}')" = "$redis_service" ]; then
281 - echo "systemd --> redis '$redis_service' found."
282 - else
283 - echo "systemd --> '$redis_service' found but not enabled."
284 - echo "are you sure this is the correct systemd service for redis-server"
285 - while true; do
286 - read -n 1 -p "do you want to enable '$redis_service'? --> (Y)es | (N)o | (Q)uit" answer
287 - echo
288 - case $answer in
289 - [Yy]* ) systemctl enable "$redis_service" &>/dev/null; echo "systemd --> '$redis_service' enabled"; break;;
290 - [Nn]* ) redis_service=""; echo "it seems you are not sure.ok i don't use $redis_service"; break;;
291 - [Qq]* ) exit;;
292 - * ) echo "please answer yes,no or quit.";;
293 - esac
294 - done
295 - fi
296 - fi
297 -
298 - if [ $COUNTM -gt 1 ] || [ $COUNTS -gt 1 ] || [ $COUNTR -gt 1 ]; then
299 - echo "you have more than one enabled systemd service for single daemon"
300 - echo " check OpenVAS and Redis systemd unit files to fix it"
301 - exit 1
302 - fi
303 -fi
304 -
305 -restart_redis () {
306 -if [ $redis -eq 0 ]; then
307 - systemctl restart redis.service &>/dev/null
308 - if [ $? -eq 0 ]; then
309 - echo "systemd --> redis.service is restarted."
310 - else
311 - echo "systemd --> redis.service cannot restarted."
312 - exit 1
313 - fi
314 -elif [[ -n "$redis_service" ]]; then
315 - systemctl restart "$redis_service" &>/dev/null
316 - if [ $? -eq 0 ]; then
317 - echo "systemd --> $redis_service is restarted."
318 - else
319 - echo "systemd --> $redis_service cannot restarted."
320 - exit 1
321 - fi
322 -elif [[ -n "$redis_init" ]]; then
323 - rc-service redis stop
324 - sleep 5
325 - rc-service redis start
326 - if [ $? -eq 0 ]; then
327 - echo "open-rc --> redis is restarted."
328 - else
329 - echo "open-rc --> redis cannot restarted."
330 - exit 1
331 - fi
332 -fi
333 -}
334 -
335 -build_nvt () {
336 -if ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" &>/dev/null; then
337 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
338 - openvassd --foreground --only-cache &>/dev/null
339 - if [ $? -eq 0 ]; then
340 - echo "building NVT cache is done."
341 - else
342 - echo "building NVT cache is failed.."
343 - exit 1
344 - fi
345 - else
346 - openvassd --foreground --only-cache &>/dev/null
347 - if [ $? -eq 0 ]; then
348 - echo "building NVT cache is done."
349 - else
350 - echo "building NVT cache is failed.."
351 - exit 1
352 - fi
353 -fi
354 -}
355 -
356 -create_user () {
357 -GREEN="`tput setaf 2`"
358 -RED="`tput setaf 1`"
359 -norm="`tput sgr0`"
360 -echo "creating WebUI User.."
361 -openvasmd --create-user=admin --role=Admin &>/tmp/openvas_user.out
362 -if [ $? -eq 0 ]; then
363 - username="admin"
364 - password="$(cat /tmp/openvas_user.out | awk '{print $5}' | cut -c2-)"
365 - echo "${RED}!WebUI Address : ${GREEN}127.0.0.1:9392"
366 - echo "${RED}!WebUI Username: ${GREEN}$username"
367 - echo "${RED}!WebUI Password: ${GREEN}${password%??}${norm}"
368 - else
369 - echo "$(cat /tmp/openvas_user.out)"
370 - echo "these are active users for WebUI"
371 - openvasmd --get-users
372 -fi
373 -rm -rf /tmp/openvas_user.out
374 -}
375 -
376 -# Redis & OpenVAS Scanner socket connection check for Gentoo/Linux
377 -if [[ -e /etc/redis.conf ]]; then
378 - if [ "$(openvassd -s | grep 'kb_location' | awk '{print $3}')" = "$(cat /etc/redis.conf | grep -P '(^|\s)\Kunixsocket(?=\s|$)' | awk '{print $2}')" ]; then
379 - echo "redis server properly configured."
380 - else
381 - redis_sock="$(openvassd -s | grep 'kb_location' | awk '{print $3}')"
382 - echo "redis server is not properly configured."
383 - echo "be sure redis server listening unix socket at $redis_sock"
384 - echo "you can find example redis.conf file in /etc/openvas/redis.conf.example"
385 - exit 1
386 - fi
387 -fi
388 -
389 -# Redis & OpenVAS Scanner socket connection check for other linux distros
390 -if [[ -e /etc/redis/redis.conf ]]; then
391 - if [ "$(openvassd -s | grep 'kb_location' | awk '{print $3}')" = "$(cat /etc/redis/redis.conf | grep -P '(^|\s)\Kunixsocket(?=\s|$)' | awk '{print $2}')" ]; then
392 - echo "redis server properly configured."
393 - else
394 - redis_sock="$(openvassd -s | grep 'kb_location' | awk '{print $3}')"
395 - echo "redis server is not properly configured."
396 - echo "be sure redis server listening unix socket at $redis_sock"
397 - exit 1
398 - fi
399 -fi
400 -
401 -# Create certificates for fresh install
402 -openvas-manage-certs -a &>/dev/null
403 -if [ $? -eq 0 ]; then
404 - echo "certificates created."
405 -
406 -elif [ "$(openvas-manage-certs -a | grep -ow 'Existing')" = "Existing" ]; then
407 - echo "certificates already created."
408 -
409 -else
410 - echo "certificates cannot created."
411 - exit 1
412 -fi
413 -
414 -# Start to update FEED & First NVT.
415 -try=0
416 -until [ $try -ge 5 ]; do
417 - greenbone-nvt-sync &>/dev/null && break
418 - echo "can't connected! trying to update greenbone-nvt again.."
419 - try=$[$try+1]
420 - sleep 30
421 -done
422 -
423 -# Check status
424 -if [ $? -eq 0 ]; then
425 - echo "greenbone-nvt-sync is done."
426 - # Avoid your IP temporary banned because of multiple connection
427 - sleep 5
428 - # Try to update scapdata.
429 - try=0
430 - until [ $try -ge 5 ]; do
431 - greenbone-scapdata-sync &>/dev/null && break
432 - echo "can't connected! trying to update greenbone-scapdata again.."
433 - try=$[$try+1]
434 - sleep 30
435 - done
436 - # Check status
437 - if [ $? -eq 0 ]; then
438 - echo "greenbone-scapdata-sync is done."
439 - # Avoid your IP temporary banned because of multiple connection
440 - sleep 5
441 - # Try to update certdata
442 - try=0
443 - until [ $try -ge 5 ]; do
444 - greenbone-certdata-sync &>/dev/null && break
445 - echo "can't connected! Trying to update greenbone-certdata again.."
446 - try=$[$try+1]
447 - sleep 30
448 - done
449 - # Check status
450 - if [ $? -eq 0 ]; then
451 - echo "greenbone-certdata-sync is done."
452 - echo "building NVT cache this will take some time.."
453 - build_nvt
454 - # Check OpenVAS-Scanner is running
455 - if ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" &>/dev/null; then
456 - echo "OpenVAS-Scanner is running."
457 - echo "building Database this will take some time.."
458 - openvasmd --rebuild --progress &>/dev/null
459 - elif [ $scanner -eq 0 ]; then
460 - # Start OpenVAS-Scanner systemd unit & Rebuild Cache
461 - echo "systemd --> OpenVAS-Scanner is not running! trying to up.."
462 - systemctl start openvas-scanner.service &>/dev/null
463 - if [ $? -eq 0 ]; then
464 - # Wait for initialize
465 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
466 - sleep 15
467 - echo "waiting for OpenVAS-Scanner to become ready.."
468 - done
469 - echo "systemd --> openvas-scanner.service started and waiting for connection."
470 - echo "building database this will take some time.."
471 - # Rebuild Cache
472 - openvasmd --rebuild --progress &>/dev/null
473 - else
474 - echo "systemd --> openvas-scanner.service cannot started.."
475 - exit 1
476 - fi
477 - elif [[ -n "$scanner_service" ]]; then
478 - echo "systemd --> OpenVAS-Scanner is down! trying to up.."
479 - systemctl start "$scanner_service" &>/dev/null
480 - if [ $? -eq 0 ]; then
481 - # Wait for initialize
482 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
483 - sleep 15
484 - echo "waiting for OpenVAS-Scanner to become ready.."
485 - done
486 - echo "systemd --> $scanner_service is started and waiting for connection."
487 - echo "building database this will take some time.."
488 - # Rebuild Cache
489 - openvasmd --rebuild --progress &>/dev/null
490 - else
491 - echo "systemd --> $scanner_service cannot started.."
492 - exit 1
493 - fi
494 - elif [[ -n "$scanner_init" ]]; then
495 - # Start OpenVAS-Scanner with init.d (open-rc) & Rebuild Cache
496 - echo "open-rc --> OpenVAS-Scanner is down! trying to up.."
497 - rc-service openvas-scanner start &>/dev/null
498 - if [ $? -eq 0 ]; then
499 - # Wait for initialize
500 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
501 - sleep 15
502 - echo "waiting for OpenVAS-Scanner to become ready.."
503 - done
504 - echo "rc-service --> openvas-scanner started and waiting for connection."
505 - echo "building database this will take some time.."
506 - # Rebuild Cache
507 - openvasmd --rebuild --progress &>/dev/null
508 - else
509 - echo "rc-service --> openvas-scanner cannot started.."
510 - exit 1
511 - fi
512 - else
513 - echo "OpenVAS-Scanner is not running! Trying to up.."
514 - openvassd "$OPENVAS_SCANNER_OPTIONS" "$OPENVAS_SCANNER_LISTEN_SOCKET" &>/dev/null
515 - # Wait for initialize
516 - if [ $? -eq 0 ]; then
517 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
518 - sleep 15
519 - echo "waiting for OpenVAS-Scanner to become ready.."
520 - done
521 - else
522 - echo "OpenVAS Scanner cannot started manually.."
523 - exit 1
524 - fi
525 - echo "OpenVAS-Scanner started manually and waiting for connection."
526 - echo "building database this will take some time.."
527 - # Rebuild Cache
528 - openvasmd --rebuild --progress &>/dev/null
529 - fi
530 - # Check status
531 - if [ $? -eq 0 ]; then
532 - echo "building database is done"
533 - create_user
534 - # Restart OpenVAS-Scanner
535 - if [ $scanner -eq 0 ]; then
536 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
537 - restart_redis
538 - sleep 3
539 - systemctl restart openvas-scanner.service &>/dev/null
540 - elif [[ -n "$scanner_service" ]]; then
541 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
542 - restart_redis
543 - sleep 3
544 - systemctl restart "$scanner_service" &>/dev/null
545 - elif [[ -n "$scanner_init" ]]; then
546 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
547 - restart_redis
548 - sleep 3
549 - rc-service openvas-scanner start &>/dev/null
550 - else
551 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
552 - restart_redis
553 - sleep 3
554 - openvassd "$OPENVAS_SCANNER_OPTIONS" "$OPENVAS_SCANNER_LISTEN_SOCKET" &>/dev/null
555 - fi
556 - if [ $? -eq 0 ]; then
557 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
558 - sleep 10
559 - echo "waiting for OpenVAS-Scanner to become ready.."
560 - done
561 - echo "OpenVAS-Scanner is restarted."
562 - # Restart OpenVAS-Manager
563 - if [ $manager -eq 0 ]; then
564 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvasmd(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
565 - sleep 5
566 - systemctl restart gvmd.service &>/dev/null
567 - if [ $? -eq 0 ]; then
568 - success="0"
569 - echo "systemd --> gvmd.service is restarted."
570 - echo "OpenVAS setup is ok."
571 - else
572 - echo "systemd --> gvmd.service cannot restarted."
573 - echo "OpenVAS setup is not ok!"
574 - exit 1
575 - fi
576 - elif [[ -n "$manager_service" ]]; then
577 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvasmd(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
578 - sleep 5
579 - systemctl restart "$manager_service" &>/dev/null
580 - if [ $? -eq 0 ]; then
581 - success="0"
582 - echo "systemd --> $manager_service is restarted"
583 - echo "OpenVAS setup is ok."
584 - else
585 - echo "systemd --> $manager_service cannot restarted"
586 - echo "OpenVAS setup is not ok!"
587 - exit 1
588 - fi
589 - elif [[ -n "$manager_init" ]]; then
590 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvasmd(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
591 - sleep 5
592 - rc-service gvmd start &>/dev/null
593 - if [ $? -eq 0 ]; then
594 - success="0"
595 - echo "open-rc --> gvmd is restarted"
596 - echo "OpenVAS setup is ok."
597 - else
598 - echo "open-rc --> gvmd cannot restarted"
599 - echo "OpenVAS setup is not ok!"
600 - exit 1
601 - fi
602 - else
603 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvasmd(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
604 - sleep 5
605 - openvasmd "$OPENVAS_MANAGER_OPTIONS" "$OPENVAS_MANAGER_PORT" "$OPENVAS_MANAGER_LISTEN_ADDRESS" "$OPENVAS_MANAGER_SCANNER_HOST" "$OPENVAS_MANAGER_GNUTLS_PRIORITIES" &>/dev/null
606 - if [ $? -eq 0 ]; then
607 - success="0"
608 - echo "OpenVAS-Manager is restarted manually"
609 - echo "OpenVAS setup is ok."
610 - else
611 - echo "OpenVAS-Manager cannot restarted"
612 - echo "OpenVAS setup is not ok!"
613 - exit 1
614 - fi
615 - fi
616 - else
617 - echo "OpenVAS setup is not ok! OpenVAS-scanner cannot restarted."
618 - fi
619 - else
620 - echo "OpenVAS setup is not ok! OpenVAS database build failed."
621 - fi
622 - else
623 - echo "OpenVAS setup is not ok! OpenVAS Certdata sync failed."
624 - fi
625 - else
626 - echo "OpenVAS setup is not ok! OpenVAS Scapdata sync failed."
627 - fi
628 - else
629 - echo "OpenVAS setup is not ok! OpenVAS NVT sync update failed."
630 -fi
631 -
632 -# Restart WebUI
633 -if [[ -n "$success" ]] && [ $gsad -eq 0 ]; then
634 - WHICHA="$(type gsad | awk '{print $3}')"
635 - if [ $assistant -eq 0 ]; then
636 - # Time to restart OpenVAS-Security Assistant
637 - ps aux | grep -v "grep" | grep -P "(^|\s)\K$WHICHA(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
638 - sleep 5
639 - systemctl restart gsa.service &>/dev/null
640 - if [ $? -eq 0 ]; then
641 - echo "systemd --> gsa.service (OpenVAS WebUI) is restarted and ready for connection"
642 - else
643 - echo "systemd --> gsa.service (OpenVAS-WebUI) cannot restarted"
644 - fi
645 - elif [[ -n "$assistant_service" ]]; then
646 - if [ $COUNTA -eq 1 ]; then
647 - ps aux | grep -v "grep" | grep -P "(^|\s)\K$WHICHA(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
648 - sleep 5
649 - systemctl restart "$assistant_service" &>/dev/null
650 - if [ $? -eq 0 ]; then
651 - echo "systemd --> $assistant_service (OpenVAS WebUI) is restarted and ready for connection"
652 - else
653 - echo "systemd --> $assistan_service (OpenVAS WebUI) cannot restarted."
654 - fi
655 - else
656 - echo "systemd --> OpenVAS WebUI cannot restarted! you have multiple enabled systemd services ($assistant_service)"
657 - exit 1
658 - fi
659 - elif [[ -n "$assistant_init" ]]; then
660 - ps aux | grep -v "grep" | grep -P "(^|\s)\K$WHICHA(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
661 - sleep 5
662 - rc-service gsa start &>/dev/null
663 - if [ $? -eq 0 ]; then
664 - echo "open-rc --> gsa (OpenVAS WebUI) is restarted"
665 - else
666 - echo "open-rc --> gsa (OpenVAS WebUI) cannot restarted."
667 - fi
668 - else
669 - ps aux | grep -v "grep" | grep -P "(^|\s)\K$WHICHA(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
670 - sleep 5
671 - gsad "$OPENVAS_SECURITY_ASSISTANT_OPTIONS" "$OPENVAS_SECURITY_ASSISTANT_LISTEN_ADDRESS" "$OPENVAS_SECURITY_ASSISTANT_LISTEN_PORT" "$OPENVAS_SECURITY_ASSISTANT_MANAGER_LISTEN_ADDRESS" "$OPENVAS_SECURITY_ASSISTANT_MANAGER_LISTEN_PORT" "$OPENVAS_SECURITY_ASSISTANT_GNUTLS_PRIORITIES" &>/dev/null
672 - if [ $? -eq 0 ]; then
673 - echo "OpenVAS WebUI is restarted"
674 - else
675 - echo "OpenVAS WebUI cannot restarted"
676 - fi
677 - fi
678 -fi
679
680 diff --git a/net-analyzer/openvas-scanner/files/openvas-feed-sync b/net-analyzer/openvas-scanner/files/openvas-feed-sync
681 deleted file mode 100755
682 index de1c69038ab..00000000000
683 --- a/net-analyzer/openvas-scanner/files/openvas-feed-sync
684 +++ /dev/null
685 @@ -1,627 +0,0 @@
686 -#!/bin/bash
687 -# Copyright 1999-2019 Gentoo Authors
688 -# Distributed under the terms of the GNU General Public License v2
689 -# This is OpenVAS cron script that updates feed and reload daemons.
690 -# Hasan ÇALIŞIR hsntgm@×××××.com | proxy maintainer
691 -
692 -# Mail settings
693 -MAIL_TO="root"
694 -MAIL_SUBJECT="CronJob-OpenVAS"
695 -
696 -# If you don't use systemd or open-rc for OpenVAS daemons you can set start command args here
697 -# while we manually start/restart them.
698 -####################################################################################################
699 -
700 -# OpenVAS Manager command args
701 -OPENVAS_MANAGER_OPTIONS="" # e.g --foreground
702 -OPENVAS_MANAGER_PORT="--port=9390" # Manager listen port
703 -OPENVAS_MANAGER_LISTEN_ADDRESS="--listen=127.0.0.1" # Manager listen address
704 -OPENVAS_MANAGER_SCANNER_HOST="--scanner-host=/var/run/openvassd.sock" # Scanner unix socket
705 -OPENVAS_MANAGER_GNUTLS_PRIORITIES="--gnutls-priorities=SECURE256:+SUITEB192:+SECURE192:+SECURE128:+SUITEB128:-MD5:-SHA1:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-SSL3.0"
706 -
707 -# OpenVAS Scanner command args
708 -OPENVAS_SCANNER_OPTIONS="" # e.g --foreground
709 -OPENVAS_SCANNER_LISTEN_SOCKET="--unix-socket=/var/run/openvassd.sock" # Scanner listen socket
710 -
711 -# OpenVAS Security Assistant command args for reverse proxying | SSL PassThrough
712 -OPENVAS_SECURITY_ASSISTANT_OPTIONS="--no-redirect" # Don't listen port 80 anymore
713 -OPENVAS_SECURITY_ASSISTANT_LISTEN_ADDRESS="--listen=127.0.0.1" # WebUI adress
714 -OPENVAS_SECURITY_ASSISTANT_LISTEN_PORT="--port=9392" # WebUI Port
715 -OPENVAS_SECURITY_ASSISTANT_MANAGER_LISTEN_ADDRESS="--mlisten=127.0.0.1" # WebUI Manager Address
716 -OPENVAS_SECURITY_ASSISTANT_MANAGER_PORT="--mport=9390" # WebUI Manager Port
717 -OPENVAS_SECURITY_ASSISTANT_GNUTLS_PRIORITIES="--gnutls-priorities=NORMAL" # TLS Settings
718 -
719 -#####################################################################################################
720 -
721 -# Update Environment
722 -source /etc/profile &>/dev/null
723 -source /etc/environment &>/dev/null
724 -source ~/.bash_profile &>/dev/null
725 -
726 -# Check the needed executables if they are in our environment and have +x
727 -if ! [ -x "$(command -v openvasmd)" ] || ! [ -x "$(command -v openvassd)" ] || ! [ -x "$(command -v redis-server)" ]; then
728 - path="1"
729 - else
730 - path="0"
731 -fi
732 -
733 -# Check Security-Assistant is exist
734 -if ! [ -x "$(command -v gsad)" ]; then
735 - gsad="1"
736 - else
737 - gsad="0"
738 -fi
739 -
740 -# Executables are not in our environment
741 -if [ $path -eq 1 ]; then
742 - echo "OpenVAS CronJob Failed! If you installed OpenVAS to specific location e.g. /opt" | tee -a /tmp/openvas_mail.out
743 - echo "please add these PATHS to /etc/profile e.g. 'PATH=$PATH:/opt/openvas/bin:/opt/openvas/sbin'" | tee -a /tmp/openvas_mail.out
744 - echo "also sure that they are executable e.g. 'chmod +x /opt/openvas/sbin/openvassd'" | tee -a /tmp/openvas_mail.out
745 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
746 - exit 1
747 -fi
748 -
749 -# Check systemd if exist
750 -if command -v systemctl &>/dev/null; then
751 - systemctl="0"
752 - else
753 - systemctl="1"
754 -fi
755 -
756 -# Check open-rc if exist
757 -if command -v rc-service &>/dev/null; then
758 - open_rc="0"
759 - else
760 - open_rc="1"
761 -fi
762 -
763 -# open-rc variables
764 -if [ $systemctl -eq 1 ] && [ $open_rc -eq 0 ]; then
765 - scanner_init="0"
766 - manager_init="0"
767 - assistant_init="0"
768 - redis_init="0"
769 -fi
770 -
771 -# Check OpenVAS-Scanner systemd unit(common name) is active or enabled
772 -if [ $systemctl -eq 0 ] && ([ "$(systemctl is-active openvassd.service)" = "active" ] || [ "$(systemctl list-unit-files | grep 'enabled' | grep 'openvassd.service' | awk '{print $1}')" = "openvassd.service" ]); then
773 - scanner="0"
774 - else
775 - scanner="1"
776 -fi
777 -
778 -# Check OpenVAS-Manager systemd unit(common name) is active or enabled
779 -if [ $systemctl -eq 0 ] && ([ "$(systemctl is-active openvasmd.service)" = "active" ] || [ "$(systemctl list-unit-files | grep 'enabled' | grep 'openvasmd.service' | awk '{print $1}')" = "openvasmd.service" ]); then
780 - manager="0"
781 - else
782 - manager="1"
783 -fi
784 -
785 -# Check OpenVAS-Assistant systemd unit(common name) is active or not
786 -if [ $systemctl -eq 0 ] && ([ "$(systemctl is-active gsad.service)" = "active" ] || [ "$(systemctl list-unit-files | grep 'enabled' | grep 'gsad.service' | awk '{print $1}')" = "gsad.service" ]); then
787 - assistant="0"
788 - else
789 - assistant="1"
790 -fi
791 -
792 -# Check Redis systemd unit(common name) is active or not
793 -if [ $systemctl -eq 0 ] && ([ "$(systemctl is-active redis.service)" = "active" ] || [ "$(systemctl list-unit-files | grep 'enabled' | grep 'redis.service' | awk '{print $1}')" = "redis.service" ]); then
794 - redis="0"
795 - else
796 - redis="1"
797 -fi
798 -
799 -# If you don't use common systemd service names for OpenVAS
800 -# We need to find correct service name for restarting.
801 -if [ $scanner -eq 1 ] || [ $manager -eq 1 ]; then
802 - WHICHM="ExecStart=$(type openvasmd | awk '{print $3}')"
803 - WHICHS="ExecStart=$(type openvassd | awk '{print $3}')"
804 - WHICHA="ExecStart=$(type gsad | awk '{print $3}')"
805 - WHICHR="ExecStart=$(type redis-server | awk '{print $3}')"
806 -
807 - # If you have unordinary systemd services PATH you can add here
808 - DIR="/lib/systemd/system/
809 - /etc/systemd/system/
810 - /usr/lib/systemd/system/
811 - /usr/local/lib/systemd/system/"
812 -
813 - # Find OpenVAS daemons systemd files
814 - for i in $DIR; do
815 - if [ -d "$i" ]; then
816 - grep -rilnw "$i" -e "$WHICHM" | cut -d: -f1 | grep -oP "$i\K.*" &>>/tmp/openvas_GVM_manager_service.out
817 - grep -rilnw "$i" -e "$WHICHS" | cut -d: -f1 | grep -oP "$i\K.*" &>>/tmp/openvas_GVM_scanner_service.out
818 - grep -rilnw "$i" -e "$WHICHA" | cut -d: -f1 | grep -oP "$i\K.*" &>>/tmp/openvas_GVM_assistant_service.out
819 - grep -rilnw "$i" -e "$WHICHR" | cut -d: -f1 | grep -oP "$i\K.*" &>>/tmp/openvas_GVM_redis_service.out
820 - fi
821 - done
822 -
823 - # Time to get our exact systemd service searching in enabled services
824 - manager_service="$(while IFS= read -r service; do
825 - systemctl list-unit-files | grep "enabled" | grep -P "(^|\s)\K$service(?=\s|$)" | awk '{print $1}'
826 - done < /tmp/openvas_GVM_manager_service.out)"
827 -
828 - scanner_service="$(while IFS= read -r service; do
829 - systemctl list-unit-files | grep "enabled" | grep -P "(^|\s)\K$service(?=\s|$)" | awk '{print $1}'
830 - done < /tmp/openvas_GVM_scanner_service.out)"
831 -
832 - assistant_service="$(while IFS= read -r service; do
833 - systemctl list-unit-files | grep "enabled" | grep -P "(^|\s)\K$service(?=\s|$)" | awk '{print $1}'
834 - done < /tmp/openvas_GVM_assistant_service.out)"
835 -
836 - redis_service="$(while IFS= read -r service; do
837 - systemctl list-unit-files | grep "enabled" | grep -P "(^|\s)\K$service(?=\s|$)" | awk '{print $1}'
838 - done < /tmp/openvas_GVM_redis_service.out)"
839 -
840 - rm -rf /tmp/openvas_GVM*
841 - COUNTM=$(wc -w <<< "${manager_service}")
842 - COUNTS=$(wc -w <<< "${scanner_service}")
843 - COUNTA=$(wc -w <<< "${assistant_service}")
844 - COUNTR=$(wc -w <<< "${redis_service}")
845 -
846 - if [ $COUNTM -gt 1 ] || [ $COUNTS -gt 1 ] || [ $COUNTR -gt 1 ]; then
847 - echo "OpenVAS CronJob Failed! You have multiple enabled systemd service for single OpenVAS daemon or redis" | tee -a /tmp/openvas_mail.out
848 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
849 - exit 1
850 - fi
851 -fi
852 -
853 -# Start to update FEED & First NVT.
854 -try=0
855 -until [ $try -ge 5 ]; do
856 - greenbone-nvt-sync &>/dev/null && break
857 - echo "Can't connected! Trying to update greenbone-nvt again.." &>>/tmp/openvas_mail.out
858 - try=$[$try+1]
859 - sleep 30
860 -done
861 -
862 -# Check status
863 -if [ $? -eq 0 ]; then
864 - echo "greenbone-nvt-sync is done" &>>/tmp/openvas_mail.out
865 - # Avoid your IP temporary banned because of multiple connection
866 - sleep 5
867 - # Try to update scapdata.
868 - try=0
869 - until [ $try -ge 5 ]; do
870 - greenbone-scapdata-sync &>/dev/null && break
871 - echo "Can't connected! Trying to update greenbone-scapdata again.." &>>/tmp/openvas_mail.out
872 - try=$[$try+1]
873 - sleep 30
874 - done
875 -
876 - # Check status
877 - if [ $? -eq 0 ]; then
878 - echo "greenbone-scapdata-sync is done" &>>/tmp/openvas_mail.out
879 - # Avoid your IP temporary banned because of multiple connection
880 - sleep 5
881 - # Try to update certdata
882 - try=0
883 - until [ $try -ge 5 ]; do
884 - greenbone-certdata-sync &>/dev/null && break
885 - echo "Can't connected! Trying to update greenbone-certdata again.." &>>/tmp/openvas_mail.out
886 - try=$[$try+1]
887 - sleep 30
888 - done
889 -
890 - # Check status
891 - if [ $? -eq 0 ]; then
892 - echo "greenbone-certdata-sync is done" &>>/tmp/openvas_mail.out
893 -
894 - # Check OpenVAS-Scanner is running
895 - if ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" &>/dev/null; then
896 - echo "OpenVAS-Scanner is running." &>>/tmp/openvas_mail.out
897 - openvasmd --update --progress &>/dev/null
898 -
899 - elif [ $scanner -eq 0 ]; then
900 - # Start OpenVAS-Scanner systemd unit & Rebuild Cache
901 - echo "OpenVAS-Scanner is down! Trying to up.." &>>/tmp/openvas_mail.out
902 - systemctl start openvassd.service &>/dev/null
903 -
904 - if [ $? -eq 0 ]; then
905 - # Wait for initialize
906 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
907 - sleep 15
908 - echo "Waiting for OpenVAS-Scanner to become ready.." &>>/tmp/openvas_mail.out
909 - done
910 - echo "openvassd.service started and waiting for connection." &>>/tmp/openvas_mail.out
911 - # Rebuild Cache
912 - openvasmd --update --progress &>/dev/null
913 - else
914 - echo "openvassd.service cannot started.." | tee -a /tmp/openvas_mail.out
915 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
916 - exit 1
917 - fi
918 -
919 - elif [[ -n "$scanner_service" ]]; then
920 - echo "OpenVAS-Scanner is down! Trying to up.." &>>/tmp/openvas_mail.out
921 - systemctl start "$scanner_service" &>/dev/null
922 -
923 - if [ $? -eq 0 ]; then
924 - # Wait for initialize
925 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
926 - sleep 15
927 - echo "Waiting for OpenVAS-Scanner to become ready.." &>>/tmp/openvas_mail.out
928 - done
929 - echo "$scanner_service is started and waiting for connection." &>>/tmp/openvas_mail.out
930 - # Rebuild Cache
931 - openvasmd --update --progress &>/dev/null
932 - else
933 - echo "$scanner_service cannot started.." | tee -a /tmp/openvas_mail.out
934 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
935 - exit 1
936 - fi
937 -
938 - elif [[ -n "$scanner_init" ]]; then
939 - # Start OpenVAS-Scanner with init.d (open-rc) & Rebuild Cache
940 - echo "OpenVAS-Scanner is down! Trying to up.." &>>/tmp/openvas_mail.out
941 - rc-service openvassd start &>/dev/null
942 -
943 - if [ $? -eq 0 ]; then
944 - # Wait for initialize
945 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
946 - sleep 15
947 - echo "Waiting for OpenVAS-Scanner to become ready.." &>>/tmp/openvas_mail.out
948 - done
949 - echo "rc-service --> openvassd started and waiting for connection." &>>/tmp/openvas_mail.out
950 - # Rebuild Cache
951 - openvasmd --update --progress &>/dev/null
952 - else
953 - echo "rc-service --> openvassd cannot started.." | tee -a /tmp/openvas_mail.out
954 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
955 - exit 1
956 - fi
957 -
958 - else
959 - echo "OpenVAS-Scanner is down! Trying to up.." &>>/tmp/openvas_mail.out
960 - openvassd "$OPENVAS_SCANNER_OPTIONS" "$OPENVAS_SCANNER_LISTEN_SOCKET" &>/dev/null
961 - # Wait for initialize
962 - if [ $? -eq 0 ]; then
963 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
964 - sleep 15
965 - echo "Waiting for OpenVAS-Scanner to become ready.." &>>/tmp/openvas_mail.out
966 - done
967 - else
968 - echo "OpenVAS Scanner cannot started manually.." | tee -a /tmp/openvas_mail.out
969 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
970 - exit 1
971 - fi
972 - echo "OpenVAS-Scanner started manually and waiting for connection." &>>/tmp/openvas_mail.out
973 - # Rebuild Cache
974 - openvasmd --update --progress &>/dev/null
975 - fi
976 -
977 - # Check status
978 - if [ $? -eq 0 ]; then
979 - echo "Updating NVT cache is done" &>>/tmp/openvas_mail.out
980 -
981 - # Restart OpenVAS-Scanner
982 - if [ $scanner -eq 0 ]; then
983 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
984 - sleep 3
985 -
986 - # Try to restart redis service before OpenVAS-Scanner
987 - if [ $redis -eq 0 ]; then
988 - systemctl restart redis.service &>/dev/null
989 -
990 - if [ $? -eq 0 ]; then
991 - echo "systemd --> redis.service is restarted." &>>/tmp/openvas_mail.out
992 - else
993 - echo "systemd --> redis.service cannot restarted." | tee -a /tmp/openvas_mail.out
994 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
995 - exit 1
996 - fi
997 -
998 - elif [[ -n "$redis_service" ]]; then
999 - systemctl restart "$redis_service" &>/dev/null
1000 -
1001 - if [ $? -eq 0 ]; then
1002 - echo "systemd --> $redis_service is restarted." &>>/tmp/openvas_mail.out
1003 - else
1004 - echo "systemd --> $redis_service cannot restarted." | tee -a /tmp/openvas_mail.out
1005 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1006 - exit 1
1007 - fi
1008 -
1009 - elif [[ -n "$redis_init" ]]; then
1010 - rc-service redis stop
1011 - sleep 5
1012 - rc-service redis start
1013 -
1014 - if [ $? -eq 0 ]; then
1015 - echo "open-rc --> redis is restarted." &>>/tmp/openvas_mail.out
1016 - else
1017 - echo "open-rc --> redis cannot restarted." | tee -a /tmp/openvas_mail.out
1018 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1019 - exit 1
1020 - fi
1021 - fi
1022 - systemctl restart openvassd.service &>/dev/null
1023 -
1024 - elif [[ -n "$scanner_service" ]]; then
1025 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1026 - sleep 3
1027 -
1028 - # Try to restart redis service before OpenVAS-Scanner
1029 - if [ $redis -eq 0 ]; then
1030 - systemctl restart redis.service &>/dev/null
1031 -
1032 - if [ $? -eq 0 ]; then
1033 - echo "systemd --> redis.service is restarted." &>>/tmp/openvas_mail.out
1034 - else
1035 - echo "systemd --> redis.service cannot restarted." | tee -a /tmp/openvas_mail.out
1036 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1037 - exit 1
1038 - fi
1039 -
1040 - elif [[ -n "$redis_service" ]]; then
1041 - systemctl restart "$redis_service" &>/dev/null
1042 -
1043 - if [ $? -eq 0 ]; then
1044 - echo "systemd --> $redis_service is restarted." &>>/tmp/openvas_mail.out
1045 - else
1046 - echo "systemd --> $redis_service cannot restarted." | tee -a /tmp/openvas_mail.out
1047 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1048 - exit 1
1049 - fi
1050 -
1051 - elif [[ -n "$redis_init" ]]; then
1052 - rc-service redis stop
1053 - sleep 5
1054 - rc-service redis start
1055 -
1056 - if [ $? -eq 0 ]; then
1057 - echo "open-rc --> redis is restarted." &>>/tmp/openvas_mail.out
1058 - else
1059 - echo "open-rc --> redis cannot restarted." | tee -a /tmp/openvas_mail.out
1060 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1061 - exit 1
1062 - fi
1063 - fi
1064 - systemctl restart "$scanner_service" &>/dev/null
1065 -
1066 - elif [[ -n "$scanner_init" ]]; then
1067 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1068 - sleep 3
1069 -
1070 - # Try to restart redis service before OpenVAS-Scanner
1071 - if [ $redis -eq 0 ]; then
1072 - systemctl restart redis.service &>/dev/null
1073 -
1074 - if [ $? -eq 0 ]; then
1075 - echo "systemd --> redis.service is restarted." &>>/tmp/openvas_mail.out
1076 - else
1077 - echo "systemd --> redis.service cannot restarted." | tee -a /tmp/openvas_mail.out
1078 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1079 - exit 1
1080 - fi
1081 -
1082 - elif [[ -n "$redis_service" ]]; then
1083 - systemctl restart "$redis_service" &>/dev/null
1084 -
1085 - if [ $? -eq 0 ]; then
1086 - echo "systemd --> $redis_service is restarted." &>>/tmp/openvas_mail.out
1087 - else
1088 - echo "systemd --> $redis_service cannot restarted." | tee -a /tmp/openvas_mail.out
1089 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1090 - exit 1
1091 - fi
1092 -
1093 - elif [[ -n "$redis_init" ]]; then
1094 - rc-service redis stop
1095 - sleep 5
1096 - rc-service redis start
1097 -
1098 - if [ $? -eq 0 ]; then
1099 - echo "open-rc --> redis is restarted." &>>/tmp/openvas_mail.out
1100 - else
1101 - echo "open-rc --> redis cannot restarted." | tee -a /tmp/openvas_mail.out
1102 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1103 - exit 1
1104 - fi
1105 - fi
1106 - rc-service openvassd start &>/dev/null
1107 -
1108 - else
1109 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvassd:(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1110 - sleep 3
1111 -
1112 - # Try to restart redis service before OpenVAS-Scanner
1113 - if [ $redis -eq 0 ]; then
1114 - systemctl restart redis.service &>/dev/null
1115 -
1116 - if [ $? -eq 0 ]; then
1117 - echo "systemd --> redis.service is restarted." &>>/tmp/openvas_mail.out
1118 - else
1119 - echo "systemd --> redis.service cannot restarted." | tee -a /tmp/openvas_mail.out
1120 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1121 - exit 1
1122 - fi
1123 -
1124 - elif [[ -n "$redis_service" ]]; then
1125 - systemctl restart "$redis_service" &>/dev/null
1126 -
1127 - if [ $? -eq 0 ]; then
1128 - echo "systemd --> $redis_service is restarted." &>>/tmp/openvas_mail.out
1129 - else
1130 - echo "systemd --> $redis_service cannot restarted." | tee -a /tmp/openvas_mail.out
1131 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1132 - exit 1
1133 - fi
1134 -
1135 - elif [[ -n "$redis_init" ]]; then
1136 - rc-service redis stop
1137 - sleep 5
1138 - rc-service redis start
1139 -
1140 - if [ $? -eq 0 ]; then
1141 - echo "open-rc --> redis is restarted." &>>/tmp/openvas_mail.out
1142 - else
1143 - echo "open-rc --> redis cannot restarted." | tee -a /tmp/openvas_mail.out
1144 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1145 - exit 1
1146 - fi
1147 - fi
1148 - openvassd "$OPENVAS_SCANNER_OPTIONS" "$OPENVAS_SCANNER_LISTEN_SOCKET" &>/dev/null
1149 - fi
1150 -
1151 - if [ $? -eq 0 ]; then
1152 - until [ "$(ps aux | grep -v 'grep' | grep -ow 'openvassd: Waiting')" = "openvassd: Waiting" ]; do
1153 - sleep 10
1154 - echo "Waiting for OpenVAS-Scanner to become ready.." &>>/tmp/openvas_mail.out
1155 - done
1156 - echo "OpenVAS-Scanner is restarted." &>>/tmp/openvas_mail.out
1157 -
1158 - # Restart OpenVAS-Manager
1159 - if [ $manager -eq 0 ]; then
1160 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvasmd(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1161 - sleep 5
1162 - systemctl restart openvasmd.service &>/dev/null
1163 -
1164 - if [ $? -eq 0 ]; then
1165 - success="0"
1166 - echo "systemd --> openvasmd.service is restarted" &>>/tmp/openvas_mail.out
1167 - echo "OpenVAS CronJob Success!" | tee -a /tmp/openvas_mail.out
1168 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1169 - else
1170 - echo "systemd --> openvasmd.service cannot restarted" &>>/tmp/openvas_mail.out
1171 - echo "OpenVAS CronJob Failed!" | tee -a /tmp/openvas_mail.out
1172 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1173 - exit 1
1174 - fi
1175 -
1176 - elif [[ -n "$manager_service" ]]; then
1177 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvasmd(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1178 - sleep 5
1179 - systemctl restart "$manager_service" &>/dev/null
1180 -
1181 - if [ $? -eq 0 ]; then
1182 - success="0"
1183 - echo "systemd --> $manager_service is restarted" &>>/tmp/openvas_mail.out
1184 - echo "OpenVAS CronJob Success!" | tee -a /tmp/openvas_mail.out
1185 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1186 - else
1187 - echo "systemd --> $manager_service cannot restarted" &>>/tmp/openvas_mail.out
1188 - echo "OpenVAS CronJob Failed!" | tee -a /tmp/openvas_mail.out
1189 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1190 - exit 1
1191 - fi
1192 -
1193 - elif [[ -n "$manager_init" ]]; then
1194 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvasmd(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1195 - sleep 5
1196 - rc-service openvasmd start &>/dev/null
1197 -
1198 - if [ $? -eq 0 ]; then
1199 - success="0"
1200 - echo "open-rc --> openvasmd is restarted" &>>/tmp/openvas_mail.out
1201 - echo "OpenVAS CronJob Success!" | tee -a /tmp/openvas_mail.out
1202 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1203 - else
1204 - echo "open-rc --> openvasmd cannot restarted" &>>/tmp/openvas_mail.out
1205 - echo "OpenVAS CronJob Failed!" | tee -a /tmp/openvas_mail.out
1206 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1207 - exit 1
1208 - fi
1209 -
1210 - else
1211 - ps aux | grep -v "grep" | grep -P "(^|\s)\Kopenvasmd(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1212 - sleep 5
1213 - openvasmd "$OPENVAS_MANAGER_OPTIONS" "$OPENVAS_MANAGER_PORT" "$OPENVAS_MANAGER_LISTEN_ADDRESS" "$OPENVAS_MANAGER_SCANNER_HOST" "$OPENVAS_MANAGER_GNUTLS_PRIORITIES" &>/dev/null
1214 -
1215 - if [ $? -eq 0 ]; then
1216 - success="0"
1217 - echo "OpenVAS-Manager is restarted manually" &>>/tmp/openvas_mail.out
1218 - echo "OpenVAS CronJob Success!" | tee -a /tmp/openvas_mail.out
1219 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1220 - else
1221 - echo "OpenVAS-Manager cannot restarted" &>>/tmp/openvas_mail.out
1222 - echo "OpenVAS CronJob Failed!" | tee -a /tmp/openvas_mail.out
1223 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1224 - exit 1
1225 - fi
1226 - fi
1227 - else
1228 - echo "OpenVAS CronJob Failed! openvas-scanner cannot restarted" | tee -a /tmp/openvas_mail.out
1229 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1230 - fi
1231 - else
1232 - echo "OpenVAS CronJob Failed! OpenVAS NVT cache build failed" | tee -a /tmp/openvas_mail.out
1233 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1234 - fi
1235 - else
1236 - echo "OpenVAS CronJob Failed! OpenVAS Certdata sync failed!" | tee -a /tmp/openvas_mail.out
1237 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1238 - fi
1239 - else
1240 - echo "OpenVAS CronJob Failed! OpenVAS Scapdata sync failed!" | tee -a /tmp/openvas_mail.out
1241 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1242 - fi
1243 - else
1244 - echo "OpenVAS CronJob Failed! OpenVAS NVT sync update failed!" | tee -a /tmp/openvas_mail.out
1245 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1246 -fi
1247 -rm -rf /tmp/openvas_mail.out
1248 -
1249 -# Restart WebUI
1250 -if [[ -n "$success" ]] && [ $gsad -eq 0 ]; then
1251 - WHICHA="$(type gsad | awk '{print $3}')"
1252 -
1253 - if [ $assistant -eq 0 ]; then
1254 - # Time to restart OpenVAS-Security Assistant
1255 - ps aux | grep -v "grep" | grep -P "(^|\s)\K$WHICHA(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1256 - sleep 5
1257 - systemctl restart gsad.service &>/dev/null
1258 -
1259 - if [ $? -eq 0 ]; then
1260 - echo "systemd --> gsad.service (OpenVAS WebUI) is restarted" | tee -a /tmp/openvas_mail.out
1261 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1262 - else
1263 - echo "systemd --> gsad.service (OpenVAS-WebUI) cannot restarted" | tee -a /tmp/openvas_mail.out
1264 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1265 - fi
1266 -
1267 - elif [[ -n "$assistant_service" ]]; then
1268 - if [ $COUNTA -eq 1 ]; then
1269 - ps aux | grep -v "grep" | grep -P "(^|\s)\K$WHICHA(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1270 - sleep 5
1271 - systemctl restart "$assistant_service" &>/dev/null
1272 -
1273 - if [ $? -eq 0 ]; then
1274 - echo "systemd --> $assistant_service (OpenVAS WebUI) is restarted" | tee -a /tmp/openvas_mail.out
1275 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1276 - else
1277 - echo "systemd --> $assistan_service (OpenVAS WebUI) cannot restarted." | tee -a /tmp/openvas_mail.out
1278 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1279 - fi
1280 - else
1281 - echo "systemd --> OpenVAS WebUI cannot restarted! You have multiple enabled systemd services ($assistant_service)" | tee -a /tmp/openvas_mail.out
1282 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1283 - exit 1
1284 - fi
1285 -
1286 - elif [[ -n "$assistant_init" ]]; then
1287 - ps aux | grep -v "grep" | grep -P "(^|\s)\K$WHICHA(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1288 - sleep 5
1289 - rc-service gsad start &>/dev/null
1290 -
1291 - if [ $? -eq 0 ]; then
1292 - echo "open-rc --> gsad (OpenVAS WebUI) is restarted" | tee -a /tmp/openvas_mail.out
1293 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1294 - else
1295 - echo "open-rc --> gsad (OpenVAS WebUI) cannot restarted." | tee -a /tmp/openvas_mail.out
1296 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1297 - fi
1298 - else
1299 - ps aux | grep -v "grep" | grep -P "(^|\s)\K$WHICHA(?=\s|$)" | awk '{print $2}' | xargs kill -9 &>/dev/null
1300 - sleep 5
1301 - gsad "$OPENVAS_SECURITY_ASSISTANT_OPTIONS" "$OPENVAS_SECURITY_ASSISTANT_LISTEN_ADDRESS" "$OPENVAS_SECURITY_ASSISTANT_LISTEN_PORT" "$OPENVAS_SECURITY_ASSISTANT_MANAGER_LISTEN_ADDRESS" "$OPENVAS_SECURITY_ASSISTANT_MANAGER_LISTEN_PORT" "$OPENVAS_SECURITY_ASSISTANT_GNUTLS_PRIORITIES" &>/dev/null
1302 -
1303 - if [ $? -eq 0 ]; then
1304 - echo "OpenVAS WebUI is restarted" | tee -a /tmp/openvas_mail.out
1305 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1306 - else
1307 - echo "OpenVAS WebUI cannot restarted" | tee -a /tmp/openvas_mail.out
1308 - echo -e "Subject:$MAIL_SUBJECT\n$(cat /tmp/openvas_mail.out)" | sendmail -t "$MAIL_TO" &>/dev/null
1309 - fi
1310 - fi
1311 - rm -rf /tmp/openvas_mail.out
1312 -fi
1313
1314 diff --git a/net-analyzer/openvas-scanner/files/openvas-nvt-sync-cron b/net-analyzer/openvas-scanner/files/openvas-nvt-sync-cron
1315 deleted file mode 100644
1316 index e6a83867f3d..00000000000
1317 --- a/net-analyzer/openvas-scanner/files/openvas-nvt-sync-cron
1318 +++ /dev/null
1319 @@ -1,39 +0,0 @@
1320 -#!/bin/sh
1321 -
1322 -if [ -f /etc/openvas/openvassd.conf ]; then
1323 - . /etc/openvas/openvassd.conf
1324 -fi
1325 -
1326 -if [ "$auto_plugin_update" != "yes" ]; then
1327 - exit 0
1328 -fi
1329 -
1330 -opts=""
1331 -case "$update_method" in
1332 - rsync)
1333 - opts = "$opts --rsync"
1334 - ;;
1335 - wget)
1336 - opts = "$opts --wget"
1337 - ;;
1338 - curl)
1339 - opts = "$opts --curl"
1340 - ;;
1341 -esac
1342 -
1343 -# Export openvas-nvt-sync's environment variables if they are defined
1344 -[ \! -z "$NVT_DIR" ] && export NVT_DIR
1345 -[ \! -z "$OV_RSYNC_FEED" ] && export OV_RSYNC_FEED
1346 -[ \! -z "$OV_HTTP_FEED" ] && export OV_HTTP_FEED
1347 -
1348 -/usr/sbin/openvas-nvt-sync $opts >& /dev/null
1349 -
1350 -if [ $? -ne 0 ]; then
1351 - echo "Error updating OpenVAS plugins. Please run openvas-nvt-sync manually."
1352 - exit 1
1353 -fi
1354 -
1355 -if [ "$notify_openvas_scanner" == "yes" ]; then
1356 - /etc/init.d/openvas-scanner reloadplugins
1357 -fi
1358 -
1359
1360 diff --git a/net-analyzer/openvas-scanner/files/openvas-scanner-4.0.3-mkcertclient.patch b/net-analyzer/openvas-scanner/files/openvas-scanner-4.0.3-mkcertclient.patch
1361 deleted file mode 100644
1362 index 05e92728f18..00000000000
1363 --- a/net-analyzer/openvas-scanner/files/openvas-scanner-4.0.3-mkcertclient.patch
1364 +++ /dev/null
1365 @@ -1,29 +0,0 @@
1366 -diff -ru openvas-scanner-4.0.1/CMakeLists.txt openvas-scanner-4.0.1.mkcert/CMakeLists.txt
1367 ---- openvas-scanner-4.0.1/CMakeLists.txt 2014-04-23 16:00:47.000000000 +0200
1368 -+++ openvas-scanner-4.0.1.mkcert/CMakeLists.txt 2014-05-26 16:04:23.093548608 +0200
1369 -@@ -258,7 +258,6 @@
1370 - # DESTINATION ${OPENVAS_SYSCONF_DIR})
1371 -
1372 - install (FILES ${CMAKE_BINARY_DIR}/tools/openvas-mkcert
1373 -- ${CMAKE_BINARY_DIR}/tools/openvas-mkcert-client
1374 - ${CMAKE_BINARY_DIR}/tools/openvas-nvt-sync
1375 - DESTINATION ${SBINDIR}
1376 - PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE
1377 -@@ -269,7 +268,15 @@
1378 - PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE
1379 - GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
1380 -
1381 --install (FILES ${CMAKE_BINARY_DIR}/doc/openvassd.8
1382 -+install (FILES ${CMAKE_BINARY_DIR}/tools/openvas-mkcert-client
1383 -+ DESTINATION ${BINDIR}
1384 -+ PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE
1385 -+ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
1386 -+
1387 -+install (FILES ${CMAKE_SOURCE_DIR}/doc/openvas-mkcert-client.1
1388 -+ DESTINATION ${DATADIR}/man/man1 )
1389 -+
1390 -+install (FILES ${CMAKE_BINARY_DIR}/doc/openvassd.8
1391 - DESTINATION ${DATADIR}/man/man8 )
1392 -
1393 - install (FILES ${CMAKE_SOURCE_DIR}/doc/openvas-mkcert.8
1394 -Only in openvas-scanner-4.0.1.mkcert/: CMakeLists.txt~
1395
1396 diff --git a/net-analyzer/openvas-scanner/files/openvas-scanner-4.0.3-rulesdir.patch b/net-analyzer/openvas-scanner/files/openvas-scanner-4.0.3-rulesdir.patch
1397 deleted file mode 100644
1398 index 90f998ffd40..00000000000
1399 --- a/net-analyzer/openvas-scanner/files/openvas-scanner-4.0.3-rulesdir.patch
1400 +++ /dev/null
1401 @@ -1,15 +0,0 @@
1402 -diff -ru openvas-scanner-4.0.1/CMakeLists.txt openvas-scanner-4.0.1.rules/CMakeLists.txt
1403 ---- openvas-scanner-4.0.1/CMakeLists.txt 2014-04-23 16:00:47.000000000 +0200
1404 -+++ openvas-scanner-4.0.1.rules/CMakeLists.txt 2014-05-26 16:07:37.454116277 +0200
1405 -@@ -171,6 +171,10 @@
1406 - set (OPENVASSD_DEBUGMSG "${OPENVAS_LOG_DIR}/openvassd.dump")
1407 - set (OPENVASSD_CONF "${OPENVAS_SYSCONF_DIR}/openvassd.conf")
1408 -
1409 -+if (NOT OPENVASSD_RULES)
1410 -+ set (OPENVASSD_RULES "${OPENVAS_DATA_DIR}/openvassd.rules")
1411 -+endif (NOT OPENVASSD_RULES)
1412 -+
1413 - set (NVT_TIMEOUT "320")
1414 -
1415 - message ("-- Install prefix: ${CMAKE_INSTALL_PREFIX}")
1416 -
1417
1418 diff --git a/net-analyzer/openvas-scanner/files/openvas-scanner-4.0.3-run.patch b/net-analyzer/openvas-scanner/files/openvas-scanner-4.0.3-run.patch
1419 deleted file mode 100644
1420 index 51dd8389c5f..00000000000
1421 --- a/net-analyzer/openvas-scanner/files/openvas-scanner-4.0.3-run.patch
1422 +++ /dev/null
1423 @@ -1,17 +0,0 @@
1424 - CMakeLists.txt | 2 +-
1425 - tools/greenbone-nvt-sync | 2 +-
1426 - 2 files changed, 2 insertions(+), 2 deletions(-)
1427 -
1428 -diff --git a/CMakeLists.txt b/CMakeLists.txt
1429 -index c691100..d78ffa6 100644
1430 ---- a/CMakeLists.txt
1431 -+++ b/CMakeLists.txt
1432 -@@ -155,7 +155,7 @@ set (OPENVAS_DATA_DIR "${DATADIR}/openvas")
1433 - set (OPENVAS_STATE_DIR "${LOCALSTATEDIR}/lib/openvas")
1434 - set (OPENVAS_LOG_DIR "${LOCALSTATEDIR}/log/openvas")
1435 - set (OPENVAS_CACHE_DIR "${LOCALSTATEDIR}/cache/openvas")
1436 --set (OPENVAS_PID_DIR "${LOCALSTATEDIR}/run")
1437 -+set (OPENVAS_PID_DIR "/run")
1438 - set (OPENVAS_SYSCONF_DIR "${SYSCONFDIR}/openvas")
1439 -
1440 - set (OPENVAS_NVT_DIR "${OPENVAS_STATE_DIR}/plugins")
1441
1442 diff --git a/net-analyzer/openvas-scanner/files/openvassd b/net-analyzer/openvas-scanner/files/openvassd
1443 deleted file mode 100644
1444 index 13070e32e1c..00000000000
1445 --- a/net-analyzer/openvas-scanner/files/openvassd
1446 +++ /dev/null
1447 @@ -1,22 +0,0 @@
1448 -#!/sbin/openrc-run
1449 -# Copyright 1999-2011 Gentoo Foundation
1450 -# Distributed under the terms of the GNU General Public License v2
1451 -
1452 -depend() {
1453 - need net
1454 -}
1455 -
1456 -start() {
1457 - ebegin "Starting openvassd (scanner)"
1458 - start-stop-daemon --start --name openvassd \
1459 - --exec /usr/sbin/openvassd \
1460 - --pidfile /var/run/openvassd.pid
1461 - eend $?
1462 -}
1463 -
1464 -stop() {
1465 - ebegin "Stop openvassd (scanner)"
1466 - start-stop-daemon --stop --name openvassd \
1467 - --pidfile /var/run/openvassd.pid
1468 - eend $?
1469 -}
1470
1471 diff --git a/net-analyzer/openvas-scanner/files/openvassd-daemon.conf b/net-analyzer/openvas-scanner/files/openvassd-daemon.conf
1472 deleted file mode 100644
1473 index 628a223a419..00000000000
1474 --- a/net-analyzer/openvas-scanner/files/openvassd-daemon.conf
1475 +++ /dev/null
1476 @@ -1,26 +0,0 @@
1477 -#Listen on given address - by default scanner listens on all addresses
1478 -#SCANNER_LISTEN=--listen=127.0.0.1
1479 -
1480 -#Listen on given port - by default 9391
1481 -SCANNER_PORT=--port=9391
1482 -
1483 -#Send the packets with the source IP of IP1,IP2,IP3....
1484 -#SCANNER_SRCIP=--src-ip=127.0.0.1,192.168.1.2
1485 -
1486 -# Extra Arguments
1487 -# SCANNER_EXTRA_ARGS=""
1488 -
1489 -# Set to yes if plugins should be automatically updated via a cron job
1490 -auto_plugin_update=no
1491 -
1492 -# Notify OpenVAS scanner after update by seding it SIGHUP?
1493 -notify_openvas_scanner=yes
1494 -
1495 -# Method to use to get updates. The default is via rsync
1496 -# Note that only wget and curl support retrieval via proxy
1497 -# update_method=rsync|wget|curl
1498 -
1499 -# Additionaly, you can specify the following variables
1500 -#NVT_DIR where to extract plugins (absolute path)
1501 -#OV_RSYNC_FEED URL of rsync feed
1502 -#OV_HTTP_FEED URL of http feed
1503
1504 diff --git a/net-analyzer/openvas-scanner/files/openvassd.init b/net-analyzer/openvas-scanner/files/openvassd.init
1505 deleted file mode 100644
1506 index c07d3936905..00000000000
1507 --- a/net-analyzer/openvas-scanner/files/openvassd.init
1508 +++ /dev/null
1509 @@ -1,25 +0,0 @@
1510 -#!/sbin/openrc-run
1511 -# Copyright 1999-2014 Gentoo Foundation
1512 -# Distributed under the terms of the GNU General Public License v2
1513 -
1514 -name="OpenVAS Scanner"
1515 -command="/usr/sbin/openvassd"
1516 -command_args="${SCANNER_LISTEN} ${SCANNER_PORT} ${SCANNER_SRCIP} ${SCANNER_EXTRA_ARGS}"
1517 -pidfile="/run/openvassd.pid"
1518 -extra_stopped_commands="create_cache"
1519 -
1520 -depend() {
1521 - after bootmisc
1522 - need localmount net
1523 -}
1524 -
1525 -start_pre() {
1526 - checkpath --directory --mode 0775 --quiet /var/cache/openvas
1527 -}
1528 -
1529 -create_cache() {
1530 - checkpath --directory --mode 0775 --quiet /var/cache/openvas
1531 - ebegin "Generating initial Cache"
1532 - /usr/sbin/openvassd --foreground --only-cache
1533 - eend $?
1534 -}
1535
1536 diff --git a/net-analyzer/openvas-scanner/files/openvassd.logrotate b/net-analyzer/openvas-scanner/files/openvassd.logrotate
1537 deleted file mode 100644
1538 index 9316ba8d962..00000000000
1539 --- a/net-analyzer/openvas-scanner/files/openvassd.logrotate
1540 +++ /dev/null
1541 @@ -1,11 +0,0 @@
1542 -# logrotate for openvas
1543 -/var/log/openvas/openvassd.log {
1544 - rotate 4
1545 - weekly
1546 - compress
1547 - delaycompress
1548 - missingok
1549 - postrotate
1550 - /bin/kill -HUP `pidof openvassd`
1551 - endscript
1552 -}
1553
1554 diff --git a/net-analyzer/openvas-scanner/files/openvassd.service b/net-analyzer/openvas-scanner/files/openvassd.service
1555 deleted file mode 100644
1556 index 553b09b5b2f..00000000000
1557 --- a/net-analyzer/openvas-scanner/files/openvassd.service
1558 +++ /dev/null
1559 @@ -1,16 +0,0 @@
1560 -[Unit]
1561 -Description=OpenVAS Scanner
1562 -After=network.target
1563 -Before=openvasmd.service
1564 -
1565 -[Service]
1566 -EnvironmentFile=-/etc/openvas/openvassd-daemon.conf
1567 -ExecStart=/usr/sbin/openvassd -f ${SCANNER_PORT} ${SCANNER_LISTEN} ${SCANNER_SRCIP} ${SCANNER_EXTRA_ARGS}
1568 -Restart=always
1569 -RestartSec=1
1570 -User=root
1571 -Group=root
1572 -TimeoutSec=1200
1573 -
1574 -[Install]
1575 -WantedBy=multi-user.target
1576
1577 diff --git a/net-analyzer/openvas-scanner/files/openvassd.tmpfiles.d b/net-analyzer/openvas-scanner/files/openvassd.tmpfiles.d
1578 deleted file mode 100644
1579 index 18e820caec1..00000000000
1580 --- a/net-analyzer/openvas-scanner/files/openvassd.tmpfiles.d
1581 +++ /dev/null
1582 @@ -1 +0,0 @@
1583 -d /var/cache/openvassd 0775
1584
1585 diff --git a/net-analyzer/openvas-scanner/openvas-scanner-5.0.4-r1.ebuild b/net-analyzer/openvas-scanner/openvas-scanner-5.0.4-r1.ebuild
1586 deleted file mode 100644
1587 index ac7d2ea314e..00000000000
1588 --- a/net-analyzer/openvas-scanner/openvas-scanner-5.0.4-r1.ebuild
1589 +++ /dev/null
1590 @@ -1,72 +0,0 @@
1591 -# Copyright 1999-2018 Gentoo Authors
1592 -# Distributed under the terms of the GNU General Public License v2
1593 -
1594 -EAPI=7
1595 -
1596 -DL_ID=2129
1597 -MY_PN=openvassd
1598 -inherit cmake-utils systemd
1599 -
1600 -DESCRIPTION="A remote security scanner for Linux (OpenVAS-scanner)"
1601 -HOMEPAGE="http://www.openvas.org/"
1602 -SRC_URI="http://wald.intevation.org/frs/download.php/${DL_ID}/${P/_beta/+beta}.tar.gz"
1603 -
1604 -SLOT="0"
1605 -LICENSE="GPL-2"
1606 -KEYWORDS="~amd64 ~arm ~ppc ~x86"
1607 -IUSE=""
1608 -
1609 -DEPEND="
1610 - app-crypt/gpgme
1611 - >=dev-libs/glib-2.16:2
1612 - dev-libs/libgcrypt:0
1613 - >=net-analyzer/openvas-libraries-8.0.2
1614 -"
1615 -RDEPEND="${DEPEND}
1616 - !net-analyzer/openvas-plugins
1617 - !net-analyzer/openvas-server
1618 -"
1619 -BDEPEND="
1620 - virtual/pkgconfig
1621 -"
1622 -
1623 -S="${WORKDIR}"/${P/_beta/+beta}
1624 -
1625 -PATCHES=(
1626 - "${FILESDIR}"/${PN}-4.0.3-mkcertclient.patch
1627 - "${FILESDIR}"/${PN}-4.0.3-rulesdir.patch
1628 - "${FILESDIR}"/${PN}-4.0.3-run.patch
1629 -)
1630 -
1631 -src_prepare() {
1632 - cmake-utils_src_prepare
1633 - sed \
1634 - -e '/^install.*OPENVAS_CACHE_DIR.*/d' \
1635 - -i CMakeLists.txt || die
1636 -}
1637 -
1638 -src_configure() {
1639 - local mycmakeargs=(
1640 - -DLOCALSTATEDIR="${EPREFIX}/var"
1641 - -DSYSCONFDIR="${EPREFIX}/etc"
1642 - )
1643 - cmake-utils_src_configure
1644 -}
1645 -
1646 -src_install() {
1647 - cmake-utils_src_install
1648 -
1649 - newinitd "${FILESDIR}"/${MY_PN}.init ${MY_PN}
1650 -
1651 - insinto /etc/openvas
1652 - doins "${FILESDIR}"/${MY_PN}.conf "${FILESDIR}"/${MY_PN}-daemon.conf
1653 - dosym ../openvas/${MY_PN}-daemon.conf /etc/conf.d/${MY_PN}
1654 -
1655 - insinto /etc/logrotate.d
1656 - doins "${FILESDIR}"/${MY_PN}.logrotate
1657 -
1658 - dodoc "${FILESDIR}"/openvas-nvt-sync-cron
1659 -
1660 - systemd_newtmpfilesd "${FILESDIR}"/${MY_PN}.tmpfiles.d ${MY_PN}.conf
1661 - systemd_dounit "${FILESDIR}"/${MY_PN}.service
1662 -}
1663
1664 diff --git a/net-analyzer/openvas-scanner/openvas-scanner-5.1.3.ebuild b/net-analyzer/openvas-scanner/openvas-scanner-5.1.3.ebuild
1665 index c0e59479a72..ece8f93f901 100644
1666 --- a/net-analyzer/openvas-scanner/openvas-scanner-5.1.3.ebuild
1667 +++ b/net-analyzer/openvas-scanner/openvas-scanner-5.1.3.ebuild
1668 @@ -80,10 +80,6 @@ src_install() {
1669 insinto /etc/openvas/sysconfig
1670 doins "${FILESDIR}"/${MY_PN}-daemon.conf
1671
1672 - insinto /etc/openvas/scripts
1673 - doins "${FILESDIR}"/openvas-feed-sync "${FILESDIR}"/first-start
1674 - fperms 0755 /etc/openvas/scripts/{openvas-feed-sync,first-start}
1675 -
1676 newinitd "${FILESDIR}/${MY_PN}.init" ${MY_PN}
1677 newconfd "${FILESDIR}/${MY_PN}-daemon.conf" ${MY_PN}