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

tests_storage « include - github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ac60502c4a9740fabca2dab312d83f5217435d9e (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
#!/bin/sh

#################################################################################
#
#   Lynis
# ------------------
#
# Copyright 2007-2013, Michael Boelen
# Copyright 2007-2021, CISOfy
#
# Website  : https://cisofy.com
# Blog     : http://linux-audit.com
# GitHub   : https://github.com/CISOfy/lynis
#
# 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.
#
#################################################################################
#
    InsertSection "${SECTION_STORAGE}"
#
#################################################################################
#
    AUTOMOUNTER_DAEMON_RUNNING=0
    NFS_DAEMON_RUNNING=0
    AUTOMOUNTER_DAEMON_TOOL=""
#
#################################################################################
#
    # Test        : STRG-1846
    # Description : Check for disabled firewire storage
    # Explanation : Best option is to use the install function, otherwise drivers can still be loaded manually
    Register --test-no STRG-1846 --os Linux --weight L --network NO --category security --description "Check if firewire storage is disabled"
    if [ "${SKIPTEST}" -eq 0 ]; then
        FOUND=0
        LogText "Test: Checking firewire storage driver in directory /etc/modprobe.d and configuration file /etc/modprobe.conf"
        if [ -d "${ROOTDIR}etc/modprobe.d" ]; then
            FIND=$(${LSBINARY} ${ROOTDIR}etc/modprobe.d/* 2> /dev/null)
            if [ -n "${FIND}" ]; then
                FIND1=$(${EGREPBINARY} "blacklist (ohci1394|firewire[-_]ohci|firewire-core)" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#")
                FIND2=$(${EGREPBINARY} "install (ohci1394|firewire[-_]ohci|firewire-core) /bin/(false|true)" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#")
                if [ -n "${FIND1}" ] || [ -n "${FIND2}" ]; then
                    FOUND=1
                    LogText "Result: found firewire ohci driver in disabled state"
                fi
            else
                LogText "Result: skipping ${ROOTDIR}etc/modprobe.d, directory found but no files in it"
            fi
        fi
        if [ -f "${ROOTDIR}etc/modprobe.conf" ]; then
            FIND1=$(${EGREPBINARY} -r "blacklist (ohci1394|firewire[-_]ohci|firewire-core)" "${ROOTDIR}etc/modprobe.conf" | ${GREPBINARY} -v "#")
            FIND2=$(${EGREPBINARY} -r "install (ohci1394|firewire[-_]ohci|firewire-core) /bin/(false|true)" "${ROOTDIR}etc/modprobe.conf" | ${GREPBINARY} -v "#")
            if [ -n "${FIND1}" ] || [ -n "${FIND2}" ]; then
                FOUND=1
                LogText "Result: found firewire ohci driver in disabled state"
            fi
        fi

        if [ ${FOUND} -eq 0 ]; then
            LogText "Result: firewire ohci driver is not explicitly disabled"
            Display --indent 2 --text "- Checking firewire ohci driver (modprobe config)" --result "${STATUS_NOT_DISABLED}" --color WHITE
            ReportSuggestion "${TEST_NO}" "Disable drivers like firewire storage when not used, to prevent unauthorized storage or data theft"
            # after blacklisting modules, make sure to remove them from the initram filesystem: update-initramfs -u
            AddHP 2 3
        else
            LogText "Result: firewire ohci driver is disabled"
            Display --indent 2 --text "- Checking firewire ohci driver (modprobe config)" --result "${STATUS_DISABLED}" --color GREEN
            AddHP 3 3
        fi
    fi
#
#################################################################################
#

WaitForKeyPress

#
#================================================================================
# Lynis - Copyright 2007-2021, CISOfy, Michael Boelen - https://cisofy.com