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,115 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SRA-INSPECTOR-06: Inspector Delegated Admin Account is the Audit Account.
|
|
3
|
+
"""
|
|
4
|
+
from typing import List, Dict, Any
|
|
5
|
+
from sraverify.services.inspector.base import InspectorCheck
|
|
6
|
+
from sraverify.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SRA_INSPECTOR_06(InspectorCheck):
|
|
10
|
+
"""Check if Inspector delegated admin account is the audit account."""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
"""Initialize the check."""
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.check_id = "SRA-INSPECTOR-06"
|
|
16
|
+
self.check_name = "Inspector delegated admin account is the audit account"
|
|
17
|
+
self.account_type = "management"
|
|
18
|
+
self.severity = "HIGH"
|
|
19
|
+
self.description = (
|
|
20
|
+
"This check verifies whether Inspector delegated admin account is the audit account of your AWS organization. "
|
|
21
|
+
"Audit account is dedicated to operating security services, monitoring AWS accounts, and automating security "
|
|
22
|
+
"alerting and response. Inspector provides vulnerability management service."
|
|
23
|
+
)
|
|
24
|
+
self.check_logic = (
|
|
25
|
+
"Check runs inspector2 get-delegated-admin-account. PASS if delegated admin is the Audit account "
|
|
26
|
+
"specified by flag --audit-account"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
30
|
+
"""
|
|
31
|
+
Execute the check.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
List of findings
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
# Check each region separately
|
|
38
|
+
for region in self.regions:
|
|
39
|
+
# Get delegated admin account for this region
|
|
40
|
+
delegated_admin_response = self.get_delegated_admin(region)
|
|
41
|
+
delegated_admin = delegated_admin_response.get('delegatedAdmin', {})
|
|
42
|
+
delegated_admin_id = delegated_admin.get('accountId')
|
|
43
|
+
|
|
44
|
+
# If no delegated admin is configured, report a failure
|
|
45
|
+
if not delegated_admin_id:
|
|
46
|
+
self.findings.append(
|
|
47
|
+
self.create_finding(
|
|
48
|
+
status="FAIL",
|
|
49
|
+
region=region,
|
|
50
|
+
resource_id=f"inspector2/{region}/delegated-admin",
|
|
51
|
+
checked_value="Inspector delegated admin account is the audit account",
|
|
52
|
+
actual_value="No delegated admin account is configured",
|
|
53
|
+
remediation=(
|
|
54
|
+
"Configure a delegated admin account for Inspector using the AWS Console or CLI command: "
|
|
55
|
+
f"aws organizations register-delegated-administrator --account-id <AUDIT_ACCOUNT_ID> "
|
|
56
|
+
f"--service-principal inspector2.amazonaws.com --region {region}"
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
continue
|
|
61
|
+
|
|
62
|
+
# Check if audit_accounts is provided via _audit_accounts (new attribute name)
|
|
63
|
+
audit_accounts = []
|
|
64
|
+
if hasattr(self, '_audit_accounts') and self._audit_accounts:
|
|
65
|
+
audit_accounts = self._audit_accounts
|
|
66
|
+
# For backward compatibility, also check the old attribute name
|
|
67
|
+
elif hasattr(self, 'audit_accounts') and self.audit_accounts:
|
|
68
|
+
audit_accounts = self.audit_accounts
|
|
69
|
+
|
|
70
|
+
if not audit_accounts:
|
|
71
|
+
self.findings.append(
|
|
72
|
+
self.create_finding(
|
|
73
|
+
status="ERROR",
|
|
74
|
+
region=region,
|
|
75
|
+
resource_id=f"inspector2/{region}/delegated-admin",
|
|
76
|
+
checked_value="Inspector delegated admin account is the audit account",
|
|
77
|
+
actual_value=f"Delegated admin account is {delegated_admin_id}, but no audit account was specified for comparison",
|
|
78
|
+
remediation="Run the check with the --audit-account parameter to specify the audit account"
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
continue
|
|
82
|
+
|
|
83
|
+
# Check if the delegated admin is one of the audit accounts
|
|
84
|
+
if delegated_admin_id in audit_accounts:
|
|
85
|
+
self.findings.append(
|
|
86
|
+
self.create_finding(
|
|
87
|
+
status="PASS",
|
|
88
|
+
region=region,
|
|
89
|
+
resource_id=f"inspector2/{region}/delegated-admin",
|
|
90
|
+
checked_value="Inspector delegated admin account is the audit account",
|
|
91
|
+
actual_value=f"Inspector delegated administrator (Account: {delegated_admin_id}) "
|
|
92
|
+
f"matches one of the specified Audit accounts {', '.join(audit_accounts)}",
|
|
93
|
+
remediation="No remediation needed"
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
else:
|
|
97
|
+
self.findings.append(
|
|
98
|
+
self.create_finding(
|
|
99
|
+
status="FAIL",
|
|
100
|
+
region=region,
|
|
101
|
+
resource_id=f"inspector2/{region}/delegated-admin",
|
|
102
|
+
checked_value="Inspector delegated admin account is the audit account",
|
|
103
|
+
actual_value=f"Inspector delegated administrator (Account: {delegated_admin_id}) "
|
|
104
|
+
f"does not match any of the specified Audit accounts ({', '.join(audit_accounts)})",
|
|
105
|
+
remediation=(
|
|
106
|
+
"Update the delegated admin account to be the audit account using the AWS Console or CLI commands: "
|
|
107
|
+
f"1. aws organizations deregister-delegated-administrator --account-id {delegated_admin_id} "
|
|
108
|
+
f"--service-principal inspector2.amazonaws.com --region {region}\n"
|
|
109
|
+
f"2. aws organizations register-delegated-administrator --account-id {audit_accounts[0]} "
|
|
110
|
+
f"--service-principal inspector2.amazonaws.com --region {region}"
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
return self.findings
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SRA-INSPECTOR-07: All Active Member Accounts Have Inspector Enabled.
|
|
3
|
+
"""
|
|
4
|
+
from typing import List, Dict, Any, Set
|
|
5
|
+
from sraverify.services.inspector.base import InspectorCheck
|
|
6
|
+
from sraverify.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SRA_INSPECTOR_07(InspectorCheck):
|
|
10
|
+
"""Check if all active member accounts have Inspector enabled."""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
"""Initialize the check."""
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.check_id = "SRA-INSPECTOR-07"
|
|
16
|
+
self.check_name = "All active member accounts have Inspector enabled"
|
|
17
|
+
self.account_type = "audit"
|
|
18
|
+
self.severity = "HIGH"
|
|
19
|
+
self.description = (
|
|
20
|
+
"This check verifies whether all active members accounts of the AWS Organization have Inspector enabled. "
|
|
21
|
+
"Inspector is an automated vulnerability management service that continually scans Amazon Elastic Compute Cloud (EC2), "
|
|
22
|
+
"AWS Lambda functions, and container images in Amazon ECR."
|
|
23
|
+
)
|
|
24
|
+
self.check_logic = (
|
|
25
|
+
"Check runs aws organizations list-accounts AND aws inspector2 batch-get-account-status. "
|
|
26
|
+
"PASS if all organization accounts (except audit) have Inspector enabled"
|
|
27
|
+
)
|
|
28
|
+
self._audit_accounts = [] # Will be populated from command line args
|
|
29
|
+
|
|
30
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
31
|
+
"""
|
|
32
|
+
Execute the check using BatchGetAccountStatus.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
List of findings
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
# Check each region separately
|
|
39
|
+
for region in self.regions:
|
|
40
|
+
# Get organization members
|
|
41
|
+
org_accounts = self.get_organization_members(region)
|
|
42
|
+
|
|
43
|
+
# Create a set of all active organization account IDs
|
|
44
|
+
org_account_ids = set()
|
|
45
|
+
for account in org_accounts:
|
|
46
|
+
if account.get('Status') == 'ACTIVE':
|
|
47
|
+
org_account_ids.add(account.get('Id'))
|
|
48
|
+
|
|
49
|
+
# Get delegated admin account
|
|
50
|
+
delegated_admin_response = self.get_delegated_admin(region)
|
|
51
|
+
delegated_admin = delegated_admin_response.get('delegatedAdmin', {})
|
|
52
|
+
delegated_admin_id = delegated_admin.get('accountId')
|
|
53
|
+
|
|
54
|
+
# Use the delegated admin ID as the audit account if no audit accounts are provided
|
|
55
|
+
audit_accounts = self._audit_accounts.copy()
|
|
56
|
+
if not audit_accounts and delegated_admin_id:
|
|
57
|
+
audit_accounts = [delegated_admin_id]
|
|
58
|
+
elif not audit_accounts:
|
|
59
|
+
audit_accounts = [self.account_id]
|
|
60
|
+
|
|
61
|
+
# Remove audit accounts from the list of accounts to check
|
|
62
|
+
accounts_to_check = org_account_ids - set(audit_accounts)
|
|
63
|
+
|
|
64
|
+
# Convert to list for the API call
|
|
65
|
+
accounts_list = list(accounts_to_check)
|
|
66
|
+
|
|
67
|
+
# Use BatchGetAccountStatus to check which accounts have Inspector enabled
|
|
68
|
+
account_statuses = self.batch_get_account_status(region, accounts_list)
|
|
69
|
+
|
|
70
|
+
# Find accounts that should have Inspector enabled but don't
|
|
71
|
+
missing_accounts = set()
|
|
72
|
+
for acc_id in accounts_to_check:
|
|
73
|
+
# Check if the account is in the results
|
|
74
|
+
if acc_id not in account_statuses:
|
|
75
|
+
missing_accounts.add(acc_id)
|
|
76
|
+
continue
|
|
77
|
+
|
|
78
|
+
# Check if Inspector is enabled for this account
|
|
79
|
+
status = account_statuses[acc_id].get('state', {}).get('status')
|
|
80
|
+
if status != 'ENABLED':
|
|
81
|
+
missing_accounts.add(acc_id)
|
|
82
|
+
|
|
83
|
+
if missing_accounts:
|
|
84
|
+
self.findings.append(
|
|
85
|
+
self.create_finding(
|
|
86
|
+
status="FAIL",
|
|
87
|
+
region=region,
|
|
88
|
+
resource_id=f"inspector2/{region}/organization/members",
|
|
89
|
+
checked_value="All active organization accounts (except audit) have Inspector enabled",
|
|
90
|
+
actual_value=f"The following accounts do not have Inspector enabled in {region}: {', '.join(missing_accounts)}",
|
|
91
|
+
remediation=(
|
|
92
|
+
"Enable Inspector for all member accounts using the AWS Console or CLI command: "
|
|
93
|
+
f"aws inspector2 enable --account-ids {' '.join(missing_accounts)} --resource-types EC2 ECR LAMBDA LAMBDA_CODE --region {region}"
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
else:
|
|
98
|
+
self.findings.append(
|
|
99
|
+
self.create_finding(
|
|
100
|
+
status="PASS",
|
|
101
|
+
region=region,
|
|
102
|
+
resource_id=f"inspector2/{region}/organization/members",
|
|
103
|
+
checked_value="All active organization accounts (except audit) have Inspector enabled",
|
|
104
|
+
actual_value=f"All {len(accounts_to_check)} active organization accounts (except audit) have Inspector enabled in {region}",
|
|
105
|
+
remediation="No remediation needed"
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return self.findings
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SRA-INSPECTOR-08: Inspector EC2 Auto-Enable is Configured.
|
|
3
|
+
"""
|
|
4
|
+
from typing import List, Dict, Any
|
|
5
|
+
from sraverify.services.inspector.base import InspectorCheck
|
|
6
|
+
from sraverify.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SRA_INSPECTOR_08(InspectorCheck):
|
|
10
|
+
"""Check if Inspector EC2 auto-enable is configured."""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
"""Initialize the check."""
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.check_id = "SRA-INSPECTOR-08"
|
|
16
|
+
self.check_name = "Inspector EC2 auto-enable is configured"
|
|
17
|
+
self.account_type = "audit"
|
|
18
|
+
self.severity = "HIGH"
|
|
19
|
+
self.description = (
|
|
20
|
+
"This check verifies whether Inspector is configured to automatically enable EC2 scanning for new accounts. "
|
|
21
|
+
"Auto-enable ensures that EC2 instances in new accounts added to the organization are automatically scanned."
|
|
22
|
+
)
|
|
23
|
+
self.check_logic = (
|
|
24
|
+
"Check runs inspector2 describe-organization-configuration. Check PASS if autoEnable.ec2=true"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
28
|
+
"""
|
|
29
|
+
Execute the check.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
List of findings
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
# Check each region separately
|
|
36
|
+
for region in self.regions:
|
|
37
|
+
# Get organization configuration for this region
|
|
38
|
+
org_config = self.get_organization_configuration(region)
|
|
39
|
+
|
|
40
|
+
# Check if EC2 auto-enable is configured
|
|
41
|
+
ec2_enabled = org_config.get('autoEnable', {}).get('ec2', False)
|
|
42
|
+
|
|
43
|
+
if not ec2_enabled:
|
|
44
|
+
self.findings.append(
|
|
45
|
+
self.create_finding(
|
|
46
|
+
status="FAIL",
|
|
47
|
+
region=region,
|
|
48
|
+
resource_id=f"inspector2/{region}/organization-configuration/ec2",
|
|
49
|
+
checked_value="Inspector EC2 auto-enable is configured",
|
|
50
|
+
actual_value=f"EC2 auto-enable is not configured in {region}",
|
|
51
|
+
remediation=(
|
|
52
|
+
"Configure Inspector EC2 auto-enable using the AWS Console or CLI command: "
|
|
53
|
+
f"aws inspector2 update-organization-configuration --auto-enable ec2=true --region {region}"
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
else:
|
|
58
|
+
self.findings.append(
|
|
59
|
+
self.create_finding(
|
|
60
|
+
status="PASS",
|
|
61
|
+
region=region,
|
|
62
|
+
resource_id=f"inspector2/{region}/organization-configuration/ec2",
|
|
63
|
+
checked_value="Inspector EC2 auto-enable is configured",
|
|
64
|
+
actual_value=f"EC2 auto-enable is configured in {region}",
|
|
65
|
+
remediation="No remediation needed"
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
return self.findings
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SRA-INSPECTOR-09: Inspector ECR Auto-Enable is Configured.
|
|
3
|
+
"""
|
|
4
|
+
from typing import List, Dict, Any
|
|
5
|
+
from sraverify.services.inspector.base import InspectorCheck
|
|
6
|
+
from sraverify.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SRA_INSPECTOR_09(InspectorCheck):
|
|
10
|
+
"""Check if Inspector ECR auto-enable is configured."""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
"""Initialize the check."""
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.check_id = "SRA-INSPECTOR-09"
|
|
16
|
+
self.check_name = "Inspector ECR auto-enable is configured"
|
|
17
|
+
self.account_type = "audit"
|
|
18
|
+
self.severity = "HIGH"
|
|
19
|
+
self.description = (
|
|
20
|
+
"This check verifies whether Inspector is configured to automatically enable ECR scanning for new accounts. "
|
|
21
|
+
"Auto-enable ensures that container images in ECR repositories in new accounts added to the organization are automatically scanned."
|
|
22
|
+
)
|
|
23
|
+
self.check_logic = (
|
|
24
|
+
"Check runs inspector2 describe-organization-configuration. Check PASS if autoEnable.ecr=true"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
28
|
+
"""
|
|
29
|
+
Execute the check.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
List of findings
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
# Check each region separately
|
|
36
|
+
for region in self.regions:
|
|
37
|
+
# Get organization configuration for this region
|
|
38
|
+
org_config = self.get_organization_configuration(region)
|
|
39
|
+
|
|
40
|
+
# Check if ECR auto-enable is configured
|
|
41
|
+
ecr_enabled = org_config.get('autoEnable', {}).get('ecr', False)
|
|
42
|
+
|
|
43
|
+
if not ecr_enabled:
|
|
44
|
+
self.findings.append(
|
|
45
|
+
self.create_finding(
|
|
46
|
+
status="FAIL",
|
|
47
|
+
region=region,
|
|
48
|
+
resource_id=f"inspector2/{region}/organization-configuration/ecr",
|
|
49
|
+
checked_value="Inspector ECR auto-enable is configured",
|
|
50
|
+
actual_value="ECR auto-enable is not configured",
|
|
51
|
+
remediation=(
|
|
52
|
+
"Configure Inspector ECR auto-enable using the AWS Console or CLI command: "
|
|
53
|
+
f"aws inspector2 update-organization-configuration --auto-enable ecr=true --region {region}"
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
else:
|
|
58
|
+
self.findings.append(
|
|
59
|
+
self.create_finding(
|
|
60
|
+
status="PASS",
|
|
61
|
+
region=region,
|
|
62
|
+
resource_id=f"inspector2/{region}/organization-configuration/ecr",
|
|
63
|
+
checked_value="Inspector ECR auto-enable is configured",
|
|
64
|
+
actual_value="ECR auto-enable is configured",
|
|
65
|
+
remediation="No remediation needed"
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
return self.findings
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SRA-INSPECTOR-10: Inspector Lambda Auto-Enable is Configured.
|
|
3
|
+
"""
|
|
4
|
+
from typing import List, Dict, Any
|
|
5
|
+
from sraverify.services.inspector.base import InspectorCheck
|
|
6
|
+
from sraverify.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SRA_INSPECTOR_10(InspectorCheck):
|
|
10
|
+
"""Check if Inspector Lambda auto-enable is configured."""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
"""Initialize the check."""
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.check_id = "SRA-INSPECTOR-10"
|
|
16
|
+
self.check_name = "Inspector Lambda auto-enable is configured"
|
|
17
|
+
self.account_type = "audit"
|
|
18
|
+
self.severity = "HIGH"
|
|
19
|
+
self.description = (
|
|
20
|
+
"This check verifies whether Inspector is configured to automatically enable Lambda scanning for new accounts. "
|
|
21
|
+
"Auto-enable ensures that Lambda functions in new accounts added to the organization are automatically scanned."
|
|
22
|
+
)
|
|
23
|
+
self.check_logic = (
|
|
24
|
+
"Check runs inspector2 describe-organization-configuration. Check PASS if autoEnable.lambda=true"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
28
|
+
"""
|
|
29
|
+
Execute the check.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
List of findings
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
# Check each region separately
|
|
36
|
+
for region in self.regions:
|
|
37
|
+
# Get organization configuration for this region
|
|
38
|
+
org_config = self.get_organization_configuration(region)
|
|
39
|
+
|
|
40
|
+
# Check if Lambda auto-enable is configured
|
|
41
|
+
lambda_enabled = org_config.get('autoEnable', {}).get('lambda', False)
|
|
42
|
+
|
|
43
|
+
if not lambda_enabled:
|
|
44
|
+
self.findings.append(
|
|
45
|
+
self.create_finding(
|
|
46
|
+
status="FAIL",
|
|
47
|
+
region=region,
|
|
48
|
+
resource_id=f"inspector2/{region}/organization-configuration/lambda",
|
|
49
|
+
checked_value="Inspector Lambda auto-enable is configured",
|
|
50
|
+
actual_value="Lambda auto-enable is not configured",
|
|
51
|
+
remediation=(
|
|
52
|
+
"Configure Inspector Lambda auto-enable using the AWS Console or CLI command: "
|
|
53
|
+
f"aws inspector2 update-organization-configuration --auto-enable lambda=true --region {region}"
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
else:
|
|
58
|
+
self.findings.append(
|
|
59
|
+
self.create_finding(
|
|
60
|
+
status="PASS",
|
|
61
|
+
region=region,
|
|
62
|
+
resource_id=f"inspector2/{region}/organization-configuration/lambda",
|
|
63
|
+
checked_value="Inspector Lambda auto-enable is configured",
|
|
64
|
+
actual_value="Lambda auto-enable is configured",
|
|
65
|
+
remediation="No remediation needed"
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
return self.findings
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SRA-INSPECTOR-11: Inspector Lambda Code Auto-Enable is Configured.
|
|
3
|
+
"""
|
|
4
|
+
from typing import List, Dict, Any
|
|
5
|
+
from sraverify.services.inspector.base import InspectorCheck
|
|
6
|
+
from sraverify.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SRA_INSPECTOR_11(InspectorCheck):
|
|
10
|
+
"""Check if Inspector Lambda Code auto-enable is configured."""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
"""Initialize the check."""
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.check_id = "SRA-INSPECTOR-11"
|
|
16
|
+
self.check_name = "Inspector Lambda Code auto-enable is configured"
|
|
17
|
+
self.account_type = "audit"
|
|
18
|
+
self.severity = "HIGH"
|
|
19
|
+
self.description = (
|
|
20
|
+
"This check verifies whether Inspector is configured to automatically enable Lambda Code scanning for new accounts. "
|
|
21
|
+
"Auto-enable ensures that Lambda function code in new accounts added to the organization is automatically scanned."
|
|
22
|
+
)
|
|
23
|
+
self.check_logic = (
|
|
24
|
+
"Check runs inspector2 describe-organization-configuration. Check PASS if autoEnable.lambdaCode=true"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
def execute(self) -> List[Dict[str, Any]]:
|
|
28
|
+
"""
|
|
29
|
+
Execute the check.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
List of findings
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
# Check each region separately
|
|
36
|
+
for region in self.regions:
|
|
37
|
+
# Get organization configuration for this region
|
|
38
|
+
org_config = self.get_organization_configuration(region)
|
|
39
|
+
|
|
40
|
+
# Check if Lambda Code auto-enable is configured
|
|
41
|
+
lambda_code_enabled = org_config.get('autoEnable', {}).get('lambdaCode', False)
|
|
42
|
+
|
|
43
|
+
if not lambda_code_enabled:
|
|
44
|
+
self.findings.append(
|
|
45
|
+
self.create_finding(
|
|
46
|
+
status="FAIL",
|
|
47
|
+
region=region,
|
|
48
|
+
resource_id=f"inspector2/{region}/organization-configuration/lambdaCode",
|
|
49
|
+
checked_value="Inspector Lambda Code auto-enable is configured",
|
|
50
|
+
actual_value="Lambda Code auto-enable is not configured",
|
|
51
|
+
remediation=(
|
|
52
|
+
"Configure Inspector Lambda Code auto-enable using the AWS Console or CLI command: "
|
|
53
|
+
f"aws inspector2 update-organization-configuration --auto-enable lambdaCode=true --region {region}"
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
else:
|
|
58
|
+
self.findings.append(
|
|
59
|
+
self.create_finding(
|
|
60
|
+
status="PASS",
|
|
61
|
+
region=region,
|
|
62
|
+
resource_id=f"inspector2/{region}/organization-configuration/lambdaCode",
|
|
63
|
+
checked_value="Inspector Lambda Code auto-enable is configured",
|
|
64
|
+
actual_value="Lambda Code auto-enable is configured",
|
|
65
|
+
remediation="No remediation needed"
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
return self.findings
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Inspector client for interacting with AWS Inspector service.
|
|
3
|
+
"""
|
|
4
|
+
from typing import Dict, List, Optional, Any
|
|
5
|
+
import boto3
|
|
6
|
+
from botocore.exceptions import ClientError
|
|
7
|
+
from sraverify.core.logging import logger
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class InspectorClient:
|
|
11
|
+
"""Client for interacting with AWS Inspector service."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, region: str, session: Optional[boto3.Session] = None):
|
|
14
|
+
"""
|
|
15
|
+
Initialize Inspector client for a specific region.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
region: AWS region name
|
|
19
|
+
session: AWS session to use (if None, a new session will be created)
|
|
20
|
+
"""
|
|
21
|
+
self.region = region
|
|
22
|
+
self.session = session or boto3.Session()
|
|
23
|
+
self.client = self.session.client('inspector2', region_name=region)
|
|
24
|
+
self.org_client = self.session.client('organizations', region_name=region)
|
|
25
|
+
|
|
26
|
+
def batch_get_account_status(self, account_ids: List[str]) -> Dict[str, Any]:
|
|
27
|
+
"""
|
|
28
|
+
Get the Inspector account status for specified accounts.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
account_ids: List of AWS account IDs
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
Dictionary containing account status information
|
|
35
|
+
"""
|
|
36
|
+
try:
|
|
37
|
+
logger.debug(f"Getting Inspector account status for accounts {account_ids} in {self.region}")
|
|
38
|
+
response = self.client.batch_get_account_status(accountIds=account_ids)
|
|
39
|
+
return response
|
|
40
|
+
except ClientError as e:
|
|
41
|
+
logger.debug(f"Error getting Inspector account status in {self.region}: {e}")
|
|
42
|
+
return {}
|
|
43
|
+
except Exception as e:
|
|
44
|
+
logger.debug(f"Unexpected error getting Inspector account status in {self.region}: {e}")
|
|
45
|
+
return {}
|
|
46
|
+
|
|
47
|
+
def get_delegated_admin_account(self) -> Dict[str, Any]:
|
|
48
|
+
"""
|
|
49
|
+
Get the delegated administrator account for Inspector.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
Dictionary containing delegated admin account information
|
|
53
|
+
"""
|
|
54
|
+
try:
|
|
55
|
+
logger.debug(f"Getting Inspector delegated admin account in {self.region}")
|
|
56
|
+
response = self.client.get_delegated_admin_account()
|
|
57
|
+
return response
|
|
58
|
+
except ClientError as e:
|
|
59
|
+
logger.debug(f"Error getting Inspector delegated admin account in {self.region}: {e}")
|
|
60
|
+
return {}
|
|
61
|
+
except Exception as e:
|
|
62
|
+
logger.debug(f"Unexpected error getting Inspector delegated admin account in {self.region}: {e}")
|
|
63
|
+
return {}
|
|
64
|
+
|
|
65
|
+
def describe_organization_configuration(self) -> Dict[str, Any]:
|
|
66
|
+
"""
|
|
67
|
+
Describe Inspector organization configuration.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
Dictionary containing organization configuration
|
|
71
|
+
"""
|
|
72
|
+
try:
|
|
73
|
+
logger.debug(f"Describing Inspector organization configuration in {self.region}")
|
|
74
|
+
response = self.client.describe_organization_configuration()
|
|
75
|
+
return response
|
|
76
|
+
except ClientError as e:
|
|
77
|
+
logger.debug(f"Error describing Inspector organization configuration in {self.region}: {e}")
|
|
78
|
+
return {}
|
|
79
|
+
except Exception as e:
|
|
80
|
+
logger.debug(f"Unexpected error describing Inspector organization configuration in {self.region}: {e}")
|
|
81
|
+
return {}
|
|
82
|
+
|
|
83
|
+
def list_organization_accounts(self) -> List[Dict[str, Any]]:
|
|
84
|
+
"""
|
|
85
|
+
List all accounts in the AWS Organization.
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
List of organization accounts
|
|
89
|
+
"""
|
|
90
|
+
try:
|
|
91
|
+
logger.debug(f"Listing organization accounts in {self.region}")
|
|
92
|
+
response = self.org_client.list_accounts()
|
|
93
|
+
return response.get('Accounts', [])
|
|
94
|
+
except ClientError as e:
|
|
95
|
+
logger.debug(f"Error listing organization accounts in {self.region}: {e}")
|
|
96
|
+
return []
|
|
97
|
+
except Exception as e:
|
|
98
|
+
logger.debug(f"Unexpected error listing organization accounts in {self.region}: {e}")
|
|
99
|
+
return []
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Macie security checks.
|
|
3
|
+
"""
|
|
4
|
+
from sraverify.services.macie.checks.sra_macie_01 import SRA_MACIE_01
|
|
5
|
+
from sraverify.services.macie.checks.sra_macie_02 import SRA_MACIE_02
|
|
6
|
+
from sraverify.services.macie.checks.sra_macie_03 import SRA_MACIE_03
|
|
7
|
+
from sraverify.services.macie.checks.sra_macie_04 import SRA_MACIE_04
|
|
8
|
+
from sraverify.services.macie.checks.sra_macie_05 import SRA_MACIE_05
|
|
9
|
+
from sraverify.services.macie.checks.sra_macie_06 import SRA_MACIE_06
|
|
10
|
+
from sraverify.services.macie.checks.sra_macie_07 import SRA_MACIE_07
|
|
11
|
+
from sraverify.services.macie.checks.sra_macie_08 import SRA_MACIE_08
|
|
12
|
+
from sraverify.services.macie.checks.sra_macie_09 import SRA_MACIE_09
|
|
13
|
+
from sraverify.services.macie.checks.sra_macie_10 import SRA_MACIE_10
|
|
14
|
+
|
|
15
|
+
# Register checks
|
|
16
|
+
CHECKS = {
|
|
17
|
+
"SRA-MACIE-01": SRA_MACIE_01,
|
|
18
|
+
"SRA-MACIE-02": SRA_MACIE_02,
|
|
19
|
+
"SRA-MACIE-03": SRA_MACIE_03,
|
|
20
|
+
"SRA-MACIE-04": SRA_MACIE_04,
|
|
21
|
+
"SRA-MACIE-05": SRA_MACIE_05,
|
|
22
|
+
"SRA-MACIE-06": SRA_MACIE_06,
|
|
23
|
+
"SRA-MACIE-07": SRA_MACIE_07,
|
|
24
|
+
"SRA-MACIE-08": SRA_MACIE_08,
|
|
25
|
+
"SRA-MACIE-09": SRA_MACIE_09,
|
|
26
|
+
"SRA-MACIE-10": SRA_MACIE_10,
|
|
27
|
+
}
|