Debian Codegraph @

ansible_collections/splunk/es/plugins/modules/splunk_adaptive_response_notable_events.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright 2022 Red Hat
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 DOCUMENTATION = """
8 ---
9 module: splunk_adaptive_response_notable_events
10 short_description: Manage Adaptive Responses notable events resource module
11 description:
12 - This module allows for creation, deletion, and modification of Splunk
13 Enterprise Security Notable Event Adaptive Responses that are associated
14 with a correlation search
15 - Tested against Splunk Enterprise Server 8.2.3
16 version_added: "2.1.0"
17 options:
18 config:
19 description:
20 - Configure file and directory monitoring on the system
21 type: list
22 elements: dict
23 suboptions:
24 name:
25 description:
26 - Name of notable event
27 type: str
28 correlation_search_name:
29 description:
30 - Name of correlation search to associate this notable event adaptive response with
31 required: true
32 type: str
33 description:
34 description:
35 - Description of the notable event, this will populate the description field for the web console
36 type: str
37 security_domain:
38 description:
39 - Splunk Security Domain
40 type: str
41 choices:
42 - "access"
43 - "endpoint"
44 - "network"
45 - "threat"
46 - "identity"
47 - "audit"
48 default: "threat"
49 severity:
50 description:
51 - Severity rating
52 type: str
53 choices:
54 - "informational"
55 - "low"
56 - "medium"
57 - "high"
58 - "critical"
59 - "unknown"
60 default: "high"
61 default_owner:
62 description:
63 - Default owner of the notable event, if unset it will default to Splunk System Defaults
64 type: str
65 default_status:
66 description:
67 - Default status of the notable event, if unset it will default to Splunk System Defaults
68 type: str
69 choices:
70 - "unassigned"
71 - "new"
72 - "in progress"
73 - "pending"
74 - "resolved"
75 - "closed"
76 drilldown_name:
77 description:
78 - Name for drill down search, Supports variable substitution with fields from the matching event.
79 type: str
80 drilldown_search:
81 description:
82 - Drill down search, Supports variable substitution with fields from the matching event.
83 type: str
84 drilldown_earliest_offset:
85 description:
86 - Set the amount of time before the triggering event to search for related
87 events. For example, 2h. Use '$info_min_time$' to set the drill-down time
88 to match the earliest time of the search
89 type: str
90 default: '$info_min_time$'
91 drilldown_latest_offset:
92 description:
93 - Set the amount of time after the triggering event to search for related
94 events. For example, 1m. Use '$info_max_time$' to set the drill-down
95 time to match the latest time of the search
96 type: str
97 default: '$info_max_time$'
98 investigation_profiles:
99 description:
100 - Investigation profile to associate the notable event with.
101 type: list
102 elements: str
103 next_steps:
104 description:
105 - List of adaptive responses that should be run next
106 - Describe next steps and response actions that an analyst could take to address this threat.
107 type: list
108 elements: str
109 recommended_actions:
110 description:
111 - List of adaptive responses that are recommended to be run next
112 - Identifying Recommended Adaptive Responses will highlight those actions
113 for the analyst when looking at the list of response actions available,
114 making it easier to find them among the longer list of available actions.
115 type: list
116 elements: str
117 extract_artifacts:
118 description:
119 - Assets and identities to be extracted
120 type: dict
121 suboptions:
122 asset:
123 description:
124 - list of assets to extract, select any one or many of the available choices
125 - defaults to all available choices
126 type: list
127 elements: str
128 choices:
129 - src
130 - dest
131 - dvc
132 - orig_host
133 file:
134 description:
135 - list of files to extract
136 type: list
137 elements: str
138 identity:
139 description:
140 - list of identity fields to extract, select any one or many of the available choices
141 - defaults to 'user' and 'src_user'
142 type: list
143 elements: str
144 choices:
145 - user
146 - src_user
147 - src_user_id
148 - user_id
149 - src_user_role
150 - user_role
151 - vendor_account
152 url:
153 description:
154 - list of URLs to extract
155 type: list
156 elements: str
157 running_config:
158 description:
159 - The module, by default, will connect to the remote device and retrieve the current
160 running-config to use as a base for comparing against the contents of source.
161 There are times when it is not desirable to have the task get the current running-config
162 for every task in a playbook. The I(running_config) argument allows the implementer
163 to pass in the configuration to use as the base config for comparison. This
164 value of this option should be the output received from device by executing
165 command.
166 type: str
167 state:
168 description:
169 - The state the configuration should be left in
170 type: str
171 choices:
172 - merged
173 - replaced
174 - deleted
175 - gathered
176 default: merged
177
178 author: Ansible Security Automation Team (@pranav-bhatt) <https://github.com/ansible-security>
179 """
180
181 EXAMPLES = """
182 # Using gathered
183 # --------------
184
185 - name: Gather adaptive response notable events config
186 splunk.es.splunk_adaptive_response_notable_events:
187 config:
188 - correlation_search_name: Ansible Test
189 - correlation_search_name: Ansible Test 2
190 state: gathered
191
192 # RUN output:
193 # -----------
194
195 # "gathered": [
196 # {
197 # "correlation_search_name": "Ansible Test",
198 # "description": "test notable event",
199 # "drilldown_earliest_offset": "$info_min_time$",
200 # "drilldown_latest_offset": "$info_max_time$",
201 # "drilldown_name": "test_drill_name",
202 # "drilldown_search": "test_drill",
203 # "extract_artifacts": {
204 # "asset": [
205 # "src",
206 # "dest",
207 # "dvc",
208 # "orig_host"
209 # ],
210 # "identity": [
211 # "src_user",
212 # "user",
213 # "src_user_id",
214 # "src_user_role",
215 # "user_id",
216 # "user_role",
217 # "vendor_account"
218 # ]
219 # },
220 # "investigation_profiles": [
221 # "test profile 1",
222 # "test profile 2",
223 # "test profile 3"
224 # ],
225 # "next_steps": [
226 # "makestreams",
227 # "nbtstat",
228 # "nslookup"
229 # ],
230 # "name": "ansible_test_notable",
231 # "recommended_actions": [
232 # "email",
233 # "logevent",
234 # "makestreams",
235 # "nbtstat"
236 # ],
237 # "security_domain": "threat",
238 # "severity": "high"
239 # },
240 # { } # there is no configuration associated with "/var"
241 # ]
242
243 # Using merged
244 # ------------
245
246 - name: Example to add config
247 splunk.es.splunk_adaptive_response_notable_events:
248 config:
249 - correlation_search_name: Ansible Test
250 description: test notable event
251 drilldown_earliest_offset: $info_min_time$
252 drilldown_latest_offset: $info_max_time$
253 extract_artifacts:
254 asset:
255 - src
256 - dest
257 identity:
258 - src_user
259 - user
260 - src_user_id
261 next_steps:
262 - makestreams
263 name: ansible_test_notable
264 recommended_actions:
265 - email
266 - logevent
267 security_domain: threat
268 severity: high
269 state: merged
270
271 # RUN output:
272 # -----------
273
274 # "after": [
275 # {
276 # "correlation_search_name": "Ansible Test",
277 # "description": "test notable event",
278 # "drilldown_earliest_offset": "$info_min_time$",
279 # "drilldown_latest_offset": "$info_max_time$",
280 # "drilldown_name": "test_drill_name",
281 # "drilldown_search": "test_drill",
282 # "extract_artifacts": {
283 # "asset": [
284 # "src",
285 # "dest",
286 # "dvc",
287 # "orig_host"
288 # ],
289 # "identity": [
290 # "src_user",
291 # "user",
292 # "src_user_id",
293 # "src_user_role",
294 # "user_id",
295 # "user_role",
296 # "vendor_account"
297 # ]
298 # },
299 # "investigation_profiles": [
300 # "test profile 1",
301 # "test profile 2",
302 # "test profile 3"
303 # ],
304 # "next_steps": [
305 # "makestreams",
306 # "nbtstat",
307 # "nslookup"
308 # ],
309 # "name": "ansible_test_notable",
310 # "recommended_actions": [
311 # "email",
312 # "logevent",
313 # "makestreams",
314 # "nbtstat"
315 # ],
316 # "security_domain": "threat",
317 # "severity": "high"
318 # }
319 # ],
320 # "before": [],
321
322 # Using replaced
323 # --------------
324
325 - name: Example to Replace the config
326 splunk.es.splunk_adaptive_response_notable_events:
327 config:
328 - correlation_search_name: Ansible Test
329 description: test notable event
330 drilldown_earliest_offset: $info_min_time$
331 drilldown_latest_offset: $info_max_time$
332 extract_artifacts:
333 asset:
334 - src
335 - dest
336 identity:
337 - src_user
338 - user
339 - src_user_id
340 next_steps:
341 - makestreams
342 name: ansible_test_notable
343 recommended_actions:
344 - email
345 - logevent
346 security_domain: threat
347 severity: high
348 state: replaced
349
350 # RUN output:
351 # -----------
352
353 # "after": [
354 # {
355 # "correlation_search_name": "Ansible Test",
356 # "description": "test notable event",
357 # "drilldown_earliest_offset": "$info_min_time$",
358 # "drilldown_latest_offset": "$info_max_time$",
359 # "extract_artifacts": {
360 # "asset": [
361 # "src",
362 # "dest"
363 # ],
364 # "identity": [
365 # "src_user",
366 # "user",
367 # "src_user_id"
368 # ]
369 # },
370 # "next_steps": [
371 # "makestreams"
372 # ],
373 # "name": "ansible_test_notable",
374 # "recommended_actions": [
375 # "email",
376 # "logevent"
377 # ],
378 # "security_domain": "threat",
379 # "severity": "high"
380 # }
381 # ],
382 # "before": [
383 # {
384 # "correlation_search_name": "Ansible Test",
385 # "description": "test notable event",
386 # "drilldown_earliest_offset": "$info_min_time$",
387 # "drilldown_latest_offset": "$info_max_time$",
388 # "drilldown_name": "test_drill_name",
389 # "drilldown_search": "test_drill",
390 # "extract_artifacts": {
391 # "asset": [
392 # "src",
393 # "dest",
394 # "dvc",
395 # "orig_host"
396 # ],
397 # "identity": [
398 # "src_user",
399 # "user",
400 # "src_user_id",
401 # "src_user_role",
402 # "user_id",
403 # "user_role",
404 # "vendor_account"
405 # ]
406 # },
407 # "investigation_profiles": [
408 # "test profile 1",
409 # "test profile 2",
410 # "test profile 3"
411 # ],
412 # "next_steps": [
413 # "makestreams",
414 # "nbtstat",
415 # "nslookup"
416 # ],
417 # "name": "ansible_test_notable",
418 # "recommended_actions": [
419 # "email",
420 # "logevent",
421 # "makestreams",
422 # "nbtstat"
423 # ],
424 # "security_domain": "threat",
425 # "severity": "high"
426 # }
427 # ],
428
429 # USING DELETED
430 # -------------
431
432 - name: Example to remove the config
433 splunk.es.splunk_adaptive_response_notable_events:
434 config:
435 - correlation_search_name: Ansible Test
436 state: deleted
437
438 # RUN output:
439 # -----------
440
441 # "after": [],
442 # "before": [
443 # {
444 # "correlation_search_name": "Ansible Test",
445 # "description": "test notable event",
446 # "drilldown_earliest_offset": "$info_min_time$",
447 # "drilldown_latest_offset": "$info_max_time$",
448 # "drilldown_name": "test_drill_name",
449 # "drilldown_search": "test_drill",
450 # "extract_artifacts": {
451 # "asset": [
452 # "src",
453 # "dest",
454 # "dvc",
455 # "orig_host"
456 # ],
457 # "identity": [
458 # "src_user",
459 # "user",
460 # "src_user_id",
461 # "src_user_role",
462 # "user_id",
463 # "user_role",
464 # "vendor_account"
465 # ]
466 # },
467 # "investigation_profiles": [
468 # "test profile 1",
469 # "test profile 2",
470 # "test profile 3"
471 # ],
472 # "next_steps": [
473 # "makestreams",
474 # "nbtstat",
475 # "nslookup"
476 # ],
477 # "name": "ansible_test_notable",
478 # "recommended_actions": [
479 # "email",
480 # "logevent",
481 # "makestreams",
482 # "nbtstat"
483 # ],
484 # "security_domain": "threat",
485 # "severity": "high"
486 # }
487 # ]
488 """
489
490 RETURN = """
491 before:
492 description: The configuration as structured data prior to module invocation.
493 returned: always
494 type: list
495 sample: The configuration returned will always be in the same format of the parameters above.
496 after:
497 description: The configuration as structured data after module completion.
498 returned: when changed
499 type: list
500 sample: The configuration returned will always be in the same format of the parameters above.
501 gathered:
502 description: Facts about the network resource gathered from the remote device as structured data.
503 returned: when state is I(gathered)
504 type: dict
505 sample: >
506 This output will always be in the same format as the
507 module argspec.
508 """