/
section_5.sp
371 lines (322 loc) · 13.7 KB
/
section_5.sp
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
locals {
cis_v200_5_common_tags = merge(local.cis_v200_common_tags, {
cis_section_id = "5"
})
}
locals {
cis_v200_5_1_common_tags = merge(local.cis_v200_5_common_tags, {
cis_section_id = "5.1"
})
cis_v200_5_2_common_tags = merge(local.cis_v200_5_common_tags, {
cis_section_id = "5.2"
})
cis_v200_5_3_common_tags = merge(local.cis_v200_5_common_tags, {
cis_section_id = "5.3"
})
}
benchmark "cis_v200_5" {
title = "5 Logging and Monitoring"
documentation = file("./cis_v200/docs/cis_v200_5.md")
children = [
benchmark.cis_v200_5_1,
benchmark.cis_v200_5_2,
benchmark.cis_v200_5_3,
control.cis_v200_5_4,
benchmark.cis_v200_5_5
]
tags = merge(local.cis_v200_5_common_tags, {
type = "Benchmark"
})
}
benchmark "cis_v200_5_1" {
title = "5.1 Configuring Diagnostic Settings"
documentation = file("./cis_v200/docs/cis_v200_5_1.md")
children = [
control.cis_v200_5_1_1,
control.cis_v200_5_1_2,
control.cis_v200_5_1_3,
control.cis_v200_5_1_4,
control.cis_v200_5_1_5,
control.cis_v200_5_1_6,
control.cis_v200_5_1_7
]
tags = merge(local.cis_v200_5_common_tags, {
type = "Benchmark"
})
}
control "cis_v200_5_1_1" {
title = "5.1.1 Ensure that a 'Diagnostic Setting' exists"
description = "Enable Diagnostic settings for exporting activity logs. Diagnostic settings are available for each individual resource within a subscription. Settings should be configured for all appropriate resources for your environment."
query = query.manual_control
documentation = file("./cis_v200/docs/cis_v200_5_1_1.md")
tags = merge(local.cis_v200_5_1_common_tags, {
cis_item_id = "5.1.1"
cis_level = "1"
cis_type = "manual"
service = "Azure/Monitor"
})
}
control "cis_v200_5_1_2" {
title = "5.1.2 Ensure Diagnostic Setting captures appropriate categories"
description = "A Diagnostic Setting must exist. If a Diagnostic Setting does not exist, the navigation and options within this recommendation will not be available. Please review the recommendation at the beginning of this subsection titled: 'Ensure that a 'Diagnostic Setting' exists.' The diagnostic setting should be configured to log the appropriate activities from the control/management plane."
query = query.monitor_diagnostic_settings_captures_proper_categories
documentation = file("./cis_v200/docs/cis_v200_5_1_2.md")
tags = merge(local.cis_v200_5_1_common_tags, {
cis_item_id = "5.1.2"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_1_3" {
title = "5.1.3 Ensure the Storage Container Storing the Activity Logs is not Publicly Accessible"
description = "The storage account container containing the activity log export should not be publicly accessible."
query = query.monitor_logs_storage_container_insights_activity_logs_not_public_accessible
documentation = file("./cis_v200/docs/cis_v200_5_1_3.md")
tags = merge(local.cis_v200_5_1_common_tags, {
cis_item_id = "5.1.3"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_1_4" {
title = "5.1.4 Ensure the storage account containing the container with activity logs is encrypted with Customer Managed Key"
description = "Storage accounts with the activity log exports can be configured to use Customer Managed Keys (CMK)."
query = query.monitor_logs_storage_container_insights_activity_logs_encrypted_with_byok
documentation = file("./cis_v200/docs/cis_v200_5_1_4.md")
tags = merge(local.cis_v200_5_1_common_tags, {
cis_item_id = "5.1.4"
cis_level = "2"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_1_5" {
title = "5.1.5 Ensure that logging for Azure Key Vault is 'Enabled'"
description = "Enable AuditEvent logging for key vault instances to ensure interactions with key vaults are logged and available."
query = query.keyvault_logging_enabled
documentation = file("./cis_v200/docs/cis_v200_5_1_5.md")
tags = merge(local.cis_v200_5_1_common_tags, {
cis_item_id = "5.1.5"
cis_level = "1"
cis_type = "automated"
service = "Azure/KeyVault"
})
}
control "cis_v200_5_1_6" {
title = "5.1.6 Ensure that Network Security Group Flow logs are captured and sent to Log Analytics"
description = "Ensure that network flow logs are captured and fed into a central log analytics workspace."
query = query.manual_control
documentation = file("./cis_v200/docs/cis_v200_5_1_6.md")
tags = merge(local.cis_v200_5_1_common_tags, {
cis_item_id = "5.1.6"
cis_level = "2"
cis_type = "manual"
service = "Azure/KeyVault"
})
}
control "cis_v200_5_1_7" {
title = "5.1.7 Ensure that logging for Azure AppService 'HTTP logs' is enabled"
description = "Enable AppServiceHTTPLogs diagnostic log category for Azure App Service instances to ensure all http requests are captured and centrally logged."
query = query.manual_control
documentation = file("./cis_v200/docs/cis_v200_5_1_7.md")
tags = merge(local.cis_v200_5_1_common_tags, {
cis_item_id = "5.1.7"
cis_level = "2"
cis_type = "manual"
service = "Azure/KeyVault"
})
}
benchmark "cis_v200_5_2" {
title = "5.2 Monitoring using Activity Log Alerts"
documentation = file("./cis_v200/docs/cis_v200_5_2.md")
children = [
control.cis_v200_5_2_1,
control.cis_v200_5_2_2,
control.cis_v200_5_2_3,
control.cis_v200_5_2_4,
control.cis_v200_5_2_5,
control.cis_v200_5_2_6,
control.cis_v200_5_2_7,
control.cis_v200_5_2_8,
control.cis_v200_5_2_9,
control.cis_v200_5_2_10
]
tags = merge(local.cis_v200_5_common_tags, {
type = "Benchmark"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_1" {
title = "5.2.1 Ensure that Activity Log Alert exists for Create Policy Assignment"
description = "Create an activity log alert for the Create Policy Assignment event."
query = query.monitor_log_alert_create_policy_assignment
documentation = file("./cis_v200/docs/cis_v200_5_2_1.md")
tags = merge(local.cis_v200_5_2_common_tags, {
cis_item_id = "5.2.1"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_2" {
title = "5.2.2 Ensure that Activity Log Alert exists for Delete Policy Assignment"
description = "Create an activity log alert for the Delete Policy Assignment event."
query = query.monitor_log_alert_delete_policy_assignment
documentation = file("./cis_v200/docs/cis_v200_5_2_2.md")
tags = merge(local.cis_v200_5_2_common_tags, {
cis_item_id = "5.2.2"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_3" {
title = "5.2.3 Ensure that Activity Log Alert exists for Create or Update Network Security Group"
description = "Create an Activity Log Alert for the Create or Update Network Security Group event."
query = query.monitor_log_alert_create_update_nsg
documentation = file("./cis_v200/docs/cis_v200_5_2_3.md")
tags = merge(local.cis_v200_5_2_common_tags, {
cis_item_id = "5.2.3"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_4" {
title = "5.2.4 Ensure that Activity Log Alert exists for Delete Network Security Group"
description = "Create an activity log alert for the Delete Network Security Group event."
query = query.monitor_log_alert_delete_nsg
documentation = file("./cis_v200/docs/cis_v200_5_2_4.md")
tags = merge(local.cis_v200_5_2_common_tags, {
cis_item_id = "5.2.4"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_5" {
title = "5.2.5 Ensure that Activity Log Alert exists for Create or Update Security Solution"
description = "Create an activity log alert for the Create or Update Security Solution event."
query = query.monitor_log_alert_create_update_security_solution
documentation = file("./cis_v200/docs/cis_v200_5_2_5.md")
tags = merge(local.cis_v200_5_2_common_tags, {
cis_item_id = "5.2.5"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_6" {
title = "5.2.6 Ensure that Activity Log Alert exists for Delete Security Solution"
description = "Create an activity log alert for the Delete Security Solution event."
query = query.monitor_log_alert_delete_security_solution
documentation = file("./cis_v200/docs/cis_v200_5_2_6.md")
tags = merge(local.cis_v200_5_2_common_tags, {
cis_item_id = "5.2.6"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_7" {
title = "5.2.7 Ensure that Activity Log Alert exists for Create or Update SQL Server Firewall Rule"
description = "Create an activity log alert for the Create or Update SQL Server Firewall Rule event."
query = query.monitor_log_alert_create_update_sql_servers_firewall_rule
documentation = file("./cis_v200/docs/cis_v200_5_2_7.md")
tags = merge(local.cis_v200_5_2_common_tags, {
cis_item_id = "5.2.7"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_8" {
title = "5.2.8 Ensure that Activity Log Alert exists for Delete SQL Server Firewall Rule"
description = "Create an activity log alert for the 'Delete SQL Server Firewall Rule.'"
query = query.monitor_log_alert_delete_sql_servers_firewall_rule
documentation = file("./cis_v200/docs/cis_v200_5_2_8.md")
tags = merge(local.cis_v200_5_2_common_tags, {
cis_item_id = "5.2.8"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_9" {
title = "5.2.9 Ensure that Activity Log Alert exists for Create or Update Public IP Address rule"
description = "Create an activity log alert for the Create or Update Public IP Addresses rule."
query = query.monitor_log_alert_create_update_public_ip_address
documentation = file("./cis_v200/docs/cis_v200_5_2_9.md")
tags = merge(local.cis_v200_5_2_common_tags, {
cis_item_id = "5.2.9"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_2_10" {
title = "5.2.10 Ensure that Activity Log Alert exists for Delete Public IP Address rule"
description = "Create an activity log alert for the Delete Public IP Address rule."
query = query.monitor_log_alert_delete_public_ip_address
documentation = file("./cis_v200/docs/cis_v200_5_2_10.md")
tags = merge(local.cis_v200_5_common_tags, {
cis_item_id = "5.2.10"
cis_level = "1"
cis_type = "automated"
service = "Azure/Monitor"
})
}
benchmark "cis_v200_5_3" {
title = "5.3 Configuring Application Insights"
documentation = file("./cis_v200/docs/cis_v200_5_3.md")
children = [
control.cis_v200_5_3_1
]
tags = merge(local.cis_v200_5_common_tags, {
type = "Benchmark"
service = "Azure/Monitor"
})
}
control "cis_v200_5_3_1" {
title = "5.3.1 Ensure Application Insights are Configured"
description = "Application Insights within Azure act as an Application Performance Monitoring solution providing valuable data into how well an application performs and additional information when performing incident response. The types of log data collected include application metrics, telemetry data, and application trace logging data providing organizations with detailed information about application activity and application transactions."
query = query.monitor_application_insights_configured
documentation = file("./cis_v200/docs/cis_v200_5_3_1.md")
tags = merge(local.cis_v140_5_common_tags, {
cis_item_id = "5.3.1"
cis_level = "2"
cis_type = "automated"
service = "Azure/Monitor"
})
}
control "cis_v200_5_4" {
title = "5.4 Ensure that Azure Monitor Resource Logging is Enabled for All Services that Support it"
description = "Resource Logs capture activity to the data access plane while the Activity log is a subscription-level log for the control plane. Resource-level diagnostic logs provide insight into operations that were performed within that resource itself; for example, reading or updating a secret from a Key Vault."
query = query.manual_control
documentation = file("./cis_v200/docs/cis_v200_5_4.md")
tags = merge(local.cis_v200_5_common_tags, {
cis_item_id = "5.4"
cis_level = "1"
cis_type = "manual"
service = "Azure/Monitor"
})
}
benchmark "cis_v200_5_5" {
title = "5.5 Ensure that SKU Basic/Consumption is not used on artifacts that need to be monitored (Particularly for Production Workloads)"
description = "The use of Basic or Free SKUs in Azure whilst cost effective have significant limitations in terms of what can be monitored and what support can be realized from Microsoft. Typically, these SKU's do not have a service SLA and Microsoft will usually refuse to provide support for them. Consequently Basic/Free SKUs should never be used for production workloads."
documentation = file("./cis_v200/docs/cis_v200_5_5.md")
children = [
control.network_lb_no_basic_sku,
control.network_public_ip_no_basic_sku,
control.network_virtual_network_gateway_no_basic_sku,
control.redis_cache_no_basic_sku
]
tags = merge(local.cis_v200_5_common_tags, {
cis_item_id = "5.5"
cis_level = "2"
cis_type = "automated"
service = "Azure/Monitor"
})
}