sraverify 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sraverify/__init__.py +36 -0
- sraverify/checks/__init__.py +56 -0
- sraverify/checks/accessanalyzer/SRA_IAA_1.py +188 -0
- sraverify/checks/accessanalyzer/SRA_IAA_2.py +162 -0
- sraverify/checks/accessanalyzer/SRA_IAA_3.py +260 -0
- sraverify/checks/accessanalyzer/SRA_IAA_4.py +207 -0
- sraverify/checks/accessanalyzer/__init__.py +3 -0
- sraverify/checks/cloudtrail/SRA-CT-1.py +220 -0
- sraverify/checks/cloudtrail/SRA-CT-10.py +229 -0
- sraverify/checks/cloudtrail/SRA-CT-11.py +242 -0
- sraverify/checks/cloudtrail/SRA-CT-12.py +163 -0
- sraverify/checks/cloudtrail/SRA-CT-13.py +279 -0
- sraverify/checks/cloudtrail/SRA-CT-2.py +218 -0
- sraverify/checks/cloudtrail/SRA-CT-3.py +196 -0
- sraverify/checks/cloudtrail/SRA-CT-4.py +161 -0
- sraverify/checks/cloudtrail/SRA-CT-5.py +200 -0
- sraverify/checks/cloudtrail/SRA-CT-6.py +161 -0
- sraverify/checks/cloudtrail/SRA-CT-7.py +194 -0
- sraverify/checks/cloudtrail/SRA-CT-8.py +226 -0
- sraverify/checks/cloudtrail/SRA-CT-9.py +226 -0
- sraverify/checks/cloudtrail/__init__.py +3 -0
- sraverify/checks/config/SRA-CONFIG-1.py +197 -0
- sraverify/checks/config/__init__.py +3 -0
- sraverify/core/__init__.py +3 -0
- sraverify/core/check.py +227 -0
- sraverify/core/logging.py +37 -0
- sraverify/core/session.py +47 -0
- sraverify/lib/__init__.py +4 -0
- sraverify/lib/audit_info.py +37 -0
- sraverify/lib/banner.py +42 -0
- sraverify/lib/check_loader.py +80 -0
- sraverify/lib/org_mgmt_checker.py +86 -0
- sraverify/lib/outputs.py +46 -0
- sraverify/lib/progress.py +75 -0
- sraverify/lib/regions.py +27 -0
- sraverify/lib/session.py +23 -0
- sraverify/main.py +350 -0
- sraverify/services/__init__.py +3 -0
- sraverify/services/accessanalyzer/__init__.py +15 -0
- sraverify/services/accessanalyzer/base.py +123 -0
- sraverify/services/accessanalyzer/checks/__init__.py +3 -0
- sraverify/services/accessanalyzer/checks/sra_accessanalyzer_01.py +82 -0
- sraverify/services/accessanalyzer/checks/sra_accessanalyzer_02.py +82 -0
- sraverify/services/accessanalyzer/checks/sra_accessanalyzer_03.py +103 -0
- sraverify/services/accessanalyzer/checks/sra_accessanalyzer_04.py +139 -0
- sraverify/services/accessanalyzer/client.py +123 -0
- sraverify/services/account/__init__.py +9 -0
- sraverify/services/account/base.py +56 -0
- sraverify/services/account/checks/__init__.py +1 -0
- sraverify/services/account/checks/sra_account_01.py +65 -0
- sraverify/services/account/checks/sra_account_02.py +63 -0
- sraverify/services/account/checks/sra_account_03.py +63 -0
- sraverify/services/account/client.py +51 -0
- sraverify/services/auditmanager/__init__.py +10 -0
- sraverify/services/auditmanager/base.py +72 -0
- sraverify/services/auditmanager/checks/__init__.py +1 -0
- sraverify/services/auditmanager/checks/sra_auditmanager_01.py +58 -0
- sraverify/services/auditmanager/checks/sra_auditmanager_02.py +80 -0
- sraverify/services/auditmanager/client.py +58 -0
- sraverify/services/cloudtrail/__init__.py +33 -0
- sraverify/services/cloudtrail/base.py +167 -0
- sraverify/services/cloudtrail/checks/__init__.py +1 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_01.py +83 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_02.py +99 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_03.py +94 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_04.py +92 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_05.py +106 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_06.py +93 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_07.py +96 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_08.py +145 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_09.py +167 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_10.py +162 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_11.py +178 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_12.py +77 -0
- sraverify/services/cloudtrail/checks/sra_cloudtrail_13.py +120 -0
- sraverify/services/cloudtrail/client.py +118 -0
- sraverify/services/config/__init__.py +25 -0
- sraverify/services/config/base.py +249 -0
- sraverify/services/config/checks/__init__.py +1 -0
- sraverify/services/config/checks/sra_config_01.py +123 -0
- sraverify/services/config/checks/sra_config_02.py +156 -0
- sraverify/services/config/checks/sra_config_03.py +149 -0
- sraverify/services/config/checks/sra_config_04.py +104 -0
- sraverify/services/config/checks/sra_config_05.py +104 -0
- sraverify/services/config/checks/sra_config_06.py +194 -0
- sraverify/services/config/checks/sra_config_07.py +162 -0
- sraverify/services/config/checks/sra_config_08.py +185 -0
- sraverify/services/config/checks/sra_config_09.py +177 -0
- sraverify/services/config/client.py +264 -0
- sraverify/services/ec2/__init__.py +8 -0
- sraverify/services/ec2/base.py +75 -0
- sraverify/services/ec2/checks/__init__.py +1 -0
- sraverify/services/ec2/checks/sra_ec2_01.py +83 -0
- sraverify/services/ec2/client.py +63 -0
- sraverify/services/firewallmanager/__init__.py +23 -0
- sraverify/services/firewallmanager/base.py +48 -0
- sraverify/services/firewallmanager/checks/__init__.py +1 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_01.py +75 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_02.py +57 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_03.py +51 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_04.py +51 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_05.py +51 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_06.py +51 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_07.py +51 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_08.py +61 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_09.py +61 -0
- sraverify/services/firewallmanager/checks/sra_firewallmanager_10.py +71 -0
- sraverify/services/firewallmanager/client.py +40 -0
- sraverify/services/guardduty/__init__.py +58 -0
- sraverify/services/guardduty/base.py +207 -0
- sraverify/services/guardduty/checks/__init__.py +3 -0
- sraverify/services/guardduty/checks/sra_guardduty_01.py +51 -0
- sraverify/services/guardduty/checks/sra_guardduty_02.py +80 -0
- sraverify/services/guardduty/checks/sra_guardduty_03.py +77 -0
- sraverify/services/guardduty/checks/sra_guardduty_04.py +84 -0
- sraverify/services/guardduty/checks/sra_guardduty_05.py +84 -0
- sraverify/services/guardduty/checks/sra_guardduty_06.py +84 -0
- sraverify/services/guardduty/checks/sra_guardduty_07.py +85 -0
- sraverify/services/guardduty/checks/sra_guardduty_08.py +83 -0
- sraverify/services/guardduty/checks/sra_guardduty_09.py +84 -0
- sraverify/services/guardduty/checks/sra_guardduty_10.py +83 -0
- sraverify/services/guardduty/checks/sra_guardduty_11.py +93 -0
- sraverify/services/guardduty/checks/sra_guardduty_12.py +83 -0
- sraverify/services/guardduty/checks/sra_guardduty_13.py +90 -0
- sraverify/services/guardduty/checks/sra_guardduty_14.py +136 -0
- sraverify/services/guardduty/checks/sra_guardduty_15.py +94 -0
- sraverify/services/guardduty/checks/sra_guardduty_16.py +94 -0
- sraverify/services/guardduty/checks/sra_guardduty_17.py +91 -0
- sraverify/services/guardduty/checks/sra_guardduty_18.py +91 -0
- sraverify/services/guardduty/checks/sra_guardduty_19.py +91 -0
- sraverify/services/guardduty/checks/sra_guardduty_20.py +111 -0
- sraverify/services/guardduty/checks/sra_guardduty_21.py +112 -0
- sraverify/services/guardduty/checks/sra_guardduty_22.py +111 -0
- sraverify/services/guardduty/checks/sra_guardduty_23.py +154 -0
- sraverify/services/guardduty/checks/sra_guardduty_24.py +111 -0
- sraverify/services/guardduty/checks/sra_guardduty_25.py +111 -0
- sraverify/services/guardduty/client.py +107 -0
- sraverify/services/inspector/__init__.py +29 -0
- sraverify/services/inspector/base.py +233 -0
- sraverify/services/inspector/checks/__init__.py +3 -0
- sraverify/services/inspector/checks/sra_inspector_01.py +69 -0
- sraverify/services/inspector/checks/sra_inspector_02.py +68 -0
- sraverify/services/inspector/checks/sra_inspector_03.py +68 -0
- sraverify/services/inspector/checks/sra_inspector_04.py +70 -0
- sraverify/services/inspector/checks/sra_inspector_05.py +69 -0
- sraverify/services/inspector/checks/sra_inspector_06.py +115 -0
- sraverify/services/inspector/checks/sra_inspector_07.py +109 -0
- sraverify/services/inspector/checks/sra_inspector_08.py +69 -0
- sraverify/services/inspector/checks/sra_inspector_09.py +69 -0
- sraverify/services/inspector/checks/sra_inspector_10.py +69 -0
- sraverify/services/inspector/checks/sra_inspector_11.py +69 -0
- sraverify/services/inspector/client.py +99 -0
- sraverify/services/macie/__init__.py +27 -0
- sraverify/services/macie/base.py +271 -0
- sraverify/services/macie/checks/__init__.py +1 -0
- sraverify/services/macie/checks/sra_macie_01.py +100 -0
- sraverify/services/macie/checks/sra_macie_02.py +102 -0
- sraverify/services/macie/checks/sra_macie_03.py +152 -0
- sraverify/services/macie/checks/sra_macie_04.py +120 -0
- sraverify/services/macie/checks/sra_macie_05.py +85 -0
- sraverify/services/macie/checks/sra_macie_06.py +124 -0
- sraverify/services/macie/checks/sra_macie_07.py +138 -0
- sraverify/services/macie/checks/sra_macie_08.py +82 -0
- sraverify/services/macie/checks/sra_macie_09.py +103 -0
- sraverify/services/macie/checks/sra_macie_10.py +81 -0
- sraverify/services/macie/client.py +220 -0
- sraverify/services/s3/__init__.py +16 -0
- sraverify/services/s3/base.py +69 -0
- sraverify/services/s3/checks/__init__.py +1 -0
- sraverify/services/s3/checks/sra_s3_01.py +89 -0
- sraverify/services/s3/checks/sra_s3_02.py +89 -0
- sraverify/services/s3/checks/sra_s3_03.py +88 -0
- sraverify/services/s3/checks/sra_s3_04.py +88 -0
- sraverify/services/s3/client.py +52 -0
- sraverify/services/securityhub/__init__.py +27 -0
- sraverify/services/securityhub/base.py +349 -0
- sraverify/services/securityhub/checks/__init__.py +1 -0
- sraverify/services/securityhub/checks/sra_securityhub_01.py +115 -0
- sraverify/services/securityhub/checks/sra_securityhub_02.py +114 -0
- sraverify/services/securityhub/checks/sra_securityhub_03.py +136 -0
- sraverify/services/securityhub/checks/sra_securityhub_04.py +75 -0
- sraverify/services/securityhub/checks/sra_securityhub_05.py +102 -0
- sraverify/services/securityhub/checks/sra_securityhub_06.py +113 -0
- sraverify/services/securityhub/checks/sra_securityhub_07.py +121 -0
- sraverify/services/securityhub/checks/sra_securityhub_08.py +113 -0
- sraverify/services/securityhub/checks/sra_securityhub_09.py +100 -0
- sraverify/services/securityhub/checks/sra_securityhub_10.py +94 -0
- sraverify/services/securityhub/checks/sra_securityhub_11.py +73 -0
- sraverify/services/securityhub/client.py +249 -0
- sraverify/services/securityincidentresponse/__init__.py +13 -0
- sraverify/services/securityincidentresponse/base.py +95 -0
- sraverify/services/securityincidentresponse/checks/__init__.py +1 -0
- sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_01.py +77 -0
- sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_02.py +72 -0
- sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_03.py +86 -0
- sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_04.py +117 -0
- sraverify/services/securityincidentresponse/checks/sra_securityincidentresponse_05.py +55 -0
- sraverify/services/securityincidentresponse/client.py +71 -0
- sraverify/services/securitylake/__init__.py +39 -0
- sraverify/services/securitylake/base.py +461 -0
- sraverify/services/securitylake/checks/__init__.py +1 -0
- sraverify/services/securitylake/checks/sra_securitylake_01.py +98 -0
- sraverify/services/securitylake/checks/sra_securitylake_02.py +133 -0
- sraverify/services/securitylake/checks/sra_securitylake_03.py +116 -0
- sraverify/services/securitylake/checks/sra_securitylake_04.py +72 -0
- sraverify/services/securitylake/checks/sra_securitylake_05.py +116 -0
- sraverify/services/securitylake/checks/sra_securitylake_06.py +104 -0
- sraverify/services/securitylake/checks/sra_securitylake_07.py +108 -0
- sraverify/services/securitylake/checks/sra_securitylake_08.py +107 -0
- sraverify/services/securitylake/checks/sra_securitylake_09.py +107 -0
- sraverify/services/securitylake/checks/sra_securitylake_10.py +106 -0
- sraverify/services/securitylake/checks/sra_securitylake_11.py +109 -0
- sraverify/services/securitylake/checks/sra_securitylake_12.py +108 -0
- sraverify/services/securitylake/checks/sra_securitylake_13.py +108 -0
- sraverify/services/securitylake/checks/sra_securitylake_14.py +72 -0
- sraverify/services/securitylake/checks/sra_securitylake_15.py +120 -0
- sraverify/services/securitylake/checks/sra_securitylake_16.py +104 -0
- sraverify/services/securitylake/checks/sra_securitylake_17.py +103 -0
- sraverify/services/securitylake/client.py +247 -0
- sraverify/services/shield/__init__.py +33 -0
- sraverify/services/shield/base.py +199 -0
- sraverify/services/shield/checks/__init__.py +1 -0
- sraverify/services/shield/checks/sra_shield_01.py +68 -0
- sraverify/services/shield/checks/sra_shield_02.py +77 -0
- sraverify/services/shield/checks/sra_shield_03.py +84 -0
- sraverify/services/shield/checks/sra_shield_04.py +84 -0
- sraverify/services/shield/checks/sra_shield_05.py +84 -0
- sraverify/services/shield/checks/sra_shield_06.py +84 -0
- sraverify/services/shield/checks/sra_shield_07.py +84 -0
- sraverify/services/shield/checks/sra_shield_08.py +69 -0
- sraverify/services/shield/checks/sra_shield_09.py +86 -0
- sraverify/services/shield/checks/sra_shield_10.py +100 -0
- sraverify/services/shield/checks/sra_shield_11.py +71 -0
- sraverify/services/shield/checks/sra_shield_12.py +130 -0
- sraverify/services/shield/checks/sra_shield_13.py +112 -0
- sraverify/services/shield/checks/sra_shield_14.py +111 -0
- sraverify/services/shield/client.py +214 -0
- sraverify/services/waf/__init__.py +21 -0
- sraverify/services/waf/base.py +100 -0
- sraverify/services/waf/checks/__init__.py +1 -0
- sraverify/services/waf/checks/sra_waf_01.py +63 -0
- sraverify/services/waf/checks/sra_waf_02.py +82 -0
- sraverify/services/waf/checks/sra_waf_03.py +123 -0
- sraverify/services/waf/checks/sra_waf_04.py +94 -0
- sraverify/services/waf/checks/sra_waf_05.py +94 -0
- sraverify/services/waf/checks/sra_waf_06.py +91 -0
- sraverify/services/waf/checks/sra_waf_07.py +94 -0
- sraverify/services/waf/checks/sra_waf_08.py +66 -0
- sraverify/services/waf/checks/sra_waf_09.py +95 -0
- sraverify/services/waf/client.py +109 -0
- sraverify/utils/__init__.py +3 -0
- sraverify/utils/banner.py +65 -0
- sraverify/utils/outputs.py +57 -0
- sraverify/utils/progress.py +97 -0
- sraverify-0.1.0.dist-info/LICENSE +175 -0
- sraverify-0.1.0.dist-info/METADATA +516 -0
- sraverify-0.1.0.dist-info/NOTICE +1 -0
- sraverify-0.1.0.dist-info/RECORD +261 -0
- sraverify-0.1.0.dist-info/WHEEL +5 -0
- sraverify-0.1.0.dist-info/entry_points.txt +2 -0
- sraverify-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Check if GuardDuty has Lambda protection enabled.
|
|
3
|
+
"""
|
|
4
|
+
from typing import Dict, List, Any
|
|
5
|
+
from sraverify.services.guardduty.base import GuardDutyCheck
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SRA_GUARDDUTY_12(GuardDutyCheck):
|
|
9
|
+
"""Check if GuardDuty has Lambda protection enabled."""
|
|
10
|
+
|
|
11
|
+
def __init__(self):
|
|
12
|
+
"""Initialize GuardDuty Lambda protection check."""
|
|
13
|
+
super().__init__()
|
|
14
|
+
self.check_id = "SRA-GUARDDUTY-12"
|
|
15
|
+
self.check_name = "GuardDuty Lambda protection enabled"
|
|
16
|
+
self.description = ("This check verifies that GuardDuty Lambda protection is enabled. "
|
|
17
|
+
"Lambda Protection helps identify potential security threats when an AWS Lambda "
|
|
18
|
+
"function gets invoked in the AWS environment.")
|
|
19
|
+
self.severity = "HIGH"
|
|
20
|
+
self.check_logic = "Get detector details in each Region. Check if Lambda protection is enabled in the Features array."
|
|
21
|
+
|
|
22
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
23
|
+
"""
|
|
24
|
+
Execute the check.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
List of findings
|
|
28
|
+
"""
|
|
29
|
+
findings = []
|
|
30
|
+
# Check all regions
|
|
31
|
+
for region in self.regions:
|
|
32
|
+
detector_id = self.get_detector_id(region)
|
|
33
|
+
|
|
34
|
+
# Handle regions where we can't access GuardDuty
|
|
35
|
+
if not detector_id:
|
|
36
|
+
findings.append(self.create_finding(
|
|
37
|
+
status="ERROR",
|
|
38
|
+
region=region,
|
|
39
|
+
resource_id=f"guardduty:{region}",
|
|
40
|
+
actual_value="Unable to access GuardDuty in this region",
|
|
41
|
+
remediation="Check permissions or if GuardDuty is supported in this region"
|
|
42
|
+
))
|
|
43
|
+
continue
|
|
44
|
+
|
|
45
|
+
# Get detector details
|
|
46
|
+
detector_details = self.get_detector_details(region)
|
|
47
|
+
|
|
48
|
+
if detector_details:
|
|
49
|
+
# Check if Lambda protection is enabled in the Features array
|
|
50
|
+
lambda_protection_enabled = False
|
|
51
|
+
features = detector_details.get('Features', [])
|
|
52
|
+
|
|
53
|
+
for feature in features:
|
|
54
|
+
if feature.get('Name') == 'LAMBDA_NETWORK_LOGS' and feature.get('Status') == 'ENABLED':
|
|
55
|
+
lambda_protection_enabled = True
|
|
56
|
+
break
|
|
57
|
+
|
|
58
|
+
if lambda_protection_enabled:
|
|
59
|
+
findings.append(self.create_finding(
|
|
60
|
+
status="PASS",
|
|
61
|
+
region=region,
|
|
62
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
63
|
+
actual_value="Lambda protection is enabled",
|
|
64
|
+
remediation=""
|
|
65
|
+
))
|
|
66
|
+
else:
|
|
67
|
+
findings.append(self.create_finding(
|
|
68
|
+
status="FAIL",
|
|
69
|
+
region=region,
|
|
70
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
71
|
+
actual_value="Lambda protection is not enabled",
|
|
72
|
+
remediation=f"Enable Lambda protection for GuardDuty in {region} to identify potential security threats in Lambda function invocations"
|
|
73
|
+
))
|
|
74
|
+
else:
|
|
75
|
+
findings.append(self.create_finding(
|
|
76
|
+
status="FAIL",
|
|
77
|
+
region=region,
|
|
78
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
79
|
+
actual_value="Unable to retrieve detector details",
|
|
80
|
+
remediation="Check GuardDuty permissions and configuration"
|
|
81
|
+
))
|
|
82
|
+
|
|
83
|
+
return findings
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Check if GuardDuty service administration is delegated to a different account.
|
|
3
|
+
"""
|
|
4
|
+
from typing import Dict, List, Any
|
|
5
|
+
from sraverify.services.guardduty.base import GuardDutyCheck
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SRA_GUARDDUTY_13(GuardDutyCheck):
|
|
9
|
+
"""Check if GuardDuty service administration is delegated to a different account."""
|
|
10
|
+
|
|
11
|
+
def __init__(self):
|
|
12
|
+
"""Initialize GuardDuty service administration delegation check."""
|
|
13
|
+
super().__init__()
|
|
14
|
+
self.check_id = "SRA-GUARDDUTY-13"
|
|
15
|
+
self.check_name = "GuardDuty service administration delegated"
|
|
16
|
+
self.description = ("This check verifies whether GuardDuty service administration for the AWS Organization "
|
|
17
|
+
"is delegated. Centralized management of GuardDuty across the organization improves "
|
|
18
|
+
"security visibility and control.")
|
|
19
|
+
self.severity = "HIGH"
|
|
20
|
+
self.check_logic = "Check if GuardDuty is configured with a delegated administrator using GuardDuty list-organization-admin-accounts API."
|
|
21
|
+
self.account_type = "management"
|
|
22
|
+
|
|
23
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
24
|
+
"""
|
|
25
|
+
Execute the check.
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
List of findings
|
|
29
|
+
"""
|
|
30
|
+
findings = []
|
|
31
|
+
# Check all regions
|
|
32
|
+
for region in self.regions:
|
|
33
|
+
detector_id = self.get_detector_id(region)
|
|
34
|
+
|
|
35
|
+
# Handle regions where we can't access GuardDuty
|
|
36
|
+
if not detector_id:
|
|
37
|
+
findings.append(self.create_finding(
|
|
38
|
+
status="ERROR",
|
|
39
|
+
region=region,
|
|
40
|
+
resource_id=f"guardduty:{region}",
|
|
41
|
+
actual_value="Unable to access GuardDuty in this region",
|
|
42
|
+
remediation="Check permissions or if GuardDuty is supported in this region"
|
|
43
|
+
))
|
|
44
|
+
continue
|
|
45
|
+
|
|
46
|
+
# List organization admin accounts for GuardDuty
|
|
47
|
+
admin_accounts_response = self.list_organization_admin_accounts(region)
|
|
48
|
+
admin_accounts = admin_accounts_response.get('AdminAccounts', [])
|
|
49
|
+
|
|
50
|
+
if admin_accounts:
|
|
51
|
+
# GuardDuty has an admin account
|
|
52
|
+
admin_account_id = admin_accounts[0].get('AdminAccountId')
|
|
53
|
+
admin_account_status = admin_accounts[0].get('AdminStatus', 'Unknown')
|
|
54
|
+
|
|
55
|
+
# Check if the admin account is different from the current account and is enabled
|
|
56
|
+
if admin_account_id != self.account_id and admin_account_status == 'ENABLED':
|
|
57
|
+
findings.append(self.create_finding(
|
|
58
|
+
status="PASS",
|
|
59
|
+
region=region,
|
|
60
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
61
|
+
actual_value=f"GuardDuty service administration is delegated to account {admin_account_id}",
|
|
62
|
+
remediation=""
|
|
63
|
+
))
|
|
64
|
+
elif admin_account_id == self.account_id:
|
|
65
|
+
findings.append(self.create_finding(
|
|
66
|
+
status="FAIL",
|
|
67
|
+
region=region,
|
|
68
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
69
|
+
actual_value="GuardDuty service administration is delegated to the management account itself",
|
|
70
|
+
remediation=f"Delegate GuardDuty administration to a security account other than the management account in {region}"
|
|
71
|
+
))
|
|
72
|
+
else:
|
|
73
|
+
findings.append(self.create_finding(
|
|
74
|
+
status="FAIL",
|
|
75
|
+
region=region,
|
|
76
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
77
|
+
actual_value=f"GuardDuty service administration is delegated to account {admin_account_id} but status is {admin_account_status}",
|
|
78
|
+
remediation=f"Check the status of the delegated administrator account in {region}"
|
|
79
|
+
))
|
|
80
|
+
else:
|
|
81
|
+
# No admin account for GuardDuty
|
|
82
|
+
findings.append(self.create_finding(
|
|
83
|
+
status="FAIL",
|
|
84
|
+
region=region,
|
|
85
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
86
|
+
actual_value="GuardDuty service administration is not delegated to any account",
|
|
87
|
+
remediation=f"Delegate GuardDuty administration to a security account using the Organizations service in {region}"
|
|
88
|
+
))
|
|
89
|
+
|
|
90
|
+
return findings
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Check if GuardDuty delegated admin account is the audit account.
|
|
3
|
+
"""
|
|
4
|
+
from typing import Dict, List, Any
|
|
5
|
+
from sraverify.services.guardduty.base import GuardDutyCheck
|
|
6
|
+
from sraverify.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SRA_GUARDDUTY_14(GuardDutyCheck):
|
|
10
|
+
"""Check if GuardDuty delegated admin account is the audit account."""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
"""Initialize GuardDuty delegated admin check."""
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.check_id = "SRA-GUARDDUTY-14"
|
|
16
|
+
self.check_name = "GuardDuty delegated admin is audit account"
|
|
17
|
+
self.description = ("This check verifies whether GuardDuty delegated admin account is the audit account "
|
|
18
|
+
"of your AWS organization. The audit account is dedicated to operating security services, "
|
|
19
|
+
"monitoring AWS accounts, and automating security alerting and response. GuardDuty helps "
|
|
20
|
+
"monitor resources for unusual and suspicious activities.")
|
|
21
|
+
self.severity = "HIGH"
|
|
22
|
+
self.check_logic = "Check if GuardDuty delegated administrator is the audit account using GuardDuty list-organization-admin-accounts API."
|
|
23
|
+
self.account_type = "management"
|
|
24
|
+
self._audit_accounts = []
|
|
25
|
+
|
|
26
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
27
|
+
"""
|
|
28
|
+
Execute the check.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
List of findings
|
|
32
|
+
"""
|
|
33
|
+
findings = []
|
|
34
|
+
# Get the audit account ID from the _audit_accounts list
|
|
35
|
+
# This is populated by main.py from the CLI arguments
|
|
36
|
+
if not self._audit_accounts:
|
|
37
|
+
logger.warning("Audit account ID not provided. Check cannot be completed.")
|
|
38
|
+
for region in self.regions:
|
|
39
|
+
findings.append(self.create_finding(
|
|
40
|
+
status="ERROR",
|
|
41
|
+
region=region,
|
|
42
|
+
resource_id=f"guardduty:{region}",
|
|
43
|
+
actual_value="Audit account ID not provided",
|
|
44
|
+
remediation="Run sraverify with --audit-account parameter"
|
|
45
|
+
))
|
|
46
|
+
return findings
|
|
47
|
+
|
|
48
|
+
# Use the first audit account in the list
|
|
49
|
+
audit_account_id = self._audit_accounts[0]
|
|
50
|
+
logger.debug(f"Using audit account ID: {audit_account_id}")
|
|
51
|
+
|
|
52
|
+
# Check all regions
|
|
53
|
+
for region in self.regions:
|
|
54
|
+
detector_id = self.get_detector_id(region)
|
|
55
|
+
|
|
56
|
+
# Handle regions where we can't access GuardDuty
|
|
57
|
+
if not detector_id:
|
|
58
|
+
findings.append(self.create_finding(
|
|
59
|
+
status="ERROR",
|
|
60
|
+
region=region,
|
|
61
|
+
resource_id=f"guardduty:{region}",
|
|
62
|
+
actual_value="Unable to access GuardDuty in this region",
|
|
63
|
+
remediation="Check permissions or if GuardDuty is supported in this region"
|
|
64
|
+
))
|
|
65
|
+
continue
|
|
66
|
+
|
|
67
|
+
# List organization admin accounts for GuardDuty
|
|
68
|
+
admin_accounts_response = self.list_organization_admin_accounts(region)
|
|
69
|
+
|
|
70
|
+
# Check if there was an error in the response
|
|
71
|
+
if "Error" in admin_accounts_response:
|
|
72
|
+
error_code = admin_accounts_response["Error"].get("Code", "Unknown")
|
|
73
|
+
error_message = admin_accounts_response["Error"].get("Message", "Unknown error")
|
|
74
|
+
|
|
75
|
+
# Handle BadRequestException specifically for non-management accounts
|
|
76
|
+
if error_code == "BadRequestException" and "not the master account" in error_message:
|
|
77
|
+
findings.append(self.create_finding(
|
|
78
|
+
status="ERROR",
|
|
79
|
+
region=region,
|
|
80
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
81
|
+
actual_value=f"This check must be run from the organization management account",
|
|
82
|
+
remediation="Run this check from the AWS Organizations management account"
|
|
83
|
+
))
|
|
84
|
+
else:
|
|
85
|
+
findings.append(self.create_finding(
|
|
86
|
+
status="ERROR",
|
|
87
|
+
region=region,
|
|
88
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
89
|
+
actual_value=f"Error accessing GuardDuty organization information: {error_code}",
|
|
90
|
+
remediation="Check permissions and AWS Organizations configuration"
|
|
91
|
+
))
|
|
92
|
+
continue
|
|
93
|
+
|
|
94
|
+
admin_accounts = admin_accounts_response.get('AdminAccounts', [])
|
|
95
|
+
|
|
96
|
+
if admin_accounts:
|
|
97
|
+
# GuardDuty has an admin account
|
|
98
|
+
admin_account_id = admin_accounts[0].get('AdminAccountId')
|
|
99
|
+
admin_account_status = admin_accounts[0].get('AdminStatus', 'Unknown')
|
|
100
|
+
|
|
101
|
+
# Check if the admin account is the audit account and is enabled
|
|
102
|
+
if admin_account_id == audit_account_id and admin_account_status == 'ENABLED':
|
|
103
|
+
findings.append(self.create_finding(
|
|
104
|
+
status="PASS",
|
|
105
|
+
region=region,
|
|
106
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
107
|
+
actual_value=f"GuardDuty delegated admin account is the audit account ({audit_account_id})",
|
|
108
|
+
remediation=""
|
|
109
|
+
))
|
|
110
|
+
elif admin_account_id != audit_account_id:
|
|
111
|
+
findings.append(self.create_finding(
|
|
112
|
+
status="FAIL",
|
|
113
|
+
region=region,
|
|
114
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
115
|
+
actual_value=f"GuardDuty delegated admin account ({admin_account_id}) is not the audit account ({audit_account_id})",
|
|
116
|
+
remediation=f"Delegate GuardDuty administration to the audit account ({audit_account_id}) in {region}"
|
|
117
|
+
))
|
|
118
|
+
else:
|
|
119
|
+
findings.append(self.create_finding(
|
|
120
|
+
status="FAIL",
|
|
121
|
+
region=region,
|
|
122
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
123
|
+
actual_value=f"GuardDuty delegated admin is the audit account but status is {admin_account_status}",
|
|
124
|
+
remediation=f"Check the status of the delegated administrator account in {region}"
|
|
125
|
+
))
|
|
126
|
+
else:
|
|
127
|
+
# No admin account for GuardDuty
|
|
128
|
+
findings.append(self.create_finding(
|
|
129
|
+
status="FAIL",
|
|
130
|
+
region=region,
|
|
131
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
132
|
+
actual_value="GuardDuty service administration is not delegated to any account",
|
|
133
|
+
remediation=f"Delegate GuardDuty administration to the audit account ({audit_account_id}) using the Organizations service in {region}"
|
|
134
|
+
))
|
|
135
|
+
|
|
136
|
+
return findings
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Check if GuardDuty auto-enablement is configured for member accounts.
|
|
3
|
+
"""
|
|
4
|
+
from typing import Dict, List, Any
|
|
5
|
+
from sraverify.services.guardduty.base import GuardDutyCheck
|
|
6
|
+
from sraverify.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SRA_GUARDDUTY_15(GuardDutyCheck):
|
|
10
|
+
"""Check if GuardDuty auto-enablement is configured for member accounts."""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
"""Initialize GuardDuty auto-enablement check."""
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.check_id = "SRA-GUARDDUTY-15"
|
|
16
|
+
self.check_name = "GuardDuty auto-enablement configured"
|
|
17
|
+
self.description = ("This check verifies whether auto-enablement configuration for GuardDuty is "
|
|
18
|
+
" enabled for member accounts of the AWS Organization. This ensures that all "
|
|
19
|
+
"existing and new member accounts will have GuardDuty monitoring.")
|
|
20
|
+
self.severity = "HIGH"
|
|
21
|
+
self.check_logic = "Check if GuardDuty AutoEnableOrganizationMembers is set to ALL using describe-organization-configuration API."
|
|
22
|
+
self.account_type = "audit"
|
|
23
|
+
|
|
24
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
25
|
+
"""
|
|
26
|
+
Execute the check.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
List of findings
|
|
30
|
+
"""
|
|
31
|
+
findings = []
|
|
32
|
+
# Check all regions
|
|
33
|
+
for region in self.regions:
|
|
34
|
+
detector_id = self.get_detector_id(region)
|
|
35
|
+
|
|
36
|
+
# Handle regions where we can't access GuardDuty
|
|
37
|
+
if not detector_id:
|
|
38
|
+
findings.append(self.create_finding(
|
|
39
|
+
status="ERROR",
|
|
40
|
+
region=region,
|
|
41
|
+
resource_id=f"guardduty:{region}",
|
|
42
|
+
actual_value="Unable to access GuardDuty in this region",
|
|
43
|
+
remediation="Check permissions or if GuardDuty is supported in this region"
|
|
44
|
+
))
|
|
45
|
+
continue
|
|
46
|
+
|
|
47
|
+
# Get organization configuration for GuardDuty
|
|
48
|
+
org_config = self.get_organization_configuration(region)
|
|
49
|
+
|
|
50
|
+
# Check if there was an error in the response
|
|
51
|
+
if "Error" in org_config:
|
|
52
|
+
error_code = org_config["Error"].get("Code", "Unknown")
|
|
53
|
+
error_message = org_config["Error"].get("Message", "Unknown error")
|
|
54
|
+
|
|
55
|
+
# Handle BadRequestException specifically for non-delegated admin accounts
|
|
56
|
+
if error_code == "BadRequestException":
|
|
57
|
+
findings.append(self.create_finding(
|
|
58
|
+
status="FAIL",
|
|
59
|
+
region=region,
|
|
60
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
61
|
+
actual_value="This account is not the GuardDuty delegated administrator",
|
|
62
|
+
remediation="This check must be run from the GuardDuty delegated administrator account. Verify that this account is the delegated admin for GuardDuty in this region."
|
|
63
|
+
))
|
|
64
|
+
else:
|
|
65
|
+
findings.append(self.create_finding(
|
|
66
|
+
status="ERROR",
|
|
67
|
+
region=region,
|
|
68
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
69
|
+
actual_value=f"Error accessing GuardDuty organization configuration: {error_code}",
|
|
70
|
+
remediation="Check permissions and AWS Organizations configuration"
|
|
71
|
+
))
|
|
72
|
+
continue
|
|
73
|
+
|
|
74
|
+
# Check if AutoEnableOrganizationMembers is set to ALL
|
|
75
|
+
auto_enable_org_members = org_config.get('AutoEnableOrganizationMembers', 'NONE')
|
|
76
|
+
|
|
77
|
+
if auto_enable_org_members == 'ALL':
|
|
78
|
+
findings.append(self.create_finding(
|
|
79
|
+
status="PASS",
|
|
80
|
+
region=region,
|
|
81
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
82
|
+
actual_value="GuardDuty AutoEnableOrganizationMembers is set to ALL",
|
|
83
|
+
remediation=""
|
|
84
|
+
))
|
|
85
|
+
else:
|
|
86
|
+
findings.append(self.create_finding(
|
|
87
|
+
status="FAIL",
|
|
88
|
+
region=region,
|
|
89
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
90
|
+
actual_value=f"GuardDuty AutoEnableOrganizationMembers is set to {auto_enable_org_members}",
|
|
91
|
+
remediation=f"Set AutoEnableOrganizationMembers to ALL in {region} to ensure GuardDuty is enabled for all organization members"
|
|
92
|
+
))
|
|
93
|
+
|
|
94
|
+
return findings
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Check if GuardDuty member account limit is reached.
|
|
3
|
+
"""
|
|
4
|
+
from typing import Dict, List, Any
|
|
5
|
+
from sraverify.services.guardduty.base import GuardDutyCheck
|
|
6
|
+
from sraverify.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SRA_GUARDDUTY_16(GuardDutyCheck):
|
|
10
|
+
"""Check if GuardDuty member account limit is reached."""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
"""Initialize GuardDuty member account limit check."""
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.check_id = "SRA-GUARDDUTY-16"
|
|
16
|
+
self.check_name = "GuardDuty member account limit not reached"
|
|
17
|
+
self.description = ("This check verifies whether the maximum number of allowed member accounts are already "
|
|
18
|
+
"associated with the delegated administrator account for the AWS Organization. "
|
|
19
|
+
"Reaching the limit prevents adding new accounts to GuardDuty monitoring.")
|
|
20
|
+
self.severity = "HIGH"
|
|
21
|
+
self.check_logic = "Check if MemberAccountLimitReached is false using describe-organization-configuration API."
|
|
22
|
+
self.account_type = "audit"
|
|
23
|
+
|
|
24
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
25
|
+
"""
|
|
26
|
+
Execute the check.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
List of findings
|
|
30
|
+
"""
|
|
31
|
+
findings = []
|
|
32
|
+
# Check all regions
|
|
33
|
+
for region in self.regions:
|
|
34
|
+
detector_id = self.get_detector_id(region)
|
|
35
|
+
|
|
36
|
+
# Handle regions where we can't access GuardDuty
|
|
37
|
+
if not detector_id:
|
|
38
|
+
findings.append(self.create_finding(
|
|
39
|
+
status="ERROR",
|
|
40
|
+
region=region,
|
|
41
|
+
resource_id=f"guardduty:{region}",
|
|
42
|
+
actual_value="Unable to access GuardDuty in this region",
|
|
43
|
+
remediation="Check permissions or if GuardDuty is supported in this region"
|
|
44
|
+
))
|
|
45
|
+
continue
|
|
46
|
+
|
|
47
|
+
# Get organization configuration for GuardDuty
|
|
48
|
+
org_config = self.get_organization_configuration(region)
|
|
49
|
+
|
|
50
|
+
# Check if there was an error in the response
|
|
51
|
+
if "Error" in org_config:
|
|
52
|
+
error_code = org_config["Error"].get("Code", "Unknown")
|
|
53
|
+
error_message = org_config["Error"].get("Message", "Unknown error")
|
|
54
|
+
|
|
55
|
+
# Handle BadRequestException specifically for non-management accounts
|
|
56
|
+
if error_code == "BadRequestException":
|
|
57
|
+
findings.append(self.create_finding(
|
|
58
|
+
status="FAIL",
|
|
59
|
+
region=region,
|
|
60
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
61
|
+
actual_value=f"{error_code} {error_message}",
|
|
62
|
+
remediation="Verify that GuardDuty is the delegated admin in this Region and run the check again."
|
|
63
|
+
))
|
|
64
|
+
else:
|
|
65
|
+
findings.append(self.create_finding(
|
|
66
|
+
status="ERROR",
|
|
67
|
+
region=region,
|
|
68
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
69
|
+
actual_value=f"Error accessing GuardDuty organization configuration: {error_code}",
|
|
70
|
+
remediation="Check permissions and AWS Organizations configuration"
|
|
71
|
+
))
|
|
72
|
+
continue
|
|
73
|
+
|
|
74
|
+
# Check if member account limit is reached
|
|
75
|
+
member_account_limit_reached = org_config.get('MemberAccountLimitReached', False)
|
|
76
|
+
|
|
77
|
+
if not member_account_limit_reached:
|
|
78
|
+
findings.append(self.create_finding(
|
|
79
|
+
status="PASS",
|
|
80
|
+
region=region,
|
|
81
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
82
|
+
actual_value="GuardDuty member account limit is not reached",
|
|
83
|
+
remediation=""
|
|
84
|
+
))
|
|
85
|
+
else:
|
|
86
|
+
findings.append(self.create_finding(
|
|
87
|
+
status="FAIL",
|
|
88
|
+
region=region,
|
|
89
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
90
|
+
actual_value="GuardDuty member account limit is reached",
|
|
91
|
+
remediation=f"Contact AWS Support to request an increase in the GuardDuty member account limit for {region}"
|
|
92
|
+
))
|
|
93
|
+
|
|
94
|
+
return findings
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Check if GuardDuty has EKS addon management enabled.
|
|
3
|
+
"""
|
|
4
|
+
from typing import Dict, List, Any
|
|
5
|
+
from sraverify.services.guardduty.base import GuardDutyCheck
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SRA_GUARDDUTY_17(GuardDutyCheck):
|
|
9
|
+
"""Check if GuardDuty has EKS addon management enabled."""
|
|
10
|
+
|
|
11
|
+
def __init__(self):
|
|
12
|
+
"""Initialize GuardDuty EKS addon management check."""
|
|
13
|
+
super().__init__()
|
|
14
|
+
self.check_id = "SRA-GUARDDUTY-17"
|
|
15
|
+
self.check_name = "GuardDuty EKS addon management enabled"
|
|
16
|
+
self.description = ("This check verifies that GuardDuty has EKS addon management enabled. "
|
|
17
|
+
"EKS addon management allows GuardDuty to automatically deploy and manage "
|
|
18
|
+
"the security agent on your EKS clusters, simplifying the setup and maintenance "
|
|
19
|
+
"of runtime monitoring for Kubernetes workloads.")
|
|
20
|
+
self.severity = "HIGH"
|
|
21
|
+
self.check_logic = "Get detector details in each Region. Check if EKS_ADDON_MANAGEMENT is enabled in the RUNTIME_MONITORING feature's AdditionalConfiguration."
|
|
22
|
+
|
|
23
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
24
|
+
"""
|
|
25
|
+
Execute the check.
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
List of findings
|
|
29
|
+
"""
|
|
30
|
+
findings = []
|
|
31
|
+
# Check all regions
|
|
32
|
+
for region in self.regions:
|
|
33
|
+
detector_id = self.get_detector_id(region)
|
|
34
|
+
|
|
35
|
+
# Handle regions where we can't access GuardDuty
|
|
36
|
+
if not detector_id:
|
|
37
|
+
findings.append(self.create_finding(
|
|
38
|
+
status="ERROR",
|
|
39
|
+
region=region,
|
|
40
|
+
resource_id=f"guardduty:{region}",
|
|
41
|
+
actual_value="Unable to access GuardDuty in this region",
|
|
42
|
+
remediation="Check permissions or if GuardDuty is supported in this region"
|
|
43
|
+
))
|
|
44
|
+
continue
|
|
45
|
+
|
|
46
|
+
# Get detector details
|
|
47
|
+
detector_details = self.get_detector_details(region)
|
|
48
|
+
|
|
49
|
+
if detector_details:
|
|
50
|
+
# Check if EKS_ADDON_MANAGEMENT is enabled in any RUNTIME_MONITORING feature
|
|
51
|
+
eks_addon_management_enabled = False
|
|
52
|
+
features = detector_details.get('Features', [])
|
|
53
|
+
|
|
54
|
+
for feature in features:
|
|
55
|
+
if feature.get('Name') == 'RUNTIME_MONITORING':
|
|
56
|
+
# Check AdditionalConfiguration for EKS_ADDON_MANAGEMENT
|
|
57
|
+
additional_configs = feature.get('AdditionalConfiguration', [])
|
|
58
|
+
for config in additional_configs:
|
|
59
|
+
if config.get('Name') == 'EKS_ADDON_MANAGEMENT' and config.get('Status') == 'ENABLED':
|
|
60
|
+
eks_addon_management_enabled = True
|
|
61
|
+
break
|
|
62
|
+
|
|
63
|
+
if eks_addon_management_enabled:
|
|
64
|
+
break
|
|
65
|
+
|
|
66
|
+
if eks_addon_management_enabled:
|
|
67
|
+
findings.append(self.create_finding(
|
|
68
|
+
status="PASS",
|
|
69
|
+
region=region,
|
|
70
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
71
|
+
actual_value="EKS addon management is enabled",
|
|
72
|
+
remediation=""
|
|
73
|
+
))
|
|
74
|
+
else:
|
|
75
|
+
findings.append(self.create_finding(
|
|
76
|
+
status="FAIL",
|
|
77
|
+
region=region,
|
|
78
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
79
|
+
actual_value="EKS addon management is not enabled",
|
|
80
|
+
remediation=f"Enable EKS addon management in the Runtime Monitoring configuration for GuardDuty in {region}"
|
|
81
|
+
))
|
|
82
|
+
else:
|
|
83
|
+
findings.append(self.create_finding(
|
|
84
|
+
status="FAIL",
|
|
85
|
+
region=region,
|
|
86
|
+
resource_id=f"guardduty:{region}:{detector_id}",
|
|
87
|
+
actual_value="Unable to retrieve detector details",
|
|
88
|
+
remediation="Check GuardDuty permissions and configuration"
|
|
89
|
+
))
|
|
90
|
+
|
|
91
|
+
return findings
|