8655a310995549ef6eb7a8b0819fbc3f7862ba44
[ossec-hids.git] / debian / ossec-hids / var / ossec / etc / shared / cis_mysql5-6_enterprise_rcl.txt
1 # OSSEC Linux Audit - (C) 2018 
2 #
3 # Released under the same license as OSSEC.
4 # More details at the LICENSE file included with OSSEC or online
5 # at: https://github.com/ossec/ossec-hids/blob/master/LICENSE
6 #
7 # [Application name] [any or all] [reference]
8 # type:<entry name>;
9 #
10 # Type can be:
11 #             - f (for file or directory)
12 #             - p (process running)
13 #             - d (any file inside the directory)
14 #
15 # Additional values:
16 # For the registry , use "->" to look for a specific entry and another
17 # "->" to look for the value.
18 # For files, use "->" to look for a specific value in the file.
19 #
20 # Values can be preceeded by: =: (for equal) - default
21 #                             r: (for ossec regexes)
22 #                             >: (for strcmp greater)
23 #                             <: (for strcmp  lower)
24 # Multiple patterns can be specified by using " && " between them.
25 # (All of them must match for it to return true).
26
27 # CIS Checks for MYSQL 
28 # Based on Center for Internet Security Benchmark for MYSQL v1.1.0 
29 #
30 $home_dirs=/usr2/home/*,/home/*,/home,/*/home/*,/*/home,/;
31 $enviroment_files=/*/home/*/\.bashrc,/*/home/*/\.profile,/*/home/*/\.bash_profile,/home/*/\.bashrc,/home/*/\.profile,/home/*/\.bash_profile;
32 $mysql-cnfs=/etc/mysql/my.cnf,/etc/mysql/mariadb.cnf,/etc/mysql/conf.d/*.cnf,/etc/mysql/mariadb.conf.d/*.cnf,~/.my.cnf;
33 #
34 #
35 #1.3 Disable MySQL Command History
36 [CIS - MySQL Configuration - 1.3: Disable MySQL Command History] [any] [https://workbench.cisecurity.org/files/1310/download]
37 d:$home_dirs -> ^.mysql_history$;
38 #
39 #
40 #1.5 Disable Interactive Login
41 [CIS - MySQL Configuration - 1.5: Disable Interactive Login] [any] [https://workbench.cisecurity.org/files/1310/download]
42 f:/etc/passwd -> r:^mysql && !r:\.*/bin/false$|/sbin/nologin$;
43 #
44 #
45 #1.6 Verify That 'MYSQL_PWD' Is Not In Use
46 [CIS - MySQL Configuration - 1.6: 'MYSQL_PWD' Is in Use] [any] [https://workbench.cisecurity.org/files/1310/download]
47 f:$enviroment_files -> r:\.*MYSQL_PWD\.*;
48 #
49 #
50 #4.3 Ensure 'allow-suspicious-udfs' Is Set to 'FALSE' 
51 [CIS - MySQL Configuration - 4.3: 'allow-suspicious-udfs' Is Set in my.cnf'] [any] [https://workbench.cisecurity.org/files/1310/download]
52 f:$mysql-cnfs -> !r:^# && r:allow-suspicious-udfs\.+true;
53 f:$mysql-cnfs -> r:allow-suspicious-udfs\s*$;
54 #
55 #
56 #4.4 Ensure 'local_infile' Is Disabled
57 [CIS - MySQL Configuration - 4.4: local_infile is not forbidden in my.cnf] [any] [https://workbench.cisecurity.org/files/1310/download]
58 f:$mysql-cnfs -> !r:^# && r:local-infile\s*=\s*1;
59 f:$mysql-cnfs -> r:local-infile\s*$;
60 #
61 #
62 #4.5 Ensure 'mysqld' Is Not Started with '--skip-grant-tables'
63 [CIS - MySQL Configuration - 4.5: skip-grant-tables is set in my.cnf] [any] [https://workbench.cisecurity.org/files/1310/download]
64 f:$mysql-cnfs -> !r:^# && r:skip-grant-tables\s*=\s*true;
65 f:$mysql-cnfs -> !r:skip-grant-tables\s*=\s*false;
66 f:$mysql-cnfs -> r:skip-grant-tables\s*$;
67 #
68 #
69 #4.6 Ensure '--skip-symbolic-links' Is Enabled
70 [CIS - MySQL Configuration - 4.6: skip_symbolic_links is not enabled in my.cnf] [any] [https://workbench.cisecurity.org/files/1310/download]
71 f:$mysql-cnfs -> !r:^# && r:skip_symbolic_links\s*=\s*no;
72 f:$mysql-cnfs -> !r:skip_symbolic_links\s*=\s*yes;
73 f:$mysql-cnfs -> r:skip_symbolic_links\s*$;
74 #
75 #
76 #4.8 Ensure 'secure_file_priv' is not empty
77 [CIS - MySQL Configuration - 4.8: Ensure 'secure_file_priv' is not empty] [any] [https://workbench.cisecurity.org/files/1310/download]
78 f:$mysql-cnfs -> r:^# && r:secure_file_priv=\s*\S+\s*;
79 f:$mysql-cnfs -> !r:secure_file_priv=\s*\S+\s*;
80 f:$mysql-cnfs -> r:secure_file_priv\s*$;
81 #
82 #
83 #4.9 Ensure 'sql_mode' Contains 'STRICT_ALL_TABLES'
84 [CIS - MySQL Configuration - 4.9: strict_all_tables is not set at sql_mode section of my.cnf] [any] [https://workbench.cisecurity.org/files/1310/download]
85 f:$mysql-cnfs -> !r:strict_all_tables\s*$;
86 #
87 #
88 #6.1 Ensure 'log_error' is not empty
89 [CIS - MySQL Configuration - 6.1: log-error is not set in my.cnf] [any] [https://workbench.cisecurity.org/files/1310/download]
90 f:$mysql-cnfs -> r:^# && r:log_error\s*=\s*\S+\s*;
91 f:$mysql-cnfs -> !r:log_error\s*=\s*\S+\s*;
92 f:$mysql-cnfs -> r:log_error\s*$;
93 #
94 #
95 #6.2 Ensure Log Files are not Stored on a non-system partition
96 [CIS - MySQL Configuration - 6.2: log files are maybe stored on systempartition] [any] [https://workbench.cisecurity.org/files/1310/download]
97 f:$mysql-cnfs -> !r:^# && r:log_bin= && !r:\s*/\S*\s*;
98 f:$mysql-cnfs -> !r:^# && r:log_bin= && !r:\s*/var/\S*\s*;
99 f:$mysql-cnfs -> !r:^# && r:log_bin= && !r:\s*/usr/\S*\s*;
100 f:$mysql-cnfs -> r:log_bin\s*$;
101 #
102 #
103 #6.3 Ensure 'log_warning' is set to 2 at least
104 [CIS - MySQL Configuration - 6.3: log warnings is set low] [any] [https://workbench.cisecurity.org/files/1310/download]
105 f:$mysql-cnfs -> !r:^# && r:log_warnings\s*=\s*0;
106 f:$mysql-cnfs -> !r:^# && r:log_warnings\s*=\s*1;
107 f:$mysql-cnfs -> !r:log_warnings\s*=\s*\d+;
108 f:$mysql-cnfs -> r:log_warnings\s*$;
109 #
110 #
111 #6.4 Ensure 'log_raw' is set to 'off'
112 [CIS - MySQL Configuration - 6.4: log_raw is not set to off] [any] [https://workbench.cisecurity.org/files/1310/download]
113 f:$mysql-cnfs -> !r:^# && r:log-raw\s*=\s*on;
114 f:$mysql-cnfs -> r:log-raw\s*$;
115 #
116 #
117 #6.5 Ensure audit_log_connection_policy is not set to 'none'
118 [CIS - MySQL Configuration - 6.5: audit_log_connection_policy is set to 'none' change it to all or erros] [any] [https://workbench.cisecurity.org/files/1310/download]
119 f:$mysql-cnfs -> !r^# && r::audit_log_connection_policy\s*=\s*none;
120 f:$mysql-cnfs -> r:audit_log_connection_policy\s*$;
121 #
122 #
123 #6.6 Ensure audit_log_exclude_account is set to Null
124 [CIS - MySQL Configuration - 6.6:audit_log_exclude_accounts is not set to Null] [any] [https://workbench.cisecurity.org/files/1310/download]
125 f:$mysql-cnfs -> !r:^# && r:audit_log_exclude_accounts\s*=\s* && !r:null\s*$;
126 f:$mysql-cnfs -> r:audit_log_exclude_accounts\s*$;
127 #
128 #
129 #6.7 Ensure audit_log_include_accounts is set to Null
130 [CIS - MySQL Configuration - 6.7:audit_log_include_accounts is not set to Null] [any] [https://workbench.cisecurity.org/files/1310/download]
131 f:$mysql-cnfs -> !r:^# && r:audit_log_include_accounts\s*=\s* && !r:null\s*$;
132 f:$mysql-cnfs -> r:audit_log_include_accounts\s*$;
133 #
134 #
135 #6.9 Ensure audit_log_policy is not set to all 
136 [CIS - MySQL Configuration - 6.9: audit_log_policy is not set to all] [any] [https://workbench.cisecurity.org/files/1310/download]
137 f:$mysql-cnfs -> !r:^# && r:audit_log_policy\s*=\s*queries;
138 f:$mysql-cnfs -> !r:^# && r:audit_log_policy\s*=\s*none;
139 f:$mysql-cnfs -> !r:^# && r:audit_log_policy\s*=\s*logins;
140 f:$mysql-cnfs -> r:audit_log_policy\s*$;
141 #
142 #
143 #6.10 Ensure audit_log_statement_policy is set to all
144 [CIS - MySQL Configuration - 6.10: Ensure audit_log_statement_policy is set to all] [any] [https://workbench.cisecurity.org/files/1310/download]
145 f:$mysql-cnfs -> !r:^# && r:audit_log_statement_policy\.+errors;
146 f:$mysql-cnfs -> !r:^# && r:audit_log_statement_policy\.+none;
147 f:$mysql-cnfs -> r:audit_log_statement_policy\s*$;
148 #
149 #
150 #6.11 Ensure audit_log_strategy is set to synchronous or semisynchronous
151 [CIS - MySQL Configuration - 6.11: Ensure audit_log_strategy is set to all] [any] [https://workbench.cisecurity.org/files/1310/download]
152 f:$mysql-cnfs -> !r:^# && r:audit_log_strategy\.+asynchronous;
153 f:$mysql-cnfs -> !r:^# && r:audit_log_strategy\.+performance;
154 f:$mysql-cnfs -> !r:audit_log_strategy\s*=\s* && r:semisynchronous|synchronous;
155 f:$mysql-cnfs -> r:audit_log_strategy\s*$;
156 #
157 #
158 #6.12 Make sure the audit plugin can't be unloaded
159 [CIS - MySQL Configuration - 6.12: Audit plugin can be unloaded] [any] [https://workbench.cisecurity.org/files/1310/download]
160 f:$mysql-cnfs -> !r:^# && r:^audit_log\s*=\s*on\s*;
161 f:$mysql-cnfs -> !r:^# && r:^audit_log\s*=\s*off\s*;
162 f:$mysql-cnfs -> !r:^# && r:^audit_log\s*=\s*force\s*;
163 f:$mysql-cnfs -> !r:^audit_log\s*=\s*force_plus_permanent\s*;
164 f:$mysql-cnfs -> r:^audit_log\s$;
165 #
166 #
167 #7.1 Ensure 'old_password' is not set to '1' or 'On'
168 [CIS - MySQL Configuration - 7.1:Ensure 'old_passwords' is not set to '1' or 'on'] [any] [https://workbench.cisecurity.org/files/1310/download]
169 f:$mysql-cnfs -> !r:^# && r:old_passwords\s*=\s*1;
170 f:$mysql-cnfs -> !r:^# && r:old_passwords\s*=\s*on;
171 f:$mysql-cnfs -> !r:old_passwords\s*=\s*2;
172 f:$mysql-cnfs -> r:old_passwords\s*$;
173 #
174 #
175 #7.2 Ensure 'secure_auth' is set to 'ON'
176 [CIS - MySQL Configuration - 7.2: Ensure 'secure_auth' is set to 'ON'] [any] [https://workbench.cisecurity.org/files/1310/download]
177 f:$mysql-cnfs -> !r:^# && r:secure_auth\s*=\s*off;
178 f:$mysql-cnfs -> !r:secure_auth\s*=\s*on;
179 f:$mysql-cnfs -> r:secure_auth\s*$;
180 #
181 #
182 #7.3 Ensure Passwords Are Not Stored in the Global Configuration
183 [CIS - MySQL Configuration - 7.3: Passwords are stored in global configuration] [any] [https://workbench.cisecurity.org/files/1310/download]
184 f:$mysql-cnfs -> !r:^# && r:^\s*password\.*;
185 #
186 #
187 #7.4 Ensure 'sql_mode' Contains 'NO_AUTO_CREATE_USER'
188 [CIS - MySQL Configuration - 7.4: Ensure 'sql_mode' Contains 'NO_AUTO_CREATE_USER'] [any] [https://workbench.cisecurity.org/files/1310/download]
189 f:$mysql-cnfs -> !r:no_auto_create_user\s*$;
190 f:$mysql-cnfs -> r:^# && r:\s*no_auto_create_user\s*$;
191 #
192 #
193 #7.6 Ensure Password Policy is in Place
194 [CIS - MySQL Configuration - 7.6: Ensure Password Policy is in Place ] [any] [https://workbench.cisecurity.org/files/1310/download]
195 f:$mysql-cnfs -> !r:plugin-load\s*=\s*validate_password.so\s*$;
196 f:$mysql-cnfs -> !r:validate-password\s*=\s*force_plus_permanent\s*$;
197 f:$mysql-cnfs -> !r:validate_password_length\s*=\s*14\s$;
198 f:$mysql-cnfs -> !r:validate_password_mixed_case_count\s*=\s*1\s*$;
199 f:$mysql-cnfs -> !r:validate_password_number_count\s*=\s*1\s*$;
200 f:$mysql-cnfs -> !r:validate_password_special_char_count\s*=\s*1;
201 f:$mysql-cnfs -> !r:validate_password_policy\s*=\s*medium\s*;
202 #
203 #
204 #9.2 Ensure 'master_info_repository' is set to 'Table'
205 [CIS - MySQL Configuration - 9.2: Ensure 'master_info_repositrory' is set to 'Table'] [any] [https://workbench.cisecurity.org/files/1310/download]
206 f:$mysql-cnfs -> !r:^# && r:master_info_repository\s*=\s*file;
207 f:$mysql-cnfs -> !r:master_info_repository\s*=\s*table;
208 f:$mysql-cnfs -> r:master_info_repository\s*$;