mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 06:45:08 +00:00
fix(compliance): set correct CSV Compliance model for CIS (#3503)
This commit is contained in:
@@ -23,7 +23,7 @@ Each file version of a framework will have the following structure at high level
|
|||||||
"Requirements": [
|
"Requirements": [
|
||||||
{
|
{
|
||||||
"Id": "<unique-id>",
|
"Id": "<unique-id>",
|
||||||
"Description": "Requiemente full description",
|
"Description": "Requirement full description",
|
||||||
"Checks": [
|
"Checks": [
|
||||||
"Here is the prowler check or checks that is going to be executed"
|
"Here is the prowler check or checks that is going to be executed"
|
||||||
],
|
],
|
||||||
@@ -38,4 +38,4 @@ Each file version of a framework will have the following structure at high level
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, to have a proper output file for your reports, your framework data model has to be created in `prowler/lib/outputs/models.py` and also the CLI table output in `prowler/lib/outputs/compliance.py`.
|
Finally, to have a proper output file for your reports, your framework data model has to be created in `prowler/lib/outputs/models.py` and also the CLI table output in `prowler/lib/outputs/compliance.py`. Also, you need to add a new conditional in `prowler/lib/outputs/file_descriptors.py` if you create a new CSV model.
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ def fill_file_descriptors(output_modes, output_directory, output_filename, audit
|
|||||||
file_descriptors.update({output_mode: file_descriptor})
|
file_descriptors.update({output_mode: file_descriptor})
|
||||||
|
|
||||||
elif isinstance(audit_info, GCP_Audit_Info):
|
elif isinstance(audit_info, GCP_Audit_Info):
|
||||||
if output_mode == "cis_2.0_gcp":
|
filename = f"{output_directory}/{output_filename}_{output_mode}{csv_file_suffix}"
|
||||||
filename = f"{output_directory}/{output_filename}_cis_2.0_gcp{csv_file_suffix}"
|
if "cis_" in output_mode:
|
||||||
file_descriptor = initialize_file_descriptor(
|
file_descriptor = initialize_file_descriptor(
|
||||||
filename, output_mode, audit_info, Check_Output_CSV_GCP_CIS
|
filename, output_mode, audit_info, Check_Output_CSV_GCP_CIS
|
||||||
)
|
)
|
||||||
@@ -121,87 +121,62 @@ def fill_file_descriptors(output_modes, output_directory, output_filename, audit
|
|||||||
filename, output_mode, audit_info
|
filename, output_mode, audit_info
|
||||||
)
|
)
|
||||||
file_descriptors.update({output_mode: file_descriptor})
|
file_descriptors.update({output_mode: file_descriptor})
|
||||||
|
else: # Compliance frameworks
|
||||||
elif output_mode == "ens_rd2022_aws":
|
|
||||||
filename = f"{output_directory}/{output_filename}_ens_rd2022_aws{csv_file_suffix}"
|
|
||||||
file_descriptor = initialize_file_descriptor(
|
|
||||||
filename,
|
|
||||||
output_mode,
|
|
||||||
audit_info,
|
|
||||||
Check_Output_CSV_ENS_RD2022,
|
|
||||||
)
|
|
||||||
file_descriptors.update({output_mode: file_descriptor})
|
|
||||||
|
|
||||||
elif output_mode == "cis_1.5_aws":
|
|
||||||
filename = f"{output_directory}/{output_filename}_cis_1.5_aws{csv_file_suffix}"
|
|
||||||
file_descriptor = initialize_file_descriptor(
|
|
||||||
filename, output_mode, audit_info, Check_Output_CSV_AWS_CIS
|
|
||||||
)
|
|
||||||
file_descriptors.update({output_mode: file_descriptor})
|
|
||||||
|
|
||||||
elif output_mode == "cis_1.4_aws":
|
|
||||||
filename = f"{output_directory}/{output_filename}_cis_1.4_aws{csv_file_suffix}"
|
|
||||||
file_descriptor = initialize_file_descriptor(
|
|
||||||
filename, output_mode, audit_info, Check_Output_CSV_AWS_CIS
|
|
||||||
)
|
|
||||||
file_descriptors.update({output_mode: file_descriptor})
|
|
||||||
|
|
||||||
elif (
|
|
||||||
output_mode
|
|
||||||
== "aws_well_architected_framework_security_pillar_aws"
|
|
||||||
):
|
|
||||||
filename = f"{output_directory}/{output_filename}_aws_well_architected_framework_security_pillar_aws{csv_file_suffix}"
|
|
||||||
file_descriptor = initialize_file_descriptor(
|
|
||||||
filename,
|
|
||||||
output_mode,
|
|
||||||
audit_info,
|
|
||||||
Check_Output_CSV_AWS_Well_Architected,
|
|
||||||
)
|
|
||||||
file_descriptors.update({output_mode: file_descriptor})
|
|
||||||
|
|
||||||
elif (
|
|
||||||
output_mode
|
|
||||||
== "aws_well_architected_framework_reliability_pillar_aws"
|
|
||||||
):
|
|
||||||
filename = f"{output_directory}/{output_filename}_aws_well_architected_framework_reliability_pillar_aws{csv_file_suffix}"
|
|
||||||
file_descriptor = initialize_file_descriptor(
|
|
||||||
filename,
|
|
||||||
output_mode,
|
|
||||||
audit_info,
|
|
||||||
Check_Output_CSV_AWS_Well_Architected,
|
|
||||||
)
|
|
||||||
file_descriptors.update({output_mode: file_descriptor})
|
|
||||||
|
|
||||||
elif output_mode == "iso27001_2013_aws":
|
|
||||||
filename = f"{output_directory}/{output_filename}_iso27001_2013_aws{csv_file_suffix}"
|
|
||||||
file_descriptor = initialize_file_descriptor(
|
|
||||||
filename,
|
|
||||||
output_mode,
|
|
||||||
audit_info,
|
|
||||||
Check_Output_CSV_AWS_ISO27001_2013,
|
|
||||||
)
|
|
||||||
file_descriptors.update({output_mode: file_descriptor})
|
|
||||||
|
|
||||||
elif output_mode == "mitre_attack_aws":
|
|
||||||
filename = f"{output_directory}/{output_filename}_mitre_attack_aws{csv_file_suffix}"
|
|
||||||
file_descriptor = initialize_file_descriptor(
|
|
||||||
filename,
|
|
||||||
output_mode,
|
|
||||||
audit_info,
|
|
||||||
Check_Output_MITRE_ATTACK,
|
|
||||||
)
|
|
||||||
file_descriptors.update({output_mode: file_descriptor})
|
|
||||||
|
|
||||||
else:
|
|
||||||
# Generic Compliance framework
|
|
||||||
filename = f"{output_directory}/{output_filename}_{output_mode}{csv_file_suffix}"
|
filename = f"{output_directory}/{output_filename}_{output_mode}{csv_file_suffix}"
|
||||||
file_descriptor = initialize_file_descriptor(
|
if output_mode == "ens_rd2022_aws":
|
||||||
filename,
|
file_descriptor = initialize_file_descriptor(
|
||||||
output_mode,
|
filename,
|
||||||
audit_info,
|
output_mode,
|
||||||
Check_Output_CSV_Generic_Compliance,
|
audit_info,
|
||||||
)
|
Check_Output_CSV_ENS_RD2022,
|
||||||
file_descriptors.update({output_mode: file_descriptor})
|
)
|
||||||
|
file_descriptors.update({output_mode: file_descriptor})
|
||||||
|
|
||||||
|
elif "cis_" in output_mode:
|
||||||
|
file_descriptor = initialize_file_descriptor(
|
||||||
|
filename,
|
||||||
|
output_mode,
|
||||||
|
audit_info,
|
||||||
|
Check_Output_CSV_AWS_CIS,
|
||||||
|
)
|
||||||
|
file_descriptors.update({output_mode: file_descriptor})
|
||||||
|
|
||||||
|
elif "aws_well_architected_framework" in output_mode:
|
||||||
|
file_descriptor = initialize_file_descriptor(
|
||||||
|
filename,
|
||||||
|
output_mode,
|
||||||
|
audit_info,
|
||||||
|
Check_Output_CSV_AWS_Well_Architected,
|
||||||
|
)
|
||||||
|
file_descriptors.update({output_mode: file_descriptor})
|
||||||
|
|
||||||
|
elif output_mode == "iso27001_2013_aws":
|
||||||
|
file_descriptor = initialize_file_descriptor(
|
||||||
|
filename,
|
||||||
|
output_mode,
|
||||||
|
audit_info,
|
||||||
|
Check_Output_CSV_AWS_ISO27001_2013,
|
||||||
|
)
|
||||||
|
file_descriptors.update({output_mode: file_descriptor})
|
||||||
|
|
||||||
|
elif output_mode == "mitre_attack_aws":
|
||||||
|
file_descriptor = initialize_file_descriptor(
|
||||||
|
filename,
|
||||||
|
output_mode,
|
||||||
|
audit_info,
|
||||||
|
Check_Output_MITRE_ATTACK,
|
||||||
|
)
|
||||||
|
file_descriptors.update({output_mode: file_descriptor})
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Generic Compliance framework
|
||||||
|
file_descriptor = initialize_file_descriptor(
|
||||||
|
filename,
|
||||||
|
output_mode,
|
||||||
|
audit_info,
|
||||||
|
Check_Output_CSV_Generic_Compliance,
|
||||||
|
)
|
||||||
|
file_descriptors.update({output_mode: file_descriptor})
|
||||||
|
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|||||||
Reference in New Issue
Block a user