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

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

#################################################################################
#
#   Lynis
# ------------------
#
# Copyright 2007-2013, Michael Boelen
# Copyright 2013-2016, 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.
#
#################################################################################
#
# Read profile/template
#
#################################################################################
#
    Display --indent 2 --text "- Checking profiles..."

    for PROFILE in ${PROFILES}; do
        LogText "Reading profile/configuration ${PROFILE}"
        FIND=`egrep "^config:|^[a-z-].*=" ${PROFILE} | sed 's/ /!space!/g'`
        for I in ${FIND}; do
            if ContainsString "config:" "${I}"; then
                # Old style configuration
                OPTION=`echo ${I} | cut -d ':' -f2`
                VALUE=`echo ${I} | cut -d ':' -f3 | sed 's/!space!/ /g'`
              else
                OPTION=`echo ${I} | cut -d '=' -f1`
                VALUE=`echo ${I} | cut -d '=' -f2 | sed 's/!space!/ /g'`
            fi
            Debug "Profile option set: ${OPTION} (with value ${VALUE})"

            case ${OPTION} in

                # Define which compliance standards are enabled
                compliance_standards)
                    COMPLIANCE_STANDARDS_ENABLED=`echo ${VALUE} | tr ',' ' '`
                    for I in ${COMPLIANCE_STANDARDS_ENABLED}; do
                        case $I in
                            cis)      COMPLIANCE_ENABLE_CIS=1      ; Debug "Compliance scanning for CIS Benchmarks is enabled" ;;
                            hipaa)    COMPLIANCE_ENABLE_HIPAA=1    ; Debug "Compliance scanning for HIPAA is enabled" ;;
                            iso27001) COMPLIANCE_ENABLE_ISO27001=1 ; Debug "Compliance scanning for ISO27001 is enabled" ;;
                            pci-dss)  COMPLIANCE_ENABLE_PCI_DSS=1  ; Debug "Compliance scanning for PCI DSS is enabled" ;;
                            *) LogText "Result: Unknown compliance standard configured" ;;
                        esac
                    done
                ;;

                # Maximum number of WAITing connections
                connections_max_wait_state)
                    OPTIONS_CONN_MAX_WAIT_STATE="${VALUE}"
                ;;

                # Append something to URL for control information
                control_url_append)
                    CONTROL_URL_APPEND="${VALUE}"
                ;;

                # Prepend an URL before control information link
                control_url_prepend)
                    CONTROL_URL_PREPEND="${VALUE}"
                ;;

                # Protocol to use for control information link
                control_url_protocol)
                    CONTROL_URL_PROTOCOL="${VALUE}"
                ;;

                # Append something to URL for control information (only applies to CUST-*)
                custom_url_append)
                    CUSTOM_URL_APPEND="${VALUE}"
                ;;

                # Prepend an URL before control information link (only applies to CUST-*)
                custom_url_prepend)
                    CUSTOM_URL_PREPEND="${VALUE}"
                ;;

                # Protocol to use for control information link
                custom_url_protocol)
                    CUSTOM_URL_PROTOCOL="${VALUE}"
                ;;

                # Do not check security repository in sources.list (Debian/Ubuntu)
                debian_skip_security_repository)
                OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY="${VALUE}"
                ;;
                debug)
                    if [ "${VALUE}" = "yes" -o "${VALUE}" = "true" ]; then
                        DEBUG=1
                    fi
                ;;

                # Show non-zero exit code when errors are found
                error-on-warnings)
                    if [ "${VALUE}" = "yes" -o "${VALUE}" = "true" -o ${VALUE} = "1" ]; then
                        ERROR_ON_WARNINGS=1
                    fi
                ;;

                # Skip FreeBSD port audit
                freebsd_skip_portaudit)
                    LogText "Option set: Skip FreeBSD portaudit"
                    OPTION_FREEBSD_SKIP_PORTAUDIT="${VALUE}"
                ;;

                # Lynis Enterprise: group name
                group)
                    GROUP_NAME="${VALUE}"
                ;;

                # Lynis Enterprise license key
                license_key)
                    LICENSE_KEY="${VALUE}"
                    Report "license_key=${LICENSE_KEY}"
                ;;

                # Do (not) log tests if they have an different operating system
                log_tests_incorrect_os)
                    LogText "Option set: No logging for incorrect OS"
                    if [ "${VALUE}" = "no" ]; then LOG_INCORRECT_OS=0; else LOG_INCORRECT_OS=1; fi
                ;;

                # What type of machine we are scanning (eg. desktop, server, server with storage)
                machine_role)
                    MACHINE_ROLE="${VALUE}"
                ;;

                # Define if any found NTP daemon instance is configured as a server or client
                ntpd_role)
                    NTPD_ROLE="${VALUE}"
                ;;

                # How much seconds to wait between tests
                pause_between_tests)
                    TEST_PAUSE_TIME="${VALUE}"
                ;;

                # Plugin
                plugin)
                    LogText "Plugin ${VALUE} enabled according profile ${PROFILE}"
                ;;

                # Plugin directory
                plugindir)
                    if [ "${PLUGINDIR}" = "" ]; then
                        PLUGINDIR="${VALUE}"
                      else
                        LogText "Plugin directory was already set to ${PLUGINDIR} before (most likely as a program argument), not overwriting"
                    fi
                ;;

                # Profile name
                profile_name)
                    PROFILE_NAME="${VALUE}"
                ;;

                # Quick (no waiting for keypresses)
                quick)
                    FIND=`echo "${VALUE}" | egrep "^(1|yes)"` && QUICKMODE=1
                    Debug "Quickmode set to ${QUICKMODE}"
                ;;

                # Inline tips about tool
                show_tool_tips)
                    SHOW_TOOL_TIPS="${VALUE}"
                ;;

                # Show warnings only
                show-warnings-only)
                    QUIET=1
                    QUICKMODE=1
                    FIND=`echo "${VALUE}" | egrep "^(1|yes)"` && SHOW_WARNINGS_ONLY=1
                    Debug "Show warnings only set to ${SHOW_WARNINGS_ONLY}"
                ;;

                # Skip plugins
                skip-plugins)
                    FIND=`echo "${VALUE}" | egrep "^(1|yes)"` && RUN_PLUGINS=0
                    Debug "Run plugins is set to ${RUN_PLUGINS}"
                ;;

                # Which tests to skip (skip-test=ABCD-1234 or skip-test=ABCD-1234:subtest)
                skip-test)
                    STRING=`echo ${VALUE} | tr '[:upper:]' '[:lower:]'`
                    SKIP_TESTS="${SKIP_TESTS} ${STRING}"
                ;;

                # Tests to always skip (useful for false positives or problematic tests)
                test_skip_always)
                    TEST_SKIP_ALWAYS="${VALUE}"
                    LogText "Tests to be skipped: ${VALUE}"
                ;;

                # Do not check the latest version on the internet
                skip_upgrade_test)
                    if [ "${VALUE}" = "yes" -o "${VALUE}" = "YES" ]; then SKIP_UPGRADE_TEST=1; else SKIP_UPGRADE_TEST=0; fi
                ;;

                # Define what kind of scan we are performing
                test_scan_mode)
                    if [ "${VALUE}" = "light" ]; then   SCAN_TEST_LIGHT="YES"; SCAN_TEST_MEDIUM="NO";  SCAN_TEST_HEAVY="NO";  fi
                    if [ "${VALUE}" = "normal" ]; then  SCAN_TEST_LIGHT="YES"; SCAN_TEST_MEDIUM="YES"; SCAN_TEST_HEAVY="NO";  fi
                    if [ "${VALUE}" = "full" ]; then    SCAN_TEST_LIGHT="YES"; SCAN_TEST_MEDIUM="YES"; SCAN_TEST_HEAVY="YES"; fi
                ;;

                # Server IP or hostname
                update_server_address)
                    UPDATE_SERVER_ADDRESS="${VALUE}"
                ;;

                # Protocol (http, https)
                update_server_protocol)
                    UPDATE_SERVER_PROTOCOL="${VALUE}"
                ;;

                # File path to tarball on server
                update_latest_version_download)
                    UPDATE_LATEST_VERSION_DOWNLOAD="${VALUE}"
                ;;

                # File path to information file
                update_latest_version_info)
                    UPDATE_LATEST_VERSION_INFO="${VALUE}"
                ;;

                # Local directory where lynis directory will be placed
                update_local_directory)
                    UPDATE_LOCAL_DIRECTORY="${VALUE}"
                ;;

                # Local file to maintain current version
                update_local_version_info)
                    UPDATE_LOCAL_VERSION_INFO="${VALUE}"
                ;;

                # Compression of uploads (enabled by default)
                upload_compressed)
                    if [ "${VALUE}" = "0" ]; then COMPRESSED_UPLOADS=0; fi
                ;;

                # Options during upload of data
                upload_options)
                    UPLOAD_OPTIONS="${VALUE}"
                ;;

                # Proxy settings
                upload_proxy_port)
                    UPLOAD_PROXY_PORT="${VALUE}"
                ;;
                upload_proxy_protocol)
                    UPLOAD_PROXY_PROTOCOL="${VALUE}"
                ;;
                upload_proxy_server)
                    UPLOAD_PROXY_SERVER="${VALUE}"
                ;;

                # Receiving system (IP address or hostname)
                upload_server)
                    UPLOAD_SERVER="${VALUE}"
                ;;

                # Verbose output (--verbose)
                verbose)
                    FIND=`echo "${VALUE}" | egrep "^(1|yes)"` && VERBOSE=1
                    Debug "Verbose set to ${VERBOSE}"
                ;;

                # Catch all bad options and bail out
                *)
                    LogText "Unknown option ${OPTION} (with value: ${VALUE})"
                    echo "Fatal error: found errors in profile ${PROFILE}"
                    echo "Unknown option '${OPTION}' found (with value: ${VALUE})"
                    ExitFatal
                ;;

            esac

        done
    done
#
#################################################################################
#
    LogText "Skip tests: ${SKIP_TESTS}"
#
#################################################################################
#
    # Add group name to report
    if [ ! "${GROUP_NAME}" = "" ]; then
        Report "group=${GROUP_NAME}"
    fi
#
#################################################################################
#
    # Set default values (only if not configured in profile)

    if [ "${MACHINE_ROLE}" = "" ]; then
        MACHINE_ROLE="server"
        LogText "Set option to default value: MACHINE_ROLE --> ${MACHINE_ROLE}"
    fi

    if [ "${NTPD_ROLE}" = "" ]; then
        NTPD_ROLE="client"
        LogText "Set option to default value: NTPD_ROLE --> ${NTPD_ROLE}"
    fi

#
#################################################################################
#

logtextbreak

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