Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tests_ports_packages « include - github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 766f301b8ded738d13aa71d34be5a399812c269a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
#!/bin/sh

#################################################################################
#
#   Lynis
# ------------------
#
# Copyright 2007-2014, Michael Boelen (michael@rootkit.nl), The Netherlands
# Web site: http://www.rootkit.nl
#
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
# welcome to redistribute it under the terms of the GNU General Public License.
# See LICENSE file for usage of this software.
#
#################################################################################
#
# Ports and packages
#
#################################################################################
#
    InsertSection "Ports and packages"
    PACKAGE_MGR_PKG=0
    PKG_AUDIT_TOOL_FOUND=0
#
#################################################################################
#
    Display --indent 2 --text "- Searching package managers"

    # Test        : PKGS-7301
    # Description : Query FreeBSD pkg
    if [ -x /usr/sbin/pkg ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7301 --preqs-met ${PREQS_MET} --weight L --network NO --description "Query NetBSD pkg"
    if [ ${SKIPTEST} -eq 0 ]; then
        FIND=`pkg -N 2>&1; echo $?`
        if [ "${FIND}" = "0" ]; then
            Display --indent 4 --text "- Searching packages with pkg" --result FOUND --color GREEN
            report "package_manager[]=pkg"
            PACKAGE_MGR_PKG=1
            #logtext "Result: Found pkg"
            #logtext "Test: Querying pkg to get package list"
            #Display --indent 6 --text "- Querying pkg for installed packages"
            #logtext "Output:"; logtext "-----"
            #SPACKAGES=`/usr/sbin/pkg_info 2>&1 | sort | tr -s ' ' | cut -d ' ' -f1 | sed -e 's/^\(.*\)-\([0-9].*\)$/\1,\2/g'`
            #for J in ${SPACKAGES}; do
            #    sPKG_NAME=`echo ${J} | cut -d ',' -f1`
            #    sPKG_VERSION=`echo ${J} | cut -d ',' -f2`
            #    logtext "Installed package: ${sPKG_NAME} (version: ${sPKG_VERSION})"
            #    report "installed_package[]=${sPKG_NAME}|${sPKG_VERSION}|"
            #done
          else
            Display --indent 4 --text "- Searching pkg" --result "NOT INSTALLED" --color YELLOW
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7302
    # Description : Query FreeBSD/NetBSD pkg_info
    if [ -x /usr/sbin/pkg_info ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7302 --preqs-met ${PREQS_MET} --weight L --network NO --description "Query FreeBSD/NetBSD pkg_info"
    if [ ${SKIPTEST} -eq 0 ]; then
        N=0
        Display --indent 4 --text "- Checking pkg_info" --result FOUND --color GREEN
        logtext "Result: Found pkg_info"
        report "package_manager[]=pkg_info"
        logtext "Test: Querying pkg_info to get package list"
        Display --indent 6 --text "- Querying pkg_info for installed packages"
        logtext "Output:"; logtext "-----"
        SPACKAGES=`/usr/sbin/pkg_info 2>&1 | sort | tr -s ' ' | cut -d ' ' -f1 | sed -e 's/^\(.*\)-\([0-9].*\)$/\1,\2/g'`
        for J in ${SPACKAGES}; do
            N=`expr ${N} + 1`
            sPKG_NAME=`echo ${J} | cut -d ',' -f1`
            sPKG_VERSION=`echo ${J} | cut -d ',' -f2`
            logtext "Installed package: ${sPKG_NAME} (version: ${sPKG_VERSION})"
            report "installed_package[]=${sPKG_NAME}|${sPKG_VERSION}|"
        done
        report "installed_packages=${N}"
    fi
#
#################################################################################
#
# Temporary disabled due false positives
# Packages like docbook, gcc, automake report multiple installed versions
#    # Test        : PKGS-7303
#    # Description : Query FreeBSD pkg_info
#    if [ -x /usr/sbin/pkg_info ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
#    Register --test-no PKGS-7303 --preqs-met ${PREQS_MET} --weight L --network NO --description "Query FreeBSD for double installed packages"
#    if [ ${SKIPTEST} -eq 0 ]; then    
#	SDOUBLEINSTALLED=`pkg_info | sort | sed -e 's/-[0-9].*$//' | uniq -c | grep -v '^[[:space:]]*1' | tr -s ' ' | cut -d ' ' -f3`
#	if [ "${SDOUBLEINSTALLED}" = "" ]; then
#	    Display --indent 6 --text "- Querying pkg_info for double installed packages" --result OK --color GREEN
#	    logtext "Ok, no packages show up twice or more in the package listing."
#	  else
#	    Display --indent 6 --text "- Querying pkg_info for double installed packages" --result WARNING --color RED
#	    for J in ${SDOUBLEINSTALLED}; do
#	        ReportWarning ${TEST_NO} "M" "Found probably incorrect installed package (${J})"
#		logtext "This package ${J} is visible twice or more in the pkg_info listing."
#		ReportSuggestion ${TEST_NO} "(FreeBSD) run pkgdb -F and check this manually."
#	        ReportSuggestion ${TEST_NO} "(OpenBSD) check dependencies to see if one of the double "
#		logtext "installed packages is unneeded."
#		report "double_installed_package[]=${J}"
#	    done
#	fi
#      else
#        Display --indent 4 --text "- Searching pkg_info" --result "NOT FOUND" --color WHITE
#	logtext "Result: pkg_info can NOT be found on this system"
#    fi    
#
#################################################################################
#
    # Test        : PKGS-7304
    # Description : Gentoo packages
    if [ -x /usr/bin/emerge -a -x /usr/bin/equery ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7304 --preqs-met ${PREQS_MET} --weight L --network NO --description "Querying Gentoo packages"
    if [ ${SKIPTEST} -eq 0 ]; then
        Display --indent 4 --text "- Searching emerge" --result FOUND --color GREEN
        logtext "Result: Found Gentoo emerge"
        report "package_manager[]=emerge"
        logtext "Test: Querying portage to get package list"
        Display --indent 4 --text "- Querying portage for installed packages"
        logtext "Output:"; logtext "-----"
        GPACKAGES=`equery l '*' | sed -e 's/[.*]//g'`
        for J in ${GPACKAGES}; do
            logtext "Found package ${J}"
            report "installed_package[]=${J}||"
        done
      else
        logtext "Result: emerge can NOT be found on this system"
    fi
#
#
#################################################################################
#
    # Test        : PKGS-7306
    # Description : Solaris packages
    if [ -x /usr/bin/pkginfo ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7306 --os Solaris --preqs-met ${PREQS_MET} --weight L --network NO --description "Querying Solaris packages"
    if [ ${SKIPTEST} -eq 0 ]; then
        Display --indent 4 --text "- Searching pkginfo" --result FOUND --color GREEN
            logtext "Result: Found Solaris pkginfo"
            report "package_manager[]=pkginfo"
            logtext "Test: Querying pkginfo to get package list"
            Display --indent 4 --text "- Querying pkginfo for installed packages"
            logtext "Output:"; logtext "-----"
            # Strip SUNW from strings
            SPACKAGES=`/usr/bin/pkginfo -i | tr -s ' ' | cut -d ' ' -f2 | sed "s#^SUNW##"`
            for J in ${SPACKAGES}; do
                logtext "Found package ${J}"
                report "installed_package[]=${J}||"
            done
      else
        logtext "Result: pkginfo can NOT be found on this system"
    fi
#
#
#################################################################################
#
    # Test        : PKGS-7308
    # Description : RPM package based systems
    if [ ! "${RPMBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7308 --preqs-met ${PREQS_MET} --weight L --network NO --description "Checking package list with RPM"
    if [ ${SKIPTEST} -eq 0 ]; then
        N=0
        Display --indent 4 --text "- Searching RPM package manager" --result FOUND --color GREEN
        logtext "Result: Found rpm binary (${RPMBINARY})"
        report "package_manager[]=rpm"
        logtext "Test: Querying 'rpm -qa' to get package list"
        Display --indent 6 --text "- Querying RPM package manager"
        logtext "Output:"; logtext "--------"
        SPACKAGES=`${RPMBINARY} -qa | sort`
        if [ "${SPACKAGES}" = "" ]; then
            logtext "Result: RPM binary available, but package list seems to be empty"
            logtext "Info: looks like the rpm binary is installed, but not used for package installation"
          else
            for J in ${SPACKAGES}; do
                N=`expr ${N} + 1`
                logtext "Found package: ${J}"
                report "installed_package[]=${J}||"
            done
            report "installed_packages=${N}"

        fi
      else
        logtext "Result: RPM binary NOT found on this system, test skipped"
    fi
#
#################################################################################
#
    # Test        : PKGS-7310
    # Description : pacman package based systems
    if [ ! "${PACMANBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7310 --preqs-met ${PREQS_MET} --weight L --network NO --description "Checking package list with pacman"
    if [ ${SKIPTEST} -eq 0 ]; then
        N=0
        Display --indent 4 --text "- Searching pacman package manager" --result FOUND --color GREEN
        logtext "Result: Found pacman binary (${PACMANBINARY})"
        report "package_manager[]=pacman"
        logtext "Test: Querying 'pacman -Q' to get package list"
        Display --indent 6 --text "- Querying pacman package manager"
        logtext "Output:"; logtext "--------"
        SPACKAGES=`${PACMANBINARY} -Q | sort | sed 's/ /,/g'`
        if [ "${SPACKAGES}" = "" ]; then
            logtext "Result: pacman binary available, but package list seems to be empty"
            logtext "Info: looks like the pacman binary is installed, but not used for package installation"
            #YYY ReportException?
          else
            for J in ${SPACKAGES}; do
                N=`expr ${N} + 1`
                PACKAGE_NAME=`echo ${J} | awk -F, '{ print $1 }'`
                PACKAGE_VERSION=`echo ${J} | awk -F, '{ print $2 }'`
                logtext "Found package: ${PACKAGE_NAME} (version: ${PACKAGE_VERSION})"
                report "installed_package[]=${PACKAGE_NAME}|${PACKAGE_VERSION}|"
            done
            report "installed_packages=${N}"
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7312
    # Description : Check for available package updates when pacman package is used (Arch Linux)
    if [ ! "${PACMANBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7312 --preqs-met ${PREQS_MET} --weight L --network NO --description "Checking available updates for pacman based system"
    if [ ${SKIPTEST} -eq 0 ]; then
        FOUND=0
        FIND=`which checkupdates`
        if [ ! "${FIND}" = "" ]; then
            FIND=`checkupdates`
            for I in ${FIND}; do
                logtext "Result: update available for ${I}"
                report "available_update[]=${I}"
                FOUND=1
            done
            if [ ${FOUND} -eq 1 ]; then
                Display --indent 4 --text "- Searching update status (checkupdates)" --result "OUTDATED" --color YELLOW
                ReportSuggestion "${TEST_NO}" "Perform update of system updates as this system uses rolling updates"
              else
                Display --indent 4 --text "- Searching update status (checkupdates)" --result "UP-TO-DATE" --color GREEN
            fi
         else
            logtext "Result: skipping this test, can't find checkupdates binary"
        fi
      else
        logtext "Result: pacman binary NOT found on this system, test skipped"
    fi
#
#################################################################################
#
    # Test        : PKGS-7314
    # Description : Check pacman.conf options
    PACMANCONF="/etc/pacman.conf"
    if [ ! "${PACMANBINARY}" = "" -a -f ${PACMANCONF} ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7314 --preqs-met ${PREQS_MET} --weight L --network NO --description "Checking pacman configuration options"
    if [ ${SKIPTEST} -eq 0 ]; then
        COUNT=0
        # Check configuration options (options start with a capital)
        logtext "Test: searching configured options in ${PACMANCONF}"
        FIND=`grep "^[A-Z]" ${PACMANCONF} | sort | uniq | sed 's/ /:space://g'`
        for I in ${FIND}; do
            PMOPTION=`echo ${I} | sed 's/:space:/ /g' | ${AWKBINARY} -F= '{ print $1 }'`
            PMVALUE=`echo ${I} | sed 's/:space:/ /g' | ${AWKBINARY} -F= '{ print $2 }'`
            logtext "Result: found option ${PMOPTION} configured with value ${PMVALUE}"
            report "pacman_option[]=${PMOPTION}:${PMVALUE}:"
        done

        # Check software repositories
        logtext "Test: checking available repositories"
        FIND=`grep "^\[.*\]$" ${PACMANCONF} | tr -d '[]'`
        for I in ${FIND}; do
            COUNT=`expr ${COUNT} + 1`
            report "package_repository[]=${I}"
        done
        logtext "Result: found ${COUNT} repositories"
    fi
#
#################################################################################
#
    # Test        : PKGS-7328
    # Description : Check installed packages with Zypper
    if [ ! "${ZYPPERBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7328 --preqs-met ${PREQS_MET} --weight L --network NO --description "Querying Zypper for installed packages"
    if [ ${SKIPTEST} -eq 0 ]; then
        N=0
        FIND=`${ZYPPERBINARY} se -i | awk '{ if ($1=="i") { print $3 } }'`
        if [ ! "${FIND}" = "" ]; then
            for I in ${FIND}; do
                N=`expr ${N} + 1`
                logtext "Installed package: ${I}"
                report "installed_package[]=${I}|-|"
            done
            report "installed_packages=${N}"
          else
            # Could not find any installed packages
            ReportException ${TEST_NO} "No installed packages found with Zypper"
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7330
    # Description : Check vulnerable packages with Zypper
    if [ ! "${ZYPPERBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7330 --preqs-met ${PREQS_MET} --weight L --network NO --description "Querying Zypper for vulnerable packages"
    if [ ${SKIPTEST} -eq 0 ]; then
        FIND=`${ZYPPERBINARY} lp | ${AWKBINARY} '{ if ($7=="security") { if ($11=="update") { print $13 } else { print $11 } } }' | sed 's/:$//' | grep -v "^$" | sort | uniq`
            if [ "${FIND}" = "" ]; then
                logtext "Result: No security updates found with Zypper"
                Display --indent 2 --text "- Using Zypper to obtain vulnerabile packages" --result NONE --color GREEN
              else
                Display --indent 2 --text "- Using Zypper to obtain vulnerabilities" --result WARNING --color RED
                logtext "Result: Zypper found one or more installed packages which are vulnerable."
                ReportWarning ${TEST_NO} "H" "Found one or more vulnerable packages installed"
                logtext "List of vulnerable packages/version:"
                for I in ${FIND}; do
                    report "vulnerable_package[]=${I}"
                    logtext "Vulnerable package: ${I}"
                    # Decrease hardening points for every found vulnerable package
                    AddHP 1 2
                done
            fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7345
    # Description : Debian package based systems (dpkg)
    if [ -x /usr/bin/dpkg ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7345 --preqs-met ${PREQS_MET} --weight L --network NO --description "Querying dpkg"
    if [ ${SKIPTEST} -eq 0 ]; then
        N=0
        Display --indent 4 --text "- Searching dpkg package manager" --result FOUND --color GREEN
        logtext "Result: Found dpkg binary"
        report "package_manager[]=dpkg"
        logtext "Test: Querying dpkg -l to get package list"
        Display --indent 6 --text "- Querying package manager"
        logtext "Output:"
        SPACKAGES=`dpkg -l 2>/dev/null | grep "^ii" | tr -s ' ' | tr ' ' '#' | sort`
        for J in ${SPACKAGES}; do
            N=`expr ${N} + 1`
            PACKAGE_NAME=`echo ${J} | cut -d '#' -f2`
            PACKAGE_VERSION=`echo ${J} | cut -d '#' -f3`
            logtext "Found package: ${PACKAGE_NAME} (version: ${PACKAGE_VERSION})"
            report "installed_package[]=${PACKAGE_NAME}|${PACKAGE_VERSION}|"
        done
        report "installed_packages=${N}"
      else
        logtext "Result: dpkg can NOT be found on this system, test skipped"
    fi
#
#################################################################################
#
    # Test        : PKGS-7346
    # Description : Check packages which are removed, but still own configuration files, cron jobs etc
    # Notes       : Cleanup: for pkg in `dpkg -l | grep "^rc" | cut -d' ' -f3`; do aptitude purge ${pkg}; done
    if [ -x /usr/bin/dpkg ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7346 --preqs-met ${PREQS_MET} --weight L --network NO --description "Search unpurged packages on system"
    if [ ${SKIPTEST} -eq 0 ]; then
        N=0
        logtext "Test: Querying dpkg -l to get unpurged packages"
        SPACKAGES=`dpkg -l 2>/dev/null | grep "^rc" | cut -d ' ' -f3 | sort`
        if [ "${SPACKAGES}" = "" ]; then
            Display --indent 4 --text "- Query unpurged packages" --result NONE --color GREEN
            logtext "Result: no packages found with left overs"
          else
            Display --indent 4 --text "- Query unpurged packages" --result FOUND --color YELLOW
            logtext "Result: found one or more packages with left over configuration files, cron jobs etc"
            logtext "Output:"
            for J in ${SPACKAGES}; do
                N=`expr ${N} + 1`
                logtext "Found unpurged package: ${J}"
            done
            ReportSuggestion ${TEST_NO} "Purge old/removed packages (${N} found) with aptitude purge or dpkg --purge command. This will cleanup old configuration files, cron jobs and startup scripts."
        fi
      else
        logtext "Result: dpkg can NOT be found on this system, test skipped"
    fi
#
#################################################################################

    # Test        : PKGS-7348
    # Description : Show unneeded distfiles if present
    # Notes       : Portsclean seems to be gone from the ports, so no suggestion or warning is
    #               issued when it's missing.
    #               Add portmaster --clean-distfiles-all
    Register --test-no PKGS-7348 --os FreeBSD --weight L --network NO --description "Check for old distfiles"
    if [ ${SKIPTEST} -eq 0 ]; then
        if [ -x /usr/local/sbin/portsclean ]; then
            FIND=`/usr/local/sbin/portsclean -n -DD | grep 'Delete' | wc -l | tr -d ' '`
            if [ ${FIND} -eq 0 ]; then
                Display --indent 2 --text "- Checking presence old distfiles" --result OK --color GREEN
                logtext "Result: no unused distfiles found"
              else
                Display --indent 2 --text "- Checking presence old distfiles" --result WARNING --color YELLOW
                logtext "Result: found ${FIND} unused distfiles"
                ReportSuggestion ${TEST_NO} "Unused distfiles found. Use portsclean to delete these files. For example: portsclean -DD."
            fi
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7378
    # Description : Query FreeBSD portmaster for available port upgrades
    if [ -x /usr/local/sbin/portmaster ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7378 --preqs-met ${PREQS_MET} --weight L --network NO --description "Query portmaster for port upgrades"
    if [ ${SKIPTEST} -eq 0 ]; then
        N=0
        logtext "Test: Querying portmaster for possible port upgrades"
        UPACKAGES=`/usr/local/sbin/portmaster -L | grep "version available" | awk '{ print $5 }'`
        for J in ${UPACKAGES}; do
            N=`expr ${N} + 1`
            logtext "Upgrade available (new version): ${J}"
            report "upgrade_available[]=${J}"
        done
        report "upgrade_available_count=${N}"
        if [ ${N} -eq 0 ]; then
            logtext "Result: no upgrades found"
            Display --indent 2 --text "- Checking portmaster for updates" --result NONE --color GREEN
          else
            Display --indent 2 --text "- Checking portmaster for updates" --result FOUND --color YELLOW
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7380
    # Description : Check for vulnerable NetBSD packages (with pkg_admin)
    Register --test-no PKGS-7381 --os NetBSD --weight L --network NO --description "Check for vulnerable NetBSD packages"
    if [ ${SKIPTEST} -eq 0 ]; then
        if [ -x /usr/sbin/pkg_admin ]; then
            FIND=`/usr/sbin/pkg_admin audit`
            PKG_AUDIT_TOOL_FOUND=1
            PKG_AUDIT_TOOL="pkg_admin audit"
            if [ "${FIND}" = "" ]; then
                logtext "Result: pkg audit results are clean"
                Display --indent 2 --text "- Checking pkg_admin audit to obtain vulnerable packages" --result NONE --color GREEN
                AddHP 2 2
            else
                Display --indent 2 --text "- Checking pkg_admin audit to obtain vulnerable packages" --result WARNING --color RED
                logtext "Result: pkg_admin audit found one or more installed packages which are vulnerable."
                ReportWarning ${TEST_NO} "M" "Found one or more vulnerable packages."
                logtext "List of vulnerable packages/version:"
                for I in `/usr/sbin/pkg_admin audit | awk '{ print $2 }' | sort | uniq`; do
                    report "vulnerable_package[]=${I}"
                    logtext "Vulnerable package: ${I}"
                    # Decrease hardening points for every found vulnerable package
                    AddHP 1 2
                done
            fi
          else
            Display --indent 2 --text "- pkg_admin audit not installed" --result "NOT FOUND" --color WHITE
            logtext "Result: pkg_admin audit not installed, skipping this vulnerability test."
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7381
    # Description : Check for vulnerable FreeBSD packages (with pkg)
    Register --test-no PKGS-7381 --os FreeBSD --weight L --network NO --description "Check for vulnerable FreeBSD packages"
    if [ ${SKIPTEST} -eq 0 ]; then
        if [ -x /usr/sbin/pkg ]; then
            FIND=`/usr/sbin/pkg audit | grep 'problem(s) in your installed packages found' | grep -v '0 problem(s) in your installed packages found'`
            PKG_AUDIT_TOOL_FOUND=1
            PKG_AUDIT_TOOL="pkg audit"
            if [ "${FIND}" = "" ]; then
                logtext "Result: pkg audit results are clean"
                Display --indent 2 --text "- Checking pkg audit to obtain vulnerable packages" --result NONE --color GREEN
              # Don't check yet, output of found vulnerable packages unclear (YYY)
              else
                logtext "Result: ${FIND}"
                #Display --indent 2 --text "- Checking pkg audit to obtain vulnerable packages" --result WARNING --color RED
                #logtext "Result: pkg audit found one or more installed packages which are vulnerable."
                #ReportWarning ${TEST_NO} "M" "Found one or more vulnerable packages."
                #ReportSuggestion ${TEST_NO} "Update your system with portupgrade or other tools"
                #logtext "List of vulnerable packages/version:"
                #for I in `/usr/sbin/pkg audit -F | grep "Affected package" | cut -d ' ' -f3 | sort | uniq`; do
                #    report "vulnerable_package[]=${I}"
                #    logtext "Vulnerable package: ${I}"
                #    # Decrease hardening points for every found vulnerable package
                #    AddHP 1 2
                #done
            fi
          else
            Display --indent 2 --text "- pkg audit not installed" --result "NOT FOUND" --color WHITE
            logtext "Result: pkg audit not installed, skipping this vulnerability test."
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7382
    # Description : Check for vulnerable FreeBSD packages
    Register --test-no PKGS-7382 --os FreeBSD --weight L --network NO --description "Check for vulnerable FreeBSD packages"
    if [ ${SKIPTEST} -eq 0 ]; then
        if [ -x /usr/local/sbin/portaudit ]; then
            PKG_AUDIT_TOOL_FOUND=1
            FIND=`/usr/local/sbin/portaudit | grep 'problem(s) in your installed packages found' | grep -v '0 problem(s) in your installed packages found'`
            if [ "${FIND}" = "" ]; then
                logtext "Result: Portaudit results are clean"
                Display --indent 2 --text "- Checking portaudit to obtain vulnerabile packages" --result NONE --color GREEN
              else
                Display --indent 2 --text "- Checking portaudit to obtain vulnerabilities" --result WARNING --color RED
                logtext "Result: Portaudit found one or more installed packages which are vulnerable."
                ReportWarning ${TEST_NO} "M" "Found one or more vulnerable packages."
                ReportSuggestion ${TEST_NO} "Update your system with portupgrade or other tools"
                logtext "List of vulnerable packages/version:"
                for I in `/usr/local/sbin/portaudit | grep "Affected package" | cut -d ' ' -f3 | sort | uniq`; do
                    report "vulnerable_package[]=${I}"
                    logtext "Vulnerable package: ${I}"
                    # Decrease hardening points for every found vulnerable package
                    AddHP 1 2
                done
            fi
          else
            # Don't advice portaudit anymore, as pkg audit is the replacement (pkgng)
            logtext "Result: Portaudit not installed, can't perform vulnerability test."
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7383
    # Description : Check for YUM package Update management
    if [ ! "${YUMBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7383 --preqs-met ${PREQS_MET} --os Linux --weight M --network NO --description "Check for YUM package Update management"
    if [ ${SKIPTEST} -eq 0 ]; then
        logtext "Test: YUM package update management"
        sFIND=`${YUMBINARY} repolist 2>/dev/null | grep repolist | sed 's/ //g' | sed 's/[,.]//g' | awk -F ":" '{print $2}'`
        if [ "$(echo ${sFIND} | egrep "^[0-9]+$")" -a "${sFIND}" = "0" ]; then
          logtext "Result: YUM package update management failed"
          Display --indent 2 --text "- Checking YUM package management consistency" --result WARNING --color RED
          ReportWarning ${TEST_NO} "M" "YUM is not properly configured or registered for this platform (no repolist found)"
          #ReportSuggestion ${TEST_NO} "Check YUM registration for repository configuration (repolist)"
        else
          logtext "Result: YUM repository available (${sFIND})"
          Display --indent 2 --text "- Checking YUM package management consistency" --result OK --color GREEN
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7384
    # Description : Search for YUM utils package
    if [ ! "${YUMBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7384 --preqs-met ${PREQS_MET} --os Linux --weight L --network NO --description "Check for YUM utils package"
    if [ ${SKIPTEST} -eq 0 ]; then
        if [ -x /usr/bin/package-cleanup ]; then
            logtext "Result: found YUM utils package (/usr/bin/package-cleanup)"
            # Check for duplicates
            logtext "Test: Checking for duplicate packages"
            FIND=`/usr/bin/package-cleanup -q --dupes > /dev/null; echo $?`
            if [ "${FIND}" = "0" ]; then
                logtext "Result: No duplicate packages found"
                Display --indent 2 --text "- Checking package database duplicates" --result OK --color GREEN
              else
                logtext "Result: One or more duplicate packages found"
                Display --indent 2 --text "- Checking package database duplicates" --result WARNING --color RED
                ReportWarning ${TEST_NO} "L" "Found one or more duplicate packages installed"
                ReportSuggestion ${TEST_NO} "Run package-cleanup to solve duplicate package problems"
            fi

            # Check for package database problems
            logtext "Test: Checking for database problems"
            FIND=`/usr/bin/package-cleanup --problems > /dev/null; echo $?`
            if [ "${FIND}" = "0" ]; then
                logtext "Result: No package database problems found"
                Display --indent 2 --text "- Checking package database for problems" --result OK --color GREEN
              else
                logtext "Result: One or more problems found in package database"
                Display --indent 2 --text "- Checking package database for problems" --result WARNING --color RED
                ReportWarning ${TEST_NO} "L" "Found one or more problems in the package database"
                ReportSuggestion ${TEST_NO} "Run package-cleanup to solve package problems"
            fi
          else
            Display --indent 2 --text "- yum-utils package not installed" --result SUGGESTION --color YELLOW
            logtext "Result: YUM utils package not found"
            ReportSuggestion ${TEST_NO} "Install package 'yum-utils' for better consistency checking of the package database"
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7386
    # Description : Search for YUM security package
    # Notes       : This test does not apply to CentOS and clones, as --security is not available
    if [ -x /usr/bin/yum ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7386 --preqs-met ${PREQS_MET} --os Linux --weight L --network NO --description "Check for YUM security package"
    if [ ${SKIPTEST} -eq 0 ]; then
        DO_TEST=0
        logtext "Test: Determining if yum-security package installed"

        # Check for built-in --security option
        if [ ${DO_TEST} -eq 0 ]; then
            FileExists /usr/share/yum-cli/cli.py
            if [ ${FILE_FOUND} -eq 1 ]; then
               SearchItem "\-\-security" "/usr/share/yum-cli/cli.py"
               if [ ${ITEM_FOUND} -eq 1 ]; then
                   DO_TEST=1
                   logtext "Result: found built-in security in yum"
               fi
            fi
        fi

        if [ ${DO_TEST} -eq 0 ]; then
            FileExists /etc/yum/pluginconf.d/security.conf
            if [ ${FILE_FOUND} -eq 1 ]; then
               SearchItem "^enabled=1$" "/etc/yum/pluginconf.d/security.conf"
               if [ ${ITEM_FOUND} -eq 1 ]; then
                   DO_TEST=1
                   logtext "Result: Found enabled plugin"
               fi
            fi
        fi

        # Check if it's installed as package (this is old style)
        if [ ${DO_TEST} -eq 0 ]; then
            FIND=`rpm -q yum-security yum-plugin-security | grep -v "not installed"`
            if [ ! "${FIND}" = "" ]; then
                logtext "Result: found yum-plugin-security package"
                DO_TEST=1
            fi
        fi

        # If we have the module of yum active, continue testing
        if [ ${DO_TEST} -eq 1 ]; then
            PKG_AUDIT_TOOL_FOUND=1
            PKG_AUDIT_TOOL="yum-security"
            logtext "Test: Checking for vulnerable packages"
            FIND2=`/usr/bin/yum list-sec security | awk '{ if($2=="security") print $3","$5 }'`
            if [ "${FIND2}" = "" ]; then
                logtext "Result: no vulnerable packages found"
                Display --indent 2 --text "- Checking missing security packages" --result OK --color GREEN
              else
                logtext "Result: found vulnerable package(s)"
                Display --indent 2 --text "- Checking missing security packages" --result WARNING --color RED
                for I in ${FIND2}; do
                    report "vulnerable_package[]=${I}"
                    logtext "Vulnerable package: ${I}"
                    AddHP 1 2
                done
                ReportWarning ${TEST_NO} "M" "Found one or more vulnerable packages."
                ReportSuggestion ${TEST_NO} "Use 'yum --security update' to update your system"
            fi
          else
            logtext "Result: yum-security package not found"
            Display --indent 2 --text "- Checking missing security packages" --result SKIPPED --color YELLOW
            ReportSuggestion ${TEST_NO} "Install package yum-plugin-security if possible, to maintain security updates easier (yum install yum-plugin-security)"
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7387
    # Description : Search for YUM GPG check
    if [ -x /usr/bin/yum ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7387 --preqs-met ${PREQS_MET} --os Linux --weight L --network NO --description "Check for GPG signing in YUM security package"
    if [ ${SKIPTEST} -eq 0 ]; then
        FOUND=0
        FileExists /etc/yum.conf
        if [ ${FILE_FOUND} -eq 1 ]; then
           SearchItem "^gpgenabled=1$" "/etc/yum.conf"; if [ ${ITEM_FOUND} -eq 1 ]; then FOUND=1; fi
           SearchItem "^gpgcheck=1$" "/etc/yum.conf"; if [ ${ITEM_FOUND} -eq 1 ]; then FOUND=1; fi
           if [ ${FOUND} -eq 1 ]; then
               logtext "Result: GPG check is enabled"
               Display --indent 2 --text "- Checking GPG checks (yum.conf)" --result OK --color GREEN
             else
               Display --indent 2 --text "- Checking GPG checks (yum.conf)" --result DISABLED --color RED
               ReportWarning ${TEST_NO} "M" "No GPG signing option found in yum.conf"
           fi
        fi
     fi
#
#################################################################################
#
    # Test        : PKGS-7388
    # Description : Check security repository in Debian/ubuntu apt sources.list file
    if [ -f /etc/apt/sources.list -a -d /etc/apt/sources.list.d ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7388 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check security repository in Debian/ubuntu apt sources.list file"
    if [ $SKIPTEST -eq 0 ]; then
        FOUND=0
        if [ ! "${OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY}" = "yes" ]; then
            if [ -f /etc/apt/sources.list ]; then
                logtext "Searching for security.debian.org/security.ubuntu.com or security repositories in /etc/apt/sources.list file"
                FIND=`egrep "security.debian.org|security.ubuntu.com|-security " /etc/apt/sources.list | grep -v '#' | sed 's/ /!space!/g'`
                if [ ! "${FIND}" = "" ]; then
                    FOUND=1
                    Display --indent 2 --text "- Checking security repository in sources.list file" --result OK --color GREEN
                    logtext "Result: Found security repository in /etc/apt/sources.list"
                    for I in ${FIND}; do
                        I=`echo ${I} | sed 's/!space!/ /g'`
                        logtext "Output: ${I}"
                    done
                fi
            fi
            if [ -d /etc/apt/sources.list.d ]; then
                logtext "Searching for security.debian.org/security.ubuntu.com or security repositories in /etc/apt/sources.list.d directory"
                FIND=`egrep "security.debian.org|security.ubuntu.com|-security " /etc/apt/sources.list.d/* | grep -v '#' | sed 's/ /!space!/g'`
                if [ ! "${FIND}" = "" ]; then
                    FOUND=1
                    Display --indent 2 --text "- Checking security repository in sources.list.d directory" --result OK --color GREEN
                    logtext "Result: Found security repository in one or more files in directory /etc/apt/sources.list.d"
                    for I in ${FIND}; do
                        I=`echo ${I} | sed 's/!space!/ /g'`
                        logtext "Output: ${I}"
                    done
                fi
            fi
            if [ ${FOUND} -eq 1 ]; then
                logtext "Result: security repository was found"
                AddHP 3 3
              else
                Display --indent 2 --text "- Checking security repository in sources.list file or directory" --result WARNING --color RED
                ReportWarning ${TEST_NO} "M" "Can't find any security repository in /etc/apt/sources.list or sources.list.d directory"
                AddHP 0 3
            fi
          else
            logtext "Skipped as option is set to ignore security repository"
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7390
    # Description : Check Ubuntu database consistency
    if [ "${LINUX_VERSION}" = "Ubuntu" -a -x /usr/bin/apt-get ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7390 --os Linux --preqs-met ${PREQS_MET} --weight L --network NO --description "Check Ubuntu database consistency"
    if [ ${SKIPTEST} -eq 0 ]; then
        logtext "Test: Package database consistency by running apt-get check"
        FIND=`/usr/bin/apt-get -q=2 check 2> /dev/null; echo $?`
        if [ "${FIND}" = "0" ]; then
            Display --indent 2 --text "- Checking APT package database" --result OK --color GREEN
            logtext "Result: package database seems to be consistent."
          else
            logtext "Result: package database is most likely NOT consistent"
            Display --indent 2 --text "- Checking APT package database" --result WARNING --color RED
            ReportWarning ${TEST_NO} "M" "apt-get check returned a non successful exit code."
            ReportSuggestion ${TEST_NO} "Run apt-get to perform a manual package database consistency check."
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7392
    # Description : Check Debian/Ubuntu vulnerable packages
    if [ -x /usr/bin/apt-get ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7392 --os Linux --preqs-met ${PREQS_MET} --weight L --network YES --description "Check for Debian/Ubuntu security updates"
    if [ ${SKIPTEST} -eq 0 ]; then
        VULNERABLE_PACKAGES_FOUND=0
        SCAN_PERFORMED=0
        # Update the repository, outdated repositories don't give much information
        logtext "Action: updating repository with apt-get"
        /usr/bin/apt-get -q=2 update
        logtext "Result: apt-get finished"
        logtext "Test: Checking if /usr/lib/update-notifier/apt-check exists"
        if [ -x /usr/lib/update-notifier/apt-check ]; then
          PKG_AUDIT_TOOL_FOUND=1
          PKG_AUDIT_TOOL="apt-check"
          logtext "Result: found /usr/lib/update-notifier/apt-check"
          logtext "Test: checking if any of the updates contain security updates"
          # apt-check binary is a script and translated. Do not search for normal text strings, but use numbered output only
          FIND=`/usr/lib/update-notifier/apt-check 2>&1 | awk -F\; '{ print $2 }'`
          # Check if we get the proper line back and amount of security patches available
          if [ "${FIND}" = "" ]; then
              logtext "Result: did not find security updates line"
              ReportSuggestion ${TEST_NO} "Check if system is up-to-date, security updates test (apt-check) gives an unexpected result"
              ReportException "${TEST_NO}:1" "Apt-check did not provide any result"
            else
              if [ "${FIND}" = "0" ]; then
                  logtext "Result: no vulnerable packages found via apt-check"
                  SCAN_PERFORMED=1
                else
                  VULNERABLE_PACKAGES_FOUND=1
                  SCAN_PERFORMED=1
                  logtext "Result: found ${FIND} security updates via apt-check"
                  AddHP 0 25
              fi
          fi
          else
            logtext "Result: apt-check (update-notifier-common) not found"
        fi

        # Trying also with apt-get directly (does not always work, as updates are distributed on both -security and -updates)
        # Show packages which would be upgraded and match 'security' in repository name
        FIND=`/usr/bin/apt-get --dry-run --show-upgraded upgrade 2> /dev/null | grep '-security' | grep "^Inst" | cut -d ' ' -f2 | sort | uniq`
        if [ ! "${FIND}" = "" ]; then
            #Display --indent 2 --text "- Checking vulnerable packages" --result WARNING --color RED
            VULNERABLE_PACKAGES_FOUND=1
            SCAN_PERFORMED=1
            logtext "Result: found vulnerable package(s) via apt-get (-security channel)"
            PKG_AUDIT_TOOL="apt-get"
            PKG_AUDIT_TOOL_FOUND=1
            for I in ${FIND}; do
                logtext "Found vulnerable package: ${I}"
                report "vulnerable_package[]=${I}"
            done
        fi
        if [ ${SCAN_PERFORMED} -eq 1 ]; then
            if [ ${VULNERABLE_PACKAGES_FOUND} -eq 1 ]; then
                ReportWarning ${TEST_NO} "M" "Found one or more vulnerable packages."
                ReportSuggestion ${TEST_NO} "Update your system with apt-get update, apt-get upgrade, apt-get dist-upgrade and/or unattended-upgrades"
                Display --indent 2 --text "- Checking vulnerable packages" --result WARNING --color RED
              else
                Display --indent 2 --text "- Checking vulnerable packages" --result OK --color GREEN
                logtext "Result: no vulnerable packages found"
            fi
          else
            Display --indent 2 --text "- Checking vulnerable packages (apt-get only)" --result DONE --color GREEN
            logtext "Result: test not fully executed (missing apt-check output)"
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7393
    # Description : Check Gentoo vulnerable packages
    if [ -x /usr/bin/emerge-webrsync ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7393 --preqs-met ${PREQS_MET} --weight L --network YES --description "Check for Gentoo vulnerable packages"
    if [ ${SKIPTEST} -eq 0 ]; then
        VULNERABLE_PACKAGES_FOUND=0
        SCAN_PERFORMED=0
        # Update portage.
        # Multiple ways to do this.  Some require extra packages to be installed,
        # others require potential firewall ports to be open, outbound.  This is the 
        # "most friendly" way.
        logtext "Action: updating portage with emerge-webrsync"
        /usr/bin/emerge-webrsync --quiet 2> /dev/null
        logtext "Result: emerge-webrsync finished"
        logtext "Test: checking if /usr/bin/glsa-check exists"
        if [ -x /usr/bin/glsa-check ]; then
            PKG_AUDIT_TOOL_FOUND=1
            PKG_AUDIT_TOOL="glsa-check"
            logtext "Result: found /usr/bin/glsa-check"
            logtext "Test: checking if there are any vulnerable packages"
            # glsa-check reports the GLSA date/ID string, not the vulnerable package.
            FIND=`/usr/bin/glsa-check -t all 2>&1 | grep -v "This system is affected by the following GLSAs:" | grep -v "This system is not affected by any of the listed GLSAs" | wc -l`
            if [ "${FIND}" = "" ]; then
                logtext "Result: unexpected result: wc should report 0 if no vulnerable packages found."
                #ReportSuggestion ${TEST_NO} "Check if system is up-to-date, security updates check (glsa-check) gives and unexpected result"
                ReportException "${TEST_NO}:1" "glsa-check did not provide any result"
              else
                if [ "${FIND}" = "0" ]; then
                    logtext "Result; no vulnerable packages found via glsa-check"
                    SCAN_PERFORMED=1
                  else
                    VULNERABLE_PACKAGES_FOUND=1
                    SCAN_PERFORMED=1
                    logtext "Result: found ${FIND} security updates with glsa-check"
                    ReportWarning "${TEST_NO}" "H" "Found ${FIND} security update(s) with glsa-check."
                    logtext "Notes: Run 'glsa-check -t all' to see which GLSA(s) were identified."
                    AddHP 0 25
                fi
            fi
          else
            logtext "Result: glsa-check tool not found"
            ReportSuggestion ${TEST_NO} "Use Emerge to install the gentoolkit package, which includes glsa-check tool for additional security checks."
        fi
    fi
#
#################################################################################
#
    # Test        : PKGS-7394
    # Description : Check Ubuntu upgradeable packages
    if [ "${LINUX_VERSION}" = "Ubuntu" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
    Register --test-no PKGS-7394 --os Linux --preqs-met ${PREQS_MET} --weight L --network YES --description "Check for Ubuntu updates"
    if [ ${SKIPTEST} -eq 0 ]; then
        logtext "Test: checking /usr/bin/apt-show-versions"
        if [ -x /usr/bin/apt-show-versions ]; then
            logtext "Result: found /usr/bin/apt-show-versions"
            logtext "Test: Checking packages which can be upgraded via apt-show-versions"
            FIND=`/usr/bin/apt-show-versions -u | sed 's/ /!space!/g'`
            if [ "${FIND}" = "" ]; then
                logtext "Result: no packages found which can be upgraded"
                Display --indent 2 --text "- Checking upgradeable packages" --result NONE --color GREEN
                AddHP 3 3
              else
                logtext "Result: found one or more packages which can be upgraded"
                Display --indent 2 --text "- Checking upgradeable packages" --result FOUND --color YELLOW
                # output: program/repository upgradeable from version X to Y
                for I in ${FIND}; do
                    I=`echo ${I} | sed 's/!space!/ /g'`
                    logtext "${I}"
                done
            fi
          else
            logtext "Result: /usr/bin/apt-show-versions not found"
            Display --indent 2 --text "- Checking upgradeable packages" --result SKIPPED --color WHITE
            ReportSuggestion ${TEST_NO} "Install package apt-show-versions for patch management purposes"
        fi
    fi

#
#################################################################################
#
    # Test        : PKGS-7398
    # Description : Check package audit tool
    Register --test-no PKGS-7398 --weight L --network YES --description "Check for package audit tool"
    if [ ${SKIPTEST} -eq 0 ]; then
        logtext "Test: checking for package audit tool"
        if [ ${PKG_AUDIT_TOOL_FOUND} -eq 0 ]; then
            Display --indent 2 --text "- Checking package audit tool" --result NONE --color RED
            ReportSuggestion ${TEST_NO} "Install a package audit tool to determine vulnerable packages"
            logtext "Result: no package audit tool found"
          else
            Display --indent 2 --text "- Checking package audit tool" --result INSTALLED --color GREEN
            Display --indent 4 --text "Found: ${PKG_AUDIT_TOOL}"
            logtext "Result: found package audit tool: ${PKG_AUDIT_TOOL}"
        fi
    fi
#
#################################################################################
#
    # Description : HP-UX packages
    # Notes       : swlist -l fileset (|grep patch) / print_manifest
#
#################################################################################
#
    # Description : AIX patches
    # Notes       : /usr/sbin/instfix -c -i | cut -d":" -f1
#
#################################################################################
#
# check for popularity-contest (Debian/Ubuntu)
# check for yum-changelog


report "pkg_audit_tool=${PKG_AUDIT_TOOL}"
report "pkg_audit_tool_found=${PKG_AUDIT_TOOL_FOUND}"

wait_for_keypress


#
#================================================================================
# Lynis - Copyright 2007-2014, Michael Boelen - www.rootkit.nl - The Netherlands