mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
from prowler.lib.check.models import Check, Check_Report_AWS
|
|
from prowler.providers.aws.services.accessanalyzer.accessanalyzer_client import (
|
|
accessanalyzer_client,
|
|
)
|
|
|
|
|
|
class accessanalyzer_enabled(Check):
|
|
def execute(self):
|
|
findings = []
|
|
for analyzer in accessanalyzer_client.analyzers:
|
|
report = Check_Report_AWS(self.metadata())
|
|
report.region = analyzer.region
|
|
if analyzer.status == "ACTIVE":
|
|
report.status = "PASS"
|
|
report.status_extended = (
|
|
f"IAM Access Analyzer {analyzer.name} is enabled."
|
|
)
|
|
report.resource_id = analyzer.name
|
|
report.resource_arn = analyzer.arn
|
|
report.resource_tags = analyzer.tags
|
|
|
|
elif analyzer.status == "NOT_AVAILABLE":
|
|
report.status = "FAIL"
|
|
report.status_extended = (
|
|
f"IAM Access Analyzer in account {analyzer.name} is not enabled."
|
|
)
|
|
report.resource_id = analyzer.name
|
|
report.resource_arn = analyzer.arn
|
|
else:
|
|
report.status = "FAIL"
|
|
report.status_extended = (
|
|
f"IAM Access Analyzer {analyzer.name} is not active."
|
|
)
|
|
report.resource_id = analyzer.name
|
|
report.resource_arn = analyzer.arn
|
|
report.resource_tags = analyzer.tags
|
|
findings.append(report)
|
|
|
|
return findings
|