Skip to content

Commit

Permalink
Merge pull request #3 from ImMin5/feature-azure
Browse files Browse the repository at this point in the history
Add standard cloud service type
  • Loading branch information
ImMin5 authored Jan 11, 2024
2 parents 3c3b177 + 1542989 commit 513ccf2
Show file tree
Hide file tree
Showing 4 changed files with 588 additions and 380 deletions.
14 changes: 10 additions & 4 deletions src/cloudforet/plugin/connector/azure_prowler_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ def _check_secret_data(secret_data: dict):
raise ERROR_REQUIRED_PARAMETER(key="secret_data.client_id")

@staticmethod
def _command_prefix(
azure_profile_name: str = None, authentication_type: str = None
) -> List[str]:
return ["python3", "-m", "prowler", "azure", "--sp-env-auth", "-b"]
def _command_prefix() -> List[str]:
return [
"python3",
"-m",
"prowler",
"azure",
"--sp-env-auth",
"-b" "--azure-region",
"AzureCloud",
]
26 changes: 19 additions & 7 deletions src/cloudforet/plugin/manager/azure_prowler_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from cloudforet.plugin.manager.collector_manager import CollectorManager
from cloudforet.plugin.connector.azure_prowler_connector import AzureProwlerConnector
from cloudforet.plugin.model.prowler.cloud_service_type import CloudServiceType
from cloudforet.plugin.model.prowler.standard_cloud_service_type import (
StandardCloudServiceType,
)
from cloudforet.plugin.model.prowler.collector import COMPLIANCE_FRAMEWORKS

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -58,12 +61,21 @@ def collect(
)

# Return Cloud Service Type
cloud_service_type = CloudServiceType(
name=self.cloud_service_type, provider=self.provider
)
cloud_service_type.metadata["query_sets"][0][
"name"
] = f"Azure {self.cloud_service_type}"
if self.cloud_service_type == "Azure-Standard":
cloud_service_type = StandardCloudServiceType(
name=self.cloud_service_type, provider=self.provider
)
cloud_service_type.metadata["query_sets"][0][
"name"
] = f"{self.cloud_service_type}"
else:
cloud_service_type = CloudServiceType(
name=self.cloud_service_type, provider=self.provider
)
cloud_service_type.metadata["query_sets"][0][
"name"
] = f"Azure {self.cloud_service_type}"

yield self.make_response(
cloud_service_type.dict(),
{"1": ["name", "group", "provider"]},
Expand Down Expand Up @@ -232,7 +244,7 @@ def _make_compliance_result(
check_id = check_result["CheckID"]
status = check_result["Status"]
region_code = check_result.get("Region")
severity = _SEVERITY_MAP.get(check_result["Severity"], "UNKNOWN").upper()
severity = _SEVERITY_MAP.get(check_result["Severity"], "UNKNOWN")
score = _SEVERITY_SCORE_MAP[severity]

if compliance_id not in compliance_results:
Expand Down
Loading

0 comments on commit 513ccf2

Please sign in to comment.