Guest User

Untitled

a guest
Dec 5th, 2017
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.99 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ###############################################################################
  4. # OpenVAS
  5. # $Id$
  6. #
  7. # Script for checking completeness and readiness of OpenVAS.
  8. #
  9. # Authors:
  10. # Jan-Oliver Wagner <jan-oliver.wagner@greenbone.net>
  11. # Michael Wiegand <michael.wiegand@greenbone.net>
  12. #
  13. # Copyright:
  14. # Copyright (C) 2011-2016 Greenbone Networks GmbH
  15. #
  16. # This program is free software; you can redistribute it and/or modify
  17. # it under the terms of the GNU General Public License version 2,
  18. # or at your option any later version, as published by the
  19. # Free Software Foundation
  20. #
  21. # This program is distributed in the hope that it will be useful,
  22. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. # GNU General Public License for more details.
  25. #
  26. # You should have received a copy of the GNU General Public License
  27. # along with this program; if not, write to the Free Software
  28. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  29. ###############################################################################
  30.  
  31. LOG=/tmp/openvas-check-setup.log
  32. CHECKVERSION=2.3.7
  33.  
  34. if [ "$1" = "--server" -o "$2" = "--server" -o "$3" = "--server" ]
  35. then
  36. MODE="server"
  37. else
  38. MODE="desktop"
  39. fi
  40.  
  41. if [ "$1" = "--skip-nmap" -o "$2" = "--skip-nmap" -o "$3" = "--skip-nmap" ]
  42. then
  43. SKIP_NMAP="1"
  44. else
  45. SKIP_NMAP="0"
  46. fi
  47.  
  48. # Current default is OpenVAS-8:
  49. VER="8"
  50. SCANNER_MAJOR="5"
  51. SCANNER_MINOR="0"
  52. MANAGER_MAJOR="6"
  53. MANAGER_MINOR="0"
  54. ADMINISTRATOR_MAJOR="0"
  55. ADMINISTRATOR_MINOR="0"
  56. GSA_MAJOR="6"
  57. GSA_MINOR="0"
  58. CLI_MAJOR="1"
  59. CLI_MINOR="4"
  60.  
  61. if [ "$1" = "--v9" -o "$2" = "--v9" -o "$3" = "--v9" ]
  62. then
  63. VER="9"
  64. SCANNER_MAJOR="5"
  65. SCANNER_MINOR="1"
  66. MANAGER_MAJOR="7"
  67. MANAGER_MINOR="0"
  68. ADMINISTRATOR_MAJOR="0"
  69. ADMINISTRATOR_MINOR="0"
  70. GSA_MAJOR="7"
  71. GSA_MINOR="0"
  72. CLI_MAJOR="1"
  73. CLI_MINOR="4"
  74. elif [ "$1" = "--v8" -o "$2" = "--v8" -o "$3" = "--v8" ]
  75. then
  76. VER="8"
  77. SCANNER_MAJOR="5"
  78. SCANNER_MINOR="0"
  79. MANAGER_MAJOR="6"
  80. MANAGER_MINOR="0"
  81. ADMINISTRATOR_MAJOR="0"
  82. ADMINISTRATOR_MINOR="0"
  83. GSA_MAJOR="6"
  84. GSA_MINOR="0"
  85. CLI_MAJOR="1"
  86. CLI_MINOR="4"
  87. elif [ "$1" = "--v7" -o "$2" = "--v7" -o "$3" = "--v7" ]
  88. then
  89. VER="7"
  90. SCANNER_MAJOR="4"
  91. SCANNER_MINOR="0"
  92. MANAGER_MAJOR="5"
  93. MANAGER_MINOR="0"
  94. ADMINISTRATOR_MAJOR="0"
  95. ADMINISTRATOR_MINOR="0"
  96. GSA_MAJOR="5"
  97. GSA_MINOR="0"
  98. CLI_MAJOR="1"
  99. CLI_MINOR="3"
  100. elif [ "$1" = "--v6" -o "$2" = "--v6" -o "$3" = "--v6" ]
  101. then
  102. VER="6"
  103. SCANNER_MAJOR="3"
  104. SCANNER_MINOR="4"
  105. MANAGER_MAJOR="4"
  106. MANAGER_MINOR="0"
  107. ADMINISTRATOR_MAJOR="1"
  108. ADMINISTRATOR_MINOR="3"
  109. GSA_MAJOR="4"
  110. GSA_MINOR="0"
  111. CLI_MAJOR="1"
  112. CLI_MINOR="2"
  113. GSD_MAJOR="1"
  114. GSD_MINOR="2"
  115. fi
  116.  
  117. echo "openvas-check-setup $CHECKVERSION"
  118. echo " Test completeness and readiness of OpenVAS-$VER"
  119. if [ "$VER" = "8" ]
  120. then
  121. echo " (add '--v6' or '--v7' or '--v9'"
  122. echo " if you want to check for another OpenVAS version)"
  123. fi
  124. echo ""
  125. echo " Please report us any non-detected problems and"
  126. echo " help us to improve this check routine:"
  127. echo " http://lists.wald.intevation.org/mailman/listinfo/openvas-discuss"
  128. echo ""
  129. echo " Send us the log-file ($LOG) to help analyze the problem."
  130. echo ""
  131.  
  132. if [ "$MODE" = "desktop" ]
  133. then
  134. echo " Use the parameter --server to skip checks for client tools"
  135. echo " like GSD and OpenVAS-CLI."
  136. echo ""
  137. fi
  138.  
  139. log_and_print ()
  140. {
  141. echo " " $1
  142. echo " " $1 >> $LOG
  143. }
  144.  
  145. check_failed ()
  146. {
  147. echo ""
  148. echo " ERROR: Your OpenVAS-$VER installation is not yet complete!"
  149. echo ""
  150. echo "Please follow the instructions marked with FIX above and run this"
  151. echo "script again."
  152. echo ""
  153. echo "If you think this result is wrong, please report your observation"
  154. echo "and help us to improve this check routine:"
  155. echo "http://lists.wald.intevation.org/mailman/listinfo/openvas-discuss"
  156. echo "Please attach the log-file ($LOG) to help us analyze the problem."
  157. echo ""
  158. exit 1
  159. }
  160.  
  161.  
  162. # LOG start
  163. echo "openvas-check-setup $CHECKVERSION" > $LOG
  164. echo " Mode: $MODE" >> $LOG
  165. echo " Date: " `date -R` >> $LOG
  166. echo "" >> $LOG
  167.  
  168.  
  169. echo "Step 1: Checking OpenVAS Scanner ... "
  170.  
  171. echo "Checking for old OpenVAS Scanner <= 2.0 ..." >> $LOG
  172. openvasd -V >> $LOG 2>&1
  173. if [ $? -eq 0 ]
  174. then
  175. log_and_print "ERROR: Old version of OpenVAS Scanner detected."
  176. log_and_print "FIX: Please remove the installation of the old OpenVAS Scanner (openvasd)."
  177. check_failed
  178. fi
  179. echo "" >> $LOG
  180.  
  181. echo "Checking presence of OpenVAS Scanner ..." >> $LOG
  182. openvassd --version >> $LOG 2>&1
  183. if [ $? -ne 0 ]
  184. then
  185. log_and_print "ERROR: No OpenVAS Scanner (openvassd) found."
  186. log_and_print "FIX: Please install OpenVAS Scanner."
  187. check_failed
  188. fi
  189. echo "" >> $LOG
  190.  
  191. echo "Checking OpenVAS Scanner version ..." >> $LOG
  192.  
  193. VERSION=`openvassd --version 2>>$LOG | head -1 | sed -e "s/OpenVAS Scanner //"`
  194.  
  195. if [ `echo $VERSION | grep "^$SCANNER_MAJOR\.$SCANNER_MINOR" | wc -l` -ne "1" ]
  196. then
  197. log_and_print "ERROR: OpenVAS Scanner too old or too new: $VERSION"
  198. log_and_print "FIX: Please install OpenVAS Scanner $SCANNER_MAJOR.$SCANNER_MINOR."
  199. log_and_print "HINT: Please see the --v6/7/8/9 command line options to check other major versions."
  200. check_failed
  201. fi
  202. echo "" >> $LOG
  203.  
  204. log_and_print "OK: OpenVAS Scanner is present in version $VERSION."
  205.  
  206. openvassd -s >> $LOG 2>&1
  207.  
  208. OPENVASSD_CONFIG_FILE=$(openvassd -s | awk '/^config_file/ { print $3 }')
  209. if [ -n "$OPENVASSD_CONFIG_FILE" ]
  210. then
  211. if [ -e "$OPENVASSD_CONFIG_FILE" ] && [ ! -O "$OPENVASSD_CONFIG_FILE" ]
  212. then
  213. log_and_print "WARNING: The config file used by OpenVAS Scanner is not owned by the current user."
  214. log_and_print " Some of the following tests may produce incorrect results."
  215. log_and_print "SUGGEST: Run 'openvas-check-setup' as the user owning the OpenVAS Scanner installation"
  216. log_and_print " to ensure correct results."
  217. fi
  218. fi
  219.  
  220. if [ $VER -lt 9 ]
  221. then
  222. echo "Checking OpenVAS Scanner CA cert ..." >> $LOG
  223. CAFILE=`openvassd -s 2>>$LOG | grep ca_file | sed -e "s/^ca_file = //"`
  224. if [ ! -e $CAFILE ]
  225. then
  226. log_and_print "ERROR: No CA certificate file of OpenVAS Scanner found."
  227. log_and_print "FIX: Run 'openvas-mkcert'."
  228. check_failed
  229. fi
  230. echo "" >> $LOG
  231.  
  232. log_and_print "OK: OpenVAS Scanner CA Certificate is present as $CAFILE."
  233. fi
  234.  
  235. if [ "$VER" -ge 8 ]
  236. then
  237. echo "Checking presence of redis ..." >> $LOG
  238. BINARY=`redis-server --version`
  239.  
  240. if [ $? -ne 0 ]
  241. then
  242. log_and_print "ERROR: No redis-server installation found."
  243. log_and_print "FIX: You should install redis-server for improved scalability and ability to trace/debug the KB"
  244. check_failed
  245. else
  246. VERSION=`redis-server --version | awk '{ print $4 }'`
  247. if [ `echo $VERSION | grep sha` ]
  248. then
  249. VERSION=`redis-server --version | awk '{ print $3 }'`
  250. fi
  251. log_and_print "OK: redis-server is present in version $VERSION."
  252. HAVE_REDIS=1
  253. fi
  254. echo "" >> $LOG
  255.  
  256. if [ $HAVE_REDIS -eq 1 ]
  257. then
  258. echo "Checking if redis-server is configured properly to run with openVAS ..." >> $LOG
  259. REDISSOCKET=`openvassd -s 2>>$LOG | grep kb_location | sed -e "s/^kb_location = //"`
  260. if [ -z "$REDISSOCKET" ]
  261. then
  262. log_and_print "ERROR: scanner is not configured to use a redis-server socket."
  263. log_and_print "FIX: Configure the kb_location setting of the scanner to the path of the redis-server socket."
  264. check_failed
  265. else
  266. log_and_print "OK: scanner (kb_location setting) is configured properly using the redis-server socket: $REDISSOCKET"
  267. echo "Checking if redis-server is running ..." >> $LOG
  268. if [ -e $REDISSOCKET ]
  269. then
  270. log_and_print "OK: redis-server is running and listening on socket: $REDISSOCKET."
  271. else
  272. log_and_print "ERROR: redis-server is not running or not listening on socket: $REDISSOCKET"
  273. log_and_print "FIX: You should start the redis-server or configure it to listen on socket: $REDISSOCKET"
  274. check_failed
  275. fi
  276. fi
  277. log_and_print "OK: redis-server configuration is OK and redis-server is running."
  278. fi
  279.  
  280. echo "" >> $LOG
  281. fi
  282.  
  283. echo "Checking NVT collection ..." >> $LOG
  284. PLUGINSFOLDER=`openvassd -s 2>>$LOG | grep plugins_folder | sed -e "s/^plugins_folder = //"`
  285. if [ ! -d $PLUGINSFOLDER ]
  286. then
  287. log_and_print "ERROR: Directory containing the NVT collection not found."
  288. log_and_print "FIX: Run a NVT synchronization script like openvas-nvt-sync or greenbone-nvt-sync."
  289. check_failed
  290. fi
  291. OLDPLUGINSFOLDER=`echo "$PLUGINSFOLDER" | grep -q -v "/var/" 2>&1`
  292. if [ $? -eq 0 ]
  293. then
  294. CONFFILE=`openvassd -s 2>>$LOG | grep config_file | sed -e "s/^config_file = //"`
  295. log_and_print "ERROR: Your OpenVAS Scanner configuration seems to be from a pre-OpenVAS-4 installation and contains non-FHS compliant paths."
  296. log_and_print "FIX: Delete your OpenVAS Scanner Configuration file ($CONFFILE)."
  297. check_failed
  298. fi
  299. NVTCOUNT=`find $PLUGINSFOLDER -name "*nasl" | wc -l`
  300. if [ $NVTCOUNT -lt 10 ]
  301. then
  302. log_and_print "ERROR: The NVT collection is very small."
  303. if [ $VER -ge 9 ]
  304. then
  305. log_and_print "FIX: Run a synchronization script like greenbone-nvt-sync."
  306. else
  307. log_and_print "FIX: Run a synchronization script like openvas-nvt-sync or greenbone-nvt-sync."
  308. fi
  309. check_failed
  310. fi
  311. echo "" >> $LOG
  312.  
  313. log_and_print "OK: NVT collection in $PLUGINSFOLDER contains $NVTCOUNT NVTs."
  314.  
  315. echo "Checking status of signature checking in OpenVAS Scanner ..." >> $LOG
  316. NOSIGCHECK=`openvassd -s 2>>$LOG | grep nasl_no_signature_check | sed -e "s/^nasl_no_signature_check = //"`
  317. if [ $NOSIGCHECK != "no" ]
  318. then
  319. log_and_print "WARNING: Signature checking of NVTs is not enabled in OpenVAS Scanner."
  320. log_and_print "SUGGEST: Enable signature checking (see http://www.openvas.org/trusted-nvts.html)."
  321. else
  322. log_and_print "OK: Signature checking of NVTs is enabled in OpenVAS Scanner."
  323. fi
  324. echo "" >> $LOG
  325.  
  326. CACHEFOLDER=`openvassd -s 2>>$LOG | grep cache_folder | sed -e "s/^cache_folder = //"`
  327. CACHECOUNT=`find $CACHEFOLDER -name "*nvti" | wc -l`
  328. if [ $CACHECOUNT -lt $NVTCOUNT ]
  329. then
  330. log_and_print "WARNING: The initial NVT cache has not yet been generated."
  331. log_and_print "SUGGEST: Start OpenVAS Scanner for the first time to generate the cache."
  332. else
  333. log_and_print "OK: The NVT cache in $CACHEFOLDER contains $CACHECOUNT files for $NVTCOUNT NVTs."
  334. fi
  335. echo "" >> $LOG
  336.  
  337. echo "Step 2: Checking OpenVAS Manager ... "
  338.  
  339. echo "Checking presence of OpenVAS Manager ..." >> $LOG
  340. openvasmd --version >> $LOG 2>&1
  341. if [ $? -ne 0 ]
  342. then
  343. log_and_print "ERROR: No OpenVAS Manager (openvasmd) found."
  344. log_and_print "FIX: Please install OpenVAS Manager."
  345. check_failed
  346. fi
  347. echo "" >> $LOG
  348.  
  349. VERSION=`openvasmd --version | head -1 | sed -e "s/OpenVAS Manager //"`
  350.  
  351. if [ `echo $VERSION | grep "^$MANAGER_MAJOR\.$MANAGER_MINOR" | wc -l` -ne "1" ]
  352. then
  353. log_and_print "ERROR: OpenVAS Manager too old or too new: $VERSION"
  354. log_and_print "FIX: Please install OpenVAS Manager $MANAGER_MAJOR.$MANAGER_MINOR."
  355. log_and_print "HINT: Please see the --v6/7/8/9 command line options to check other major versions."
  356. check_failed
  357. fi
  358. echo "" >> $LOG
  359.  
  360. log_and_print "OK: OpenVAS Manager is present in version $VERSION."
  361.  
  362. if [ $VER -lt 9 ]
  363. then
  364. echo "Checking OpenVAS Manager client certificate ..." >> $LOG
  365. CERTDIR=`dirname $CAFILE`
  366. CLIENTCERTFILE="$CERTDIR/clientcert.pem"
  367. if [ ! -e $CLIENTCERTFILE ]
  368. then
  369. log_and_print "ERROR: No client certificate file of OpenVAS Manager found."
  370. if [ $VER -ge 7 ]
  371. then
  372. log_and_print "FIX: Run 'openvas-mkcert-client -n -i'"
  373. else
  374. log_and_print "FIX: Run 'openvas-mkcert-client -n om -i'"
  375. fi
  376. check_failed
  377. fi
  378. echo "" >> $LOG
  379.  
  380. log_and_print "OK: OpenVAS Manager client certificate is present as $CLIENTCERTFILE."
  381. fi
  382.  
  383. echo "Checking OpenVAS Manager database ..." >> $LOG
  384. # Guess openvas state dir from $PLUGINSFOLDER
  385. STATEDIR=`dirname $PLUGINSFOLDER`
  386. TASKSDB="$STATEDIR/mgr/tasks.db"
  387. if [ ! -e $TASKSDB ]
  388. then
  389. log_and_print "ERROR: No OpenVAS Manager database found. (Tried: $TASKSDB)"
  390. log_and_print "FIX: Run 'openvasmd --rebuild' while OpenVAS Scanner is running."
  391.  
  392. OPENVASSD_RUNNING=`ps -Af | grep -ic "[o]penvassd: waiting for incoming connections"`
  393. if [ $OPENVASSD_RUNNING -eq 0 ]
  394. then
  395. log_and_print "WARNING: OpenVAS Scanner is NOT running!" ;
  396. log_and_print "SUGGEST: Start OpenVAS Scanner (openvassd)." ;
  397. fi
  398.  
  399. check_failed
  400. fi
  401. echo "" >> $LOG
  402.  
  403. log_and_print "OK: OpenVAS Manager database found in $TASKSDB."
  404.  
  405. echo "Checking access rights of OpenVAS Manager database ..." >> $LOG
  406. TASKSDBPERMS=`stat -c "%a" "$TASKSDB"`
  407. if [ "$TASKSDBPERMS" != "600" ]
  408. then
  409. log_and_print "ERROR: The access rights of the OpenVAS Manager database are incorrect."
  410. log_and_print "FIX: Run 'chmod 600 $TASKSDB'."
  411. check_failed
  412. fi
  413. echo "" >> $LOG
  414.  
  415. log_and_print "OK: Access rights for the OpenVAS Manager database are correct."
  416.  
  417. echo "Checking sqlite3 presence ..." >> $LOG
  418. SQLITE3=`type sqlite3 2> /dev/null`
  419. if [ $? -ne 0 ]
  420. then
  421. log_and_print "WARNING: Could not find sqlite3 binary, extended manager checks of the OpenVAS Manager installation are disabled."
  422. log_and_print "SUGGEST: Install sqlite3."
  423. HAVE_SQLITE=0
  424. else
  425. log_and_print "OK: sqlite3 found, extended checks of the OpenVAS Manager installation enabled."
  426. HAVE_SQLITE=1
  427. fi
  428. echo "" >> $LOG
  429.  
  430. if [ $HAVE_SQLITE -eq 1 ]
  431. then
  432. echo "Checking OpenVAS Manager database revision ..." >> $LOG
  433. TASKSDBREV=`sqlite3 $TASKSDB "select value from meta where name='database_version';"`
  434. if [ -z $TASKSDBREV ]
  435. then
  436. log_and_print "ERROR: Could not determine database revision, database corrupt or in invalid format."
  437. log_and_print "FIX: Delete database at $TASKSDB and rebuild it."
  438. check_failed
  439. else
  440. log_and_print "OK: OpenVAS Manager database is at revision $TASKSDBREV."
  441. fi
  442. echo "Checking database revision expected by OpenVAS Manager ..." >> $LOG
  443. MANAGERDBREV=`openvasmd --version | grep "Manager DB revision" | sed -e "s/.*\ //"`
  444. if [ -z $MANAGERDBREV ]
  445. then
  446. log_and_print "ERROR: Could not determine database revision expected by OpenVAS Manager."
  447. log_and_print "FIX: Ensure OpenVAS Manager is installed correctly."
  448. check_failed
  449. else
  450. log_and_print "OK: OpenVAS Manager expects database at revision $MANAGERDBREV."
  451. fi
  452. if [ $TASKSDBREV -lt $MANAGERDBREV ]
  453. then
  454. log_and_print "ERROR: Database schema is out of date."
  455. log_and_print "FIX: Run 'openvasmd --migrate'."
  456. check_failed
  457. else
  458. log_and_print "OK: Database schema is up to date."
  459. fi
  460. echo "Checking OpenVAS Manager database (NVT data) ..." >> $LOG
  461. DBNVTCOUNT=`sqlite3 $TASKSDB "select count(*) from nvts;"`
  462. if [ $DBNVTCOUNT -lt 20000 ]
  463. then
  464. log_and_print "ERROR: The number of NVTs in the OpenVAS Manager database is too low."
  465. log_and_print "FIX: Make sure OpenVAS Scanner is running with an up-to-date NVT collection and run 'openvasmd --rebuild'."
  466.  
  467. OPENVASSD_RUNNING=`ps -Af | grep -ic "[o]penvassd: waiting for incoming connections"`
  468. if [ $OPENVASSD_RUNNING -eq 0 ]
  469. then
  470. log_and_print "WARNING: OpenVAS Scanner is NOT running!" ;
  471. log_and_print "SUGGEST: Start OpenVAS Scanner (openvassd)." ;
  472. fi
  473.  
  474. check_failed
  475. else
  476. log_and_print "OK: OpenVAS Manager database contains information about $DBNVTCOUNT NVTs."
  477. fi
  478. fi
  479.  
  480. if [ $ADMINISTRATOR_MAJOR = "0" ]
  481. then
  482. echo "Checking if users exist ..." >> $LOG
  483. if [ $VER != "7" ]
  484. then
  485. USERCOUNT=`openvasmd --get-users | sed -e "/^$/d" | wc -l`
  486. else
  487. USERCOUNT=`openvasmd --list-users | sed -e "/^$/d" | wc -l`
  488. fi
  489. if [ $USERCOUNT -eq 0 ]
  490. then
  491. log_and_print "ERROR: No users found. You need to create at least one user to log in."
  492. log_and_print " It is recommended to have at least one user with role Admin."
  493. log_and_print "FIX: create a user by running 'openvasmd --create-user=<name> --role=Admin && openvasmd --user=<name> --new-password=<password>'"
  494. check_failed
  495. else
  496. log_and_print "OK: At least one user exists."
  497. fi
  498. echo "" >> $LOG
  499. fi
  500.  
  501. # TODO: Do a check for presence of at least one Admin user.
  502.  
  503. echo "Checking OpenVAS SCAP database ..." >> $LOG
  504. # Guess openvas state dir from $PLUGINSFOLDER
  505. STATEDIR=`dirname $PLUGINSFOLDER`
  506. SCAPDB="$STATEDIR/scap-data/scap.db"
  507. if [ ! -e $SCAPDB ]
  508. then
  509. log_and_print "ERROR: No OpenVAS SCAP database found. (Tried: $SCAPDB)"
  510. if [ $VER -ge 9 ]
  511. then
  512. log_and_print "FIX: Run a SCAP synchronization script like greenbone-scapdata-sync."
  513. else
  514. log_and_print "FIX: Run a SCAP synchronization script like openvas-scapdata-sync or greenbone-scapdata-sync."
  515. fi
  516. check_failed
  517. fi
  518. echo "" >> $LOG
  519.  
  520. log_and_print "OK: OpenVAS SCAP database found in $SCAPDB."
  521.  
  522. if [ "$VER" -ge 6 ]
  523. then
  524. echo "Checking OpenVAS CERT database ..." >> $LOG
  525. # Guess openvas state dir from $PLUGINSFOLDER
  526. STATEDIR=`dirname $PLUGINSFOLDER`
  527. CERTDB="$STATEDIR/cert-data/cert.db"
  528. if [ ! -e $CERTDB ]
  529. then
  530. log_and_print "ERROR: No OpenVAS CERT database found. (Tried: $CERTDB)"
  531. if [ $VER -ge 9 ]
  532. then
  533. log_and_print "FIX: Run a CERT synchronization script like greenbone-certdata-sync."
  534. else
  535. log_and_print "FIX: Run a CERT synchronization script like openvas-certdata-sync or greenbone-certdata-sync."
  536. fi
  537. check_failed
  538. fi
  539. echo "" >> $LOG
  540.  
  541. log_and_print "OK: OpenVAS CERT database found in $CERTDB."
  542. fi
  543.  
  544. echo "Checking xsltproc presence ..." >> $LOG
  545. XSLTPROC=`type xsltproc 2> /dev/null`
  546. if [ $? -ne 0 ]
  547. then
  548. log_and_print "WARNING: Could not find xsltproc binary, most report formats will not work."
  549. log_and_print "SUGGEST: Install xsltproc."
  550. else
  551. log_and_print "OK: xsltproc found."
  552. fi
  553. echo "" >> $LOG
  554.  
  555.  
  556. if [ $ADMINISTRATOR_MAJOR != "0" ]
  557. then
  558. echo "Step 3: Checking OpenVAS Administrator ... "
  559.  
  560. echo "Checking presence of OpenVAS Administrator ..." >> $LOG
  561. openvasad --version >> $LOG 2>&1
  562. if [ $? -ne 0 ]
  563. then
  564. log_and_print "ERROR: No OpenVAS Administrator (openvasad) found."
  565. log_and_print "FIX: Please install OpenVAS Administrator."
  566. check_failed
  567. fi
  568. echo "" >> $LOG
  569.  
  570. VERSION=`openvasad --version | head -1 | sed -e "s/OpenVAS Administrator //"`
  571.  
  572. if [ `echo $VERSION | grep "^$ADMINISTRATOR_MAJOR\.$ADMINISTRATOR_MINOR" | wc -l` -ne "1" ]
  573. then
  574. log_and_print "ERROR: OpenVAS Administrator too old or too new: $VERSION"
  575. log_and_print "FIX: Please install OpenVAS Administrator $ADMINISTRATOR_MAJOR.$ADMINISTRATOR_MINOR."
  576. log_and_print "HINT: Please see the --v6/7/8/9 command line options to check other major versions."
  577. check_failed
  578. fi
  579. echo "" >> $LOG
  580.  
  581. log_and_print "OK: OpenVAS Administrator is present in version $VERSION."
  582.  
  583. echo "Checking if users exist ..." >> $LOG
  584. USERCOUNT=`openvasad -c "list_users" | sed -e "/^$/d" | wc -l`
  585. if [ $USERCOUNT -eq 0 ]
  586. then
  587. log_and_print "ERROR: No users found. You need to create at least one user to log in."
  588. log_and_print " It is recommended to have at least one user with role Admin."
  589. log_and_print "FIX: Create a user using 'openvasad -c 'add_user' -n <name> --role=Admin'"
  590. check_failed
  591. else
  592. log_and_print "OK: At least one user exists."
  593. fi
  594. echo "" >> $LOG
  595.  
  596. echo "Checking if at least one admin user exists ..." >> $LOG
  597. ADMINEXISTS=`ls $STATEDIR/users/*/isadmin 2> /dev/null`
  598. if [ $? -ne 0 ]
  599. then
  600. log_and_print "ERROR: No admin user found. You need to create at least one admin user to log in."
  601. log_and_print "FIX: Create a user using 'openvasad -c 'add_user' -n <name> -r Admin'"
  602. check_failed
  603. else
  604. log_and_print "OK: At least one admin user exists."
  605. fi
  606. echo "" >> $LOG
  607. else
  608. echo "Step 3: Checking user configuration ... "
  609. # TODO: Here we need new tests for presense of user and admin. Possibly based
  610. # on sqlite3 calls (which in turn means to check for sqlite3 which isn't a runtime
  611. # requirement for OpenVAS).
  612. fi
  613.  
  614. if [ $VER -ge 6 ]
  615. then
  616. echo "Checking status of password policy ..." >> $LOG
  617. CONFFILE=`openvassd -s 2>>$LOG | grep config_file | sed -e "s/^config_file = //"`
  618. CONFDIR=`dirname $CONFFILE`
  619. grep -v "^[#]" $CONFDIR/pwpolicy.conf | grep -v "^$" > /dev/null 2>&1
  620. if [ $? -ne 0 ]
  621. then
  622. log_and_print "WARNING: Your password policy is empty."
  623. log_and_print "SUGGEST: Edit the $CONFDIR/pwpolicy.conf file to set a password policy."
  624. else
  625. log_and_print "OK: The password policy file at $CONFDIR/pwpolicy.conf contains entries."
  626. fi
  627. echo "" >> $LOG
  628. fi
  629.  
  630. echo "Step 4: Checking Greenbone Security Assistant (GSA) ... "
  631.  
  632. echo "Checking presence of Greenbone Security Assistant ..." >> $LOG
  633. gsad --version >> $LOG 2>&1
  634. if [ $? -ne 0 ]
  635. then
  636. log_and_print "ERROR: No Greenbone Security Assistant (gsad) found."
  637. log_and_print "FIX: Please install Greenbone Security Assistant."
  638. check_failed
  639. fi
  640. echo "" >> $LOG
  641.  
  642. VERSION=`gsad --version | head -1 | sed -e "s/Greenbone Security Assistant //"`
  643.  
  644. if [ `echo $VERSION | grep "^$GSA_MAJOR\.$GSA_MINOR" | wc -l` -ne "1" ]
  645. then
  646. log_and_print "ERROR: Greenbone Security Assistant too old or too new: $VERSION"
  647. log_and_print "FIX: Please install Greenbone Security Assistant $GSA_MAJOR.$GSA_MINOR."
  648. log_and_print "HINT: Please see the --v6/7/8/9 command line options to check other major versions."
  649. check_failed
  650. fi
  651. echo "" >> $LOG
  652.  
  653. log_and_print "OK: Greenbone Security Assistant is present in version $VERSION."
  654.  
  655. if [ "$VER" -ge 9 ]
  656. then
  657. echo "Verifying certificate infrastructure ..." >> $LOG
  658. openvas-manage-certs -V >> $LOG 2>&1
  659. if [ $? -ne 0 ]
  660. then
  661. log_and_print "ERROR: Your OpenVAS certificate infrastructure did NOT pass validation."
  662. log_and_print "FIX: Run 'openvas-manage-certs -a'."
  663. check_failed
  664. fi
  665. echo "" >> $LOG
  666.  
  667. log_and_print "OK: Your OpenVAS certificate infrastructure passed validation."
  668. fi
  669.  
  670.  
  671. echo "Step 5: Checking OpenVAS CLI ... "
  672.  
  673. if [ "$MODE" != "server" ]
  674. then
  675. echo "Checking presence of OpenVAS CLI ..." >> $LOG
  676. omp --version >> $LOG 2>&1
  677. if [ $? -ne 0 ]
  678. then
  679. log_and_print "ERROR: No OpenVAS CLI (omp) found."
  680. log_and_print "FIX: Please install OpenVAS CLI."
  681. log_and_print "HINT: Please see the --server command line option to skip this check."
  682. check_failed
  683. fi
  684. echo "" >> $LOG
  685.  
  686. VERSION=`omp --version | head -1 | sed -e "s/OMP Command Line Interface //"`
  687.  
  688. if [ `echo $VERSION | grep "^$CLI_MAJOR\.$CLI_MINOR" | wc -l` -ne "1" ]
  689. then
  690. log_and_print "ERROR: OpenVAS CLI too old or too new: $VERSION"
  691. log_and_print "FIX: Please install OpenVAS CLI $CLI_MAJOR.$CLI_MINOR."
  692. log_and_print "HINT: Please see the --v6/7/8/9 command line options to check other major versions."
  693. check_failed
  694. fi
  695. echo "" >> $LOG
  696.  
  697. log_and_print "OK: OpenVAS CLI version $VERSION."
  698. else
  699. log_and_print "SKIP: Skipping check for OpenVAS CLI."
  700. fi
  701.  
  702.  
  703. echo "Step 6: Checking Greenbone Security Desktop (GSD) ... "
  704.  
  705. if [ "$MODE" != "server" -a "$VER" -le 6 ]
  706. then
  707. echo "Checking presence of Greenbone Security Desktop ..." >> $LOG
  708.  
  709. DISPLAY=fake gsd --version >> $LOG 2>&1
  710. if [ $? -ne 0 ]
  711. then
  712. if [ "$VER" -ge 6 ]
  713. then
  714. log_and_print "WARNING: No Greenbone Security Desktop (gsd) found or too old."
  715. log_and_print "SUGGEST: Please install Greenbone Security Desktop $GSD_MAJOR.$GSD_MINOR."
  716. else
  717. log_and_print "ERROR: No Greenbone Security Desktop (gsd) found or too old."
  718. log_and_print "FIX: Please install Greenbone Security Desktop $GSD_MAJOR.$GSD_MINOR."
  719. check_failed
  720. fi
  721. log_and_print "SKIP: Skipping further check for Greenbone Security Desktop."
  722. else
  723. echo "" >> $LOG
  724.  
  725. VERSION=`gsd --version | head -1 | sed -e "s/Greenbone Security Desktop //"`
  726.  
  727. if [ `echo $VERSION | grep "^$GSD_MAJOR\.$GSD_MINOR" | wc -l` -ne "1" ]
  728. then
  729. if [ $VER -lt "6" ]
  730. then
  731. log_and_print "ERROR: Greenbone Security Desktop too old or too new: $VERSION"
  732. log_and_print "FIX: Please install Greenbone Security Desktop $GSD_MAJOR.$GSD_MINOR."
  733. log_and_print "HINT: Please see the --v6/7/8/9 command line options to check other major versions."
  734. check_failed
  735. else
  736. log_and_print "WARNING: Greenbone Security Desktop too old or too new: $VERSION"
  737. log_and_print "SUGGEST: Please install Greenbone Security Desktop $GSD_MAJOR.$GSD_MINOR."
  738. log_and_print "HINT: Please see the --v6/7/8/9 command line options to check other major versions."
  739. fi
  740. fi
  741. echo "" >> $LOG
  742.  
  743. log_and_print "OK: Greenbone Security Desktop is present in Version $VERSION."
  744. fi
  745. else
  746. log_and_print "SKIP: Skipping check for Greenbone Security Desktop."
  747. fi
  748.  
  749.  
  750. echo "Step 7: Checking if OpenVAS services are up and running ... "
  751.  
  752. echo "Checking netstat presence ..." >> $LOG
  753. NETSTAT=`type netstat 2> /dev/null`
  754. if [ $? -ne 0 ]
  755. then
  756. log_and_print "WARNING: Could not find netstat binary, checks of the OpenVAS services are disabled."
  757. log_and_print "SUGGEST: Install netstat."
  758. HAVE_NETSTAT=0
  759. else
  760. log_and_print "OK: netstat found, extended checks of the OpenVAS services enabled."
  761. HAVE_NETSTAT=1
  762. fi
  763. echo "" >> $LOG
  764.  
  765. if [ $HAVE_NETSTAT -eq 1 ]
  766. then
  767. netstat -A inet -A inet6 -ntlp 2> /dev/null >> $LOG
  768. OPENVASSD_HOST=`netstat -A inet -A inet6 -ntlp 2> /dev/null | grep openvassd | awk -F\ '{print $4}' | awk -F: 'sub(FS $NF,x)'`
  769. OPENVASSD_PORT=`netstat -A inet -A inet6 -ntlp 2> /dev/null | grep openvassd | awk -F\ '{print $4}' | awk -F: '{print $NF}'`
  770. OPENVASMD_HOST=`netstat -A inet -A inet6 -ntlp 2> /dev/null | grep openvasmd | awk -F\ '{print $4}' | awk -F: 'sub(FS $NF,x)'`
  771. OPENVASMD_PORT=`netstat -A inet -A inet6 -ntlp 2> /dev/null | grep openvasmd | awk -F\ '{print $4}' | awk -F: '{print $NF}'`
  772. OPENVASAD_HOST=`netstat -A inet -A inet6 -ntlp 2> /dev/null | grep openvasad | awk -F\ '{print $4}' | awk -F: 'sub(FS $NF,x)'`
  773. OPENVASAD_PORT=`netstat -A inet -A inet6 -ntlp 2> /dev/null | grep openvasad | awk -F\ '{print $4}' | awk -F: '{print $NF}'`
  774. GSAD_HOST=`netstat -A inet -A inet6 -ntlp 2> /dev/null | grep gsad | awk -F\ '{print $4}' | awk -F: 'sub(FS $NF,x)'`
  775. GSAD_PORT=`netstat -A inet -A inet6 -ntlp 2> /dev/null | grep gsad | awk -F\ '{print $4}' | awk -F: '{print $NF}' | tail -1`
  776.  
  777. if [ $VER -ge 9 ]
  778. then
  779. OPENVASSD_SOCKET_FOUND=0
  780. if netstat -A unix -nlp 2> /dev/null | grep "openvassd\.sock" > /dev/null
  781. then
  782. OPENVASSD_SOCKET_FOUND=1
  783. fi
  784. if [ $OPENVASSD_SOCKET_FOUND -eq 1 ]
  785. then
  786. log_and_print "OK: OpenVAS Scanner is running and listening on a Unix domain socket."
  787. OPENVASSD_PORT=1 ;
  788. else
  789. log_and_print "ERROR: OpenVAS Scanner is NOT running!"
  790. log_and_print "FIX: Start OpenVAS Scanner (openvassd)."
  791. OPENVASSD_PORT=-1 ;
  792. fi
  793. else
  794. case "$OPENVASSD_HOST" in
  795. "0.0.0.0"|"::") log_and_print "OK: OpenVAS Scanner is running and listening on all interfaces." ;;
  796. "127.0.0.1") log_and_print "OK: OpenVAS Scanner is running and listening only on the local interface." ;;
  797. "") OPENVASSD_PROC=`ps -Af | grep -ic "[o]penvassd: waiting for incoming connections"`
  798. if [ $OPENVASSD_PROC -eq 0 ]
  799. then
  800. log_and_print "ERROR: OpenVAS Scanner is NOT running!" ;
  801. log_and_print "FIX: Start OpenVAS Scanner (openvassd)." ;
  802. OPENVASSD_PORT=-1 ;
  803. else
  804. log_and_print "WARNING: OpenVAS Scanner seems to be run by another user!" ;
  805. log_and_print "FIX: If intended this is OK (e.g. as root). But we can not determine the port." ;
  806. log_and_print "FIX: You might face subsequent problems if not intended." ;
  807. OPENVASSD_PORT=1 ;
  808. fi
  809. ;;
  810. esac
  811. case $OPENVASSD_PORT in
  812. -1) ;;
  813. 9391) log_and_print "OK: OpenVAS Scanner is listening on port 9391, which is the default port." ;;
  814. *) log_and_print "WARNING: OpenVAS Scanner is listening on port $OPENVASSD_PORT, which is NOT the default port!"
  815. log_and_print "SUGGEST: Ensure OpenVAS Scanner is listening on port 9391." ;;
  816. esac
  817. fi
  818.  
  819. if [ $VER -ge 9 ]
  820. then
  821. OPENVASMD_SOCKET_FOUND=0
  822. if netstat -A unix -nlp 2> /dev/null | grep "openvasmd\.sock" > /dev/null
  823. then
  824. OPENVASMD_SOCKET_FOUND=1
  825. fi
  826. if [ $OPENVASMD_SOCKET_FOUND -eq 1 ]
  827. then
  828. log_and_print "OK: OpenVAS Manager is running and listening on a Unix domain socket."
  829. OPENVASMD_PORT=1
  830. else
  831. case "$OPENVASMD_HOST" in
  832. "0.0.0.0"|"::") log_and_print "OK: OpenVAS Manager is running and listening on all interfaces." ;;
  833. "127.0.0.1") log_and_print "WARNING: OpenVAS Manager is running and listening only on the local interface."
  834. log_and_print "This means that you will not be able to access the OpenVAS Manager from the"
  835. log_and_print "outside using GSD or OpenVAS CLI."
  836. log_and_print "SUGGEST: Ensure that OpenVAS Manager listens on all interfaces unless you want"
  837. log_and_print "a local service only."
  838. OPENVASMD_PORT=1 ;;
  839. "") log_and_print "ERROR: OpenVAS Manager is NOT running!"
  840. log_and_print "FIX: Start OpenVAS Manager (openvasmd)."
  841. OPENVASMD_PORT=-1 ;;
  842. esac
  843. fi
  844. else
  845. case "$OPENVASMD_HOST" in
  846. "0.0.0.0"|"::") log_and_print "OK: OpenVAS Manager is running and listening on all interfaces." ;;
  847. "127.0.0.1") log_and_print "WARNING: OpenVAS Manager is running and listening only on the local interface."
  848. log_and_print "This means that you will not be able to access the OpenVAS Manager from the"
  849. log_and_print "outside using GSD or OpenVAS CLI."
  850. log_and_print "SUGGEST: Ensure that OpenVAS Manager listens on all interfaces unless you want"
  851. log_and_print "a local service only." ;;
  852. "") log_and_print "ERROR: OpenVAS Manager is NOT running!"
  853. log_and_print "FIX: Start OpenVAS Manager (openvasmd)."
  854. OPENVASMD_PORT=-1 ;;
  855. esac
  856. case $OPENVASMD_PORT in
  857. -1) ;;
  858. 9390) log_and_print "OK: OpenVAS Manager is listening on port 9390, which is the default port." ;;
  859. *) log_and_print "WARNING: OpenVAS Manager is listening on port $OPENVASMD_PORT, which is NOT the default port!"
  860. log_and_print "SUGGEST: Ensure OpenVAS Manager is listening on port 9390." ;;
  861. esac
  862. fi
  863.  
  864. if [ $ADMINISTRATOR_MAJOR != "0" ]
  865. then
  866. case "$OPENVASAD_HOST" in
  867. "0.0.0.0") log_and_print "OK: OpenVAS Administrator is running and listening on all interfaces." ;;
  868. "127.0.0.1") log_and_print "OK: OpenVAS Administrator is running and listening only on the local interface." ;;
  869. "") log_and_print "ERROR: OpenVAS Administrator is NOT running!"
  870. log_and_print "FIX: Start OpenVAS Administrator (openvasad)."
  871. OPENVASAD_PORT=-1 ;;
  872. esac
  873. case $OPENVASAD_PORT in
  874. -1) ;;
  875. 9393) log_and_print "OK: OpenVAS Administrator is listening on port 9393, which is the default port." ;;
  876. *) log_and_print "WARNING: OpenVAS Administrator is listening on port $OPENVASAD_PORT, which is NOT the default port!"
  877. log_and_print "SUGGEST: Ensure OpenVAS Administrator is listening on port 9393." ;;
  878. esac
  879. else
  880. OPENVASAD_PORT=1; # to make this not a failure because we do not need openvasad at all
  881. fi
  882.  
  883. case "$GSAD_HOST" in
  884. "0.0.0.0"|"::") log_and_print "OK: Greenbone Security Assistant is running and listening on all interfaces." ;;
  885. "127.0.0.1") log_and_print "WARNING: Greenbone Security Assistant is running and listening only on the local interface."
  886. log_and_print "This means that you will not be able to access the Greenbone Security Assistant from the"
  887. log_and_print "outside using a web browser."
  888. log_and_print "SUGGEST: Ensure that Greenbone Security Assistant listens on all interfaces." ;;
  889. "") log_and_print "ERROR: Greenbone Security Assistant is NOT running!"
  890. log_and_print "FIX: Start Greenbone Security Assistant (gsad)."
  891. GSAD_PORT=-1 ;;
  892. esac
  893. case $GSAD_PORT in
  894. -1) ;;
  895. 80|443|9392) log_and_print "OK: Greenbone Security Assistant is listening on port $GSAD_PORT, which is the default port." ;;
  896. *) log_and_print "WARNING: Greenbone Security Assistant is listening on port $GSAD_PORT, which is NOT the default port!"
  897. log_and_print "SUGGEST: Ensure Greenbone Security Assistant is listening on one of the following ports: 80, 443, 9392." ;;
  898. esac
  899.  
  900. if [ $OPENVASSD_PORT -eq -1 ] || [ $OPENVASMD_PORT -eq -1 ] || [ $OPENVASAD_PORT -eq -1 ] || [ $GSAD_PORT -eq -1 ]
  901. then
  902. check_failed
  903. fi
  904.  
  905. fi
  906.  
  907. echo "Step 8: Checking nmap installation ..."
  908.  
  909. echo "Checking presence of nmap ..." >> $LOG
  910. NMAP=`type nmap 2> /dev/null`
  911. if [ $? -ne 0 ]
  912. then
  913. if [ $SKIP_NMAP -eq 0 ]
  914. then
  915. log_and_print "ERROR: No nmap installation found."
  916. log_and_print "FIX: The predefined scan configurations needs nmap as a port scanner. You should install nmap (see http://nmap.org)."
  917. log_and_print "HINT: Please see the --skip-nmap command line option to skip this check."
  918. check_failed
  919. else
  920. log_and_print "WARNING: No nmap installation found."
  921. log_and_print "WARNING: You need to add a port scanner from the 'Port scanners' family to your custom scan config and install this port scanner on your system."
  922. fi
  923. else
  924. VERSION=`nmap --version | awk '/Nmap version/ { print $3 }'`
  925. if [ `echo $VERSION | grep "5\.51" | wc -l` -ne "1" ]
  926. then
  927. log_and_print "WARNING: Your version of nmap is not fully supported: $VERSION"
  928. log_and_print "SUGGEST: You should install nmap 5.51 if you plan to use the nmap NSE NVTs."
  929. else
  930. log_and_print "OK: nmap is present in version $VERSION."
  931. fi
  932. fi
  933. echo "" >> $LOG
  934.  
  935. echo "Step 10: Checking presence of optional tools ..."
  936.  
  937. echo "Checking presence of pdflatex ..." >> $LOG
  938. PDFLATEX=`type pdflatex 2> /dev/null`
  939. if [ $? -ne 0 ]
  940. then
  941. log_and_print "WARNING: Could not find pdflatex binary, the PDF report format will not work."
  942. log_and_print "SUGGEST: Install pdflatex."
  943. HAVE_PDFLATEX=0
  944. else
  945. log_and_print "OK: pdflatex found."
  946. HAVE_PDFLATEX=1
  947. fi
  948. echo "" >> $LOG
  949.  
  950. if [ $HAVE_PDFLATEX -eq 1 ]
  951. then
  952. echo "Checking presence of LaTeX packages required for PDF report generation ..." >> $LOG
  953. PDFTMPDIR=`mktemp -d -t openvas-check-setup-tmp.XXXXXXXXXX`
  954. TEXFILE="$PDFTMPDIR/test.tex"
  955. cat <<EOT > $TEXFILE
  956. \documentclass{article}
  957. \pagestyle{empty}
  958.  
  959. %\usepackage{color}
  960. \usepackage{tabularx}
  961. \usepackage{geometry}
  962. \usepackage{comment}
  963. \usepackage{longtable}
  964. \usepackage{titlesec}
  965. \usepackage{chngpage}
  966. \usepackage{calc}
  967. \usepackage{url}
  968. \usepackage[utf8x]{inputenc}
  969.  
  970. \DeclareUnicodeCharacter {135}{{\textascii ?}}
  971. \DeclareUnicodeCharacter {129}{{\textascii ?}}
  972. \DeclareUnicodeCharacter {128}{{\textascii ?}}
  973.  
  974. \usepackage{colortbl}
  975.  
  976. % must come last
  977. \usepackage{hyperref}
  978. \definecolor{linkblue}{rgb}{0.11,0.56,1}
  979. \definecolor{inactive}{rgb}{0.56,0.56,0.56}
  980. \definecolor{openvas_debug}{rgb}{0.78,0.78,0.78}
  981. \definecolor{openvas_false_positive}{rgb}{0.2275,0.2275,0.2275}
  982. \definecolor{openvas_log}{rgb}{0.2275,0.2275,0.2275}
  983. \definecolor{openvas_hole}{rgb}{0.7960,0.1137,0.0902}
  984. \definecolor{openvas_note}{rgb}{0.3255,0.6157,0.7961}
  985. \definecolor{openvas_report}{rgb}{0.68,0.74,0.88}
  986. \definecolor{openvas_user_note}{rgb}{1.0,1.0,0.5625}
  987. \definecolor{openvas_user_override}{rgb}{1.0,1.0,0.5625}
  988. \definecolor{openvas_warning}{rgb}{0.9764,0.6235,0.1922}
  989. \hypersetup{colorlinks=true,linkcolor=linkblue,urlcolor=blue,bookmarks=true,bookmarksopen=true}
  990. \usepackage[all]{hypcap}
  991.  
  992. %\geometry{verbose,a4paper,tmargin=24mm,bottom=24mm}
  993. \geometry{verbose,a4paper}
  994. \setlength{\parskip}{\smallskipamount}
  995. \setlength{\parindent}{0pt}
  996.  
  997. \title{PDF Report Test}
  998. \pagestyle{headings}
  999. \pagenumbering{arabic}
  1000. \begin{document}
  1001. This is a test of the PDF generation capabilities of your OpenVAS installation. Please ignore.
  1002. \end{document}
  1003. EOT
  1004. pdflatex -interaction batchmode -output-directory $PDFTMPDIR $TEXFILE > /dev/null 2>&1
  1005. if [ ! -f "$PDFTMPDIR/test.pdf" ]
  1006. then
  1007. log_and_print "WARNING: PDF generation failed, most likely due to missing LaTeX packages. The PDF report format will not work."
  1008. log_and_print "SUGGEST: Install required LaTeX packages."
  1009. else
  1010. log_and_print "OK: PDF generation successful. The PDF report format is likely to work."
  1011. fi
  1012. if [ -f "$PDFTMPDIR/test.log" ]
  1013. then
  1014. cat $PDFTMPDIR/test.log >> $LOG
  1015. fi
  1016. rm -rf $PDFTMPDIR
  1017. fi
  1018.  
  1019. echo "Checking presence of ssh-keygen ..." >> $LOG
  1020. SSHKEYGEN=`type ssh-keygen 2> /dev/null`
  1021. if [ $? -ne 0 ]
  1022. then
  1023. log_and_print "WARNING: Could not find ssh-keygen binary, LSC credential generation for GNU/Linux targets will not work."
  1024. log_and_print "SUGGEST: Install ssh-keygen."
  1025. HAVE_SSHKEYGEN=0
  1026. else
  1027. log_and_print "OK: ssh-keygen found, LSC credential generation for GNU/Linux targets is likely to work."
  1028. HAVE_SSHKEYGEN=1
  1029. fi
  1030. echo "" >> $LOG
  1031.  
  1032. if [ $HAVE_SSHKEYGEN -eq 1 ]
  1033. then
  1034. echo "Checking presence of rpm ..." >> $LOG
  1035. RPM=`type rpm 2> /dev/null`
  1036. if [ $? -ne 0 ]
  1037. then
  1038. log_and_print "WARNING: Could not find rpm binary, LSC credential package generation for RPM and DEB based targets will not work."
  1039. log_and_print "SUGGEST: Install rpm."
  1040. HAVE_RPM=0
  1041. else
  1042. log_and_print "OK: rpm found, LSC credential package generation for RPM based targets is likely to work."
  1043. HAVE_RPM=1
  1044. fi
  1045. echo "" >> $LOG
  1046.  
  1047. if [ $HAVE_RPM -eq 1 ]
  1048. then
  1049. echo "Checking presence of alien ..." >> $LOG
  1050. ALIEN=`type alien 2> /dev/null`
  1051. if [ $? -ne 0 ]
  1052. then
  1053. log_and_print "WARNING: Could not find alien binary, LSC credential package generation for DEB based targets will not work."
  1054. log_and_print "SUGGEST: Install alien."
  1055. HAVE_ALIEN=0
  1056. else
  1057. log_and_print "OK: alien found, LSC credential package generation for DEB based targets is likely to work."
  1058. HAVE_ALIEN=1
  1059. fi
  1060. echo "" >> $LOG
  1061. fi
  1062. fi
  1063.  
  1064. echo "Checking presence of nsis ..." >> $LOG
  1065. NSIS=`type makensis 2> /dev/null`
  1066. if [ $? -ne 0 ]
  1067. then
  1068. log_and_print "WARNING: Could not find makensis binary, LSC credential package generation for Microsoft Windows targets will not work."
  1069. log_and_print "SUGGEST: Install nsis."
  1070. HAVE_NSIS=0
  1071. else
  1072. log_and_print "OK: nsis found, LSC credential package generation for Microsoft Windows targets is likely to work."
  1073. HAVE_NSIS=1
  1074. fi
  1075.  
  1076. echo "Checking for SELinux ..." >> $LOG
  1077. selinux=`getenforce 2>/dev/null`
  1078. if [ $? -eq 0 ]
  1079. then
  1080. if [ $selinux != "Disabled" ]
  1081. then
  1082. log_and_print "ERROR: SELinux is enabled. For a working OpenVAS installation you need to disable it."
  1083. log_and_print "FIX: Please disable SELinux."
  1084. check_failed
  1085. else
  1086. log_and_print "OK: SELinux is disabled."
  1087. fi
  1088. fi
  1089.  
  1090. echo "" >> $LOG
  1091.  
  1092. echo ""
  1093. echo "It seems like your OpenVAS-$VER installation is OK."
  1094. echo ""
  1095. echo "If you think it is not OK, please report your observation"
  1096. echo "and help us to improve this check routine:"
  1097. echo "http://lists.wald.intevation.org/mailman/listinfo/openvas-discuss"
  1098. echo "Please attach the log-file ($LOG) to help us analyze the problem."
  1099. echo ""
Add Comment
Please, Sign In to add comment