aws-cis-controls-assessment 1.0.3__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.
Files changed (77) hide show
  1. aws_cis_assessment/__init__.py +11 -0
  2. aws_cis_assessment/cli/__init__.py +3 -0
  3. aws_cis_assessment/cli/examples.py +274 -0
  4. aws_cis_assessment/cli/main.py +1259 -0
  5. aws_cis_assessment/cli/utils.py +356 -0
  6. aws_cis_assessment/config/__init__.py +1 -0
  7. aws_cis_assessment/config/config_loader.py +328 -0
  8. aws_cis_assessment/config/rules/cis_controls_ig1.yaml +590 -0
  9. aws_cis_assessment/config/rules/cis_controls_ig2.yaml +412 -0
  10. aws_cis_assessment/config/rules/cis_controls_ig3.yaml +100 -0
  11. aws_cis_assessment/controls/__init__.py +1 -0
  12. aws_cis_assessment/controls/base_control.py +400 -0
  13. aws_cis_assessment/controls/ig1/__init__.py +239 -0
  14. aws_cis_assessment/controls/ig1/control_1_1.py +586 -0
  15. aws_cis_assessment/controls/ig1/control_2_2.py +231 -0
  16. aws_cis_assessment/controls/ig1/control_3_3.py +718 -0
  17. aws_cis_assessment/controls/ig1/control_3_4.py +235 -0
  18. aws_cis_assessment/controls/ig1/control_4_1.py +461 -0
  19. aws_cis_assessment/controls/ig1/control_access_keys.py +310 -0
  20. aws_cis_assessment/controls/ig1/control_advanced_security.py +512 -0
  21. aws_cis_assessment/controls/ig1/control_backup_recovery.py +510 -0
  22. aws_cis_assessment/controls/ig1/control_cloudtrail_logging.py +197 -0
  23. aws_cis_assessment/controls/ig1/control_critical_security.py +422 -0
  24. aws_cis_assessment/controls/ig1/control_data_protection.py +898 -0
  25. aws_cis_assessment/controls/ig1/control_iam_advanced.py +573 -0
  26. aws_cis_assessment/controls/ig1/control_iam_governance.py +493 -0
  27. aws_cis_assessment/controls/ig1/control_iam_policies.py +383 -0
  28. aws_cis_assessment/controls/ig1/control_instance_optimization.py +100 -0
  29. aws_cis_assessment/controls/ig1/control_network_enhancements.py +203 -0
  30. aws_cis_assessment/controls/ig1/control_network_security.py +672 -0
  31. aws_cis_assessment/controls/ig1/control_s3_enhancements.py +173 -0
  32. aws_cis_assessment/controls/ig1/control_s3_security.py +422 -0
  33. aws_cis_assessment/controls/ig1/control_vpc_security.py +235 -0
  34. aws_cis_assessment/controls/ig2/__init__.py +172 -0
  35. aws_cis_assessment/controls/ig2/control_3_10.py +698 -0
  36. aws_cis_assessment/controls/ig2/control_3_11.py +1330 -0
  37. aws_cis_assessment/controls/ig2/control_5_2.py +393 -0
  38. aws_cis_assessment/controls/ig2/control_advanced_encryption.py +355 -0
  39. aws_cis_assessment/controls/ig2/control_codebuild_security.py +263 -0
  40. aws_cis_assessment/controls/ig2/control_encryption_rest.py +382 -0
  41. aws_cis_assessment/controls/ig2/control_encryption_transit.py +382 -0
  42. aws_cis_assessment/controls/ig2/control_network_ha.py +467 -0
  43. aws_cis_assessment/controls/ig2/control_remaining_encryption.py +426 -0
  44. aws_cis_assessment/controls/ig2/control_remaining_rules.py +363 -0
  45. aws_cis_assessment/controls/ig2/control_service_logging.py +402 -0
  46. aws_cis_assessment/controls/ig3/__init__.py +49 -0
  47. aws_cis_assessment/controls/ig3/control_12_8.py +395 -0
  48. aws_cis_assessment/controls/ig3/control_13_1.py +467 -0
  49. aws_cis_assessment/controls/ig3/control_3_14.py +523 -0
  50. aws_cis_assessment/controls/ig3/control_7_1.py +359 -0
  51. aws_cis_assessment/core/__init__.py +1 -0
  52. aws_cis_assessment/core/accuracy_validator.py +425 -0
  53. aws_cis_assessment/core/assessment_engine.py +1266 -0
  54. aws_cis_assessment/core/audit_trail.py +491 -0
  55. aws_cis_assessment/core/aws_client_factory.py +313 -0
  56. aws_cis_assessment/core/error_handler.py +607 -0
  57. aws_cis_assessment/core/models.py +166 -0
  58. aws_cis_assessment/core/scoring_engine.py +459 -0
  59. aws_cis_assessment/reporters/__init__.py +8 -0
  60. aws_cis_assessment/reporters/base_reporter.py +454 -0
  61. aws_cis_assessment/reporters/csv_reporter.py +835 -0
  62. aws_cis_assessment/reporters/html_reporter.py +2162 -0
  63. aws_cis_assessment/reporters/json_reporter.py +561 -0
  64. aws_cis_controls_assessment-1.0.3.dist-info/METADATA +248 -0
  65. aws_cis_controls_assessment-1.0.3.dist-info/RECORD +77 -0
  66. aws_cis_controls_assessment-1.0.3.dist-info/WHEEL +5 -0
  67. aws_cis_controls_assessment-1.0.3.dist-info/entry_points.txt +2 -0
  68. aws_cis_controls_assessment-1.0.3.dist-info/licenses/LICENSE +21 -0
  69. aws_cis_controls_assessment-1.0.3.dist-info/top_level.txt +2 -0
  70. docs/README.md +94 -0
  71. docs/assessment-logic.md +766 -0
  72. docs/cli-reference.md +698 -0
  73. docs/config-rule-mappings.md +393 -0
  74. docs/developer-guide.md +858 -0
  75. docs/installation.md +299 -0
  76. docs/troubleshooting.md +634 -0
  77. docs/user-guide.md +487 -0
@@ -0,0 +1,11 @@
1
+ """
2
+ AWS CIS Controls Compliance Assessment Framework
3
+
4
+ A production-ready, enterprise-grade framework for evaluating AWS account configurations against
5
+ CIS Controls Implementation Groups (IG1, IG2, IG3). Implements 145 comprehensive AWS Config rules
6
+ across all implementation groups for complete security compliance assessment.
7
+ """
8
+
9
+ __version__ = "1.0.3"
10
+ __author__ = "AWS CIS Assessment Team"
11
+ __description__ = "Production-ready AWS CIS Controls Compliance Assessment Framework"
@@ -0,0 +1,3 @@
1
+ """Command-line interface for AWS CIS Controls compliance assessment tool."""
2
+
3
+ __version__ = "1.0.0"
@@ -0,0 +1,274 @@
1
+ """Example usage and help content for the CLI."""
2
+
3
+ USAGE_EXAMPLES = {
4
+ "basic": {
5
+ "title": "Basic Assessment",
6
+ "description": "Run a full CIS Controls assessment with default settings",
7
+ "command": "aws-cis-assess assess",
8
+ "explanation": "This will assess all Implementation Groups (IG1, IG2, IG3) in the default region (us-east-1) and generate a JSON report."
9
+ },
10
+ "default_region": {
11
+ "title": "Default Region Assessment",
12
+ "description": "Run assessment using the default region (us-east-1)",
13
+ "command": "aws-cis-assess assess --implementation-groups IG1",
14
+ "explanation": "When no --regions parameter is specified, the assessment runs only in us-east-1 for faster, focused results."
15
+ },
16
+ "specific_ig": {
17
+ "title": "Specific Implementation Group",
18
+ "description": "Assess only essential controls (IG1) in specific regions",
19
+ "command": "aws-cis-assess assess --implementation-groups IG1 --regions us-east-1,us-west-2",
20
+ "explanation": "This focuses on the most critical security controls. Without --regions, it would default to us-east-1 only."
21
+ },
22
+ "specific_controls": {
23
+ "title": "Specific Controls Assessment",
24
+ "description": "Assess only specific CIS Controls across all regions",
25
+ "command": "aws-cis-assess assess --controls 1.1,3.3,4.1",
26
+ "explanation": "This assesses only the specified controls (Asset Inventory, Data Access Control, Secure Configuration) across all regions."
27
+ },
28
+ "exclude_regions": {
29
+ "title": "Exclude Regions",
30
+ "description": "Assess all regions except government or restricted regions",
31
+ "command": "aws-cis-assess assess --exclude-regions us-gov-east-1,us-gov-west-1,cn-north-1",
32
+ "explanation": "This runs assessment on all enabled regions except the specified government and China regions."
33
+ },
34
+ "html_report": {
35
+ "title": "HTML Report Generation",
36
+ "description": "Generate an interactive HTML report with custom output directory",
37
+ "command": "aws-cis-assess assess --output-format html --output-dir ./reports/",
38
+ "explanation": "Creates an interactive web-based report in the specified directory with charts and drill-down capabilities."
39
+ },
40
+ "multiple_formats": {
41
+ "title": "Multiple Output Formats",
42
+ "description": "Generate reports in multiple formats with custom directory",
43
+ "command": "aws-cis-assess assess --output-format json,html,csv --output-dir ./compliance-reports/",
44
+ "explanation": "Creates three different report formats in the specified directory: JSON for automation, HTML for viewing, and CSV for analysis."
45
+ },
46
+ "custom_profile": {
47
+ "title": "Custom AWS Profile with Logging",
48
+ "description": "Use a specific AWS profile with custom configuration and detailed logging",
49
+ "command": "aws-cis-assess assess --aws-profile production --config-path ./config/ --log-level DEBUG --log-file assessment.log",
50
+ "explanation": "Uses the 'production' AWS profile, custom CIS Controls configuration, and saves detailed debug logs to a file."
51
+ },
52
+ "quiet_mode": {
53
+ "title": "Quiet Mode Assessment",
54
+ "description": "Run assessment with minimal output for automation",
55
+ "command": "aws-cis-assess assess --quiet --output-format json --output-file results.json",
56
+ "explanation": "Runs assessment with suppressed progress output, suitable for automated scripts and CI/CD pipelines."
57
+ },
58
+ "timeout_control": {
59
+ "title": "Assessment with Timeout",
60
+ "description": "Run assessment with custom timeout and worker limits",
61
+ "command": "aws-cis-assess assess --timeout 1800 --max-workers 2",
62
+ "explanation": "Runs assessment with 30-minute timeout and limited to 2 parallel workers to reduce API load."
63
+ },
64
+ "dry_run": {
65
+ "title": "Dry Run Validation",
66
+ "description": "Validate configuration and credentials without running assessment",
67
+ "command": "aws-cis-assess assess --dry-run",
68
+ "explanation": "Checks that everything is configured correctly before running the full assessment."
69
+ },
70
+ "list_controls": {
71
+ "title": "List Available Controls",
72
+ "description": "View all available CIS Controls and their Config rules",
73
+ "command": "aws-cis-assess list-controls",
74
+ "explanation": "Shows all CIS Controls organized by Implementation Group with their AWS Config rules."
75
+ },
76
+ "list_regions": {
77
+ "title": "List Available Regions",
78
+ "description": "View all available AWS regions for assessment",
79
+ "command": "aws-cis-assess list-regions",
80
+ "explanation": "Shows all AWS regions that can be used for assessment. Default region is us-east-1."
81
+ },
82
+ "show_stats": {
83
+ "title": "Assessment Statistics",
84
+ "description": "Show detailed statistics about assessment scope",
85
+ "command": "aws-cis-assess show-stats --implementation-groups IG1,IG2",
86
+ "explanation": "Displays statistics about controls, rules, and estimated assessments for the specified scope."
87
+ },
88
+ "validate_credentials": {
89
+ "title": "Credential Validation",
90
+ "description": "Test AWS credentials and permissions",
91
+ "command": "aws-cis-assess validate-credentials --aws-profile production",
92
+ "explanation": "Verifies that the specified AWS profile has the necessary permissions for assessment."
93
+ }
94
+ }
95
+
96
+ TROUBLESHOOTING_GUIDE = {
97
+ "credential_errors": {
98
+ "title": "AWS Credential Issues",
99
+ "problems": [
100
+ "NoCredentialsError: Unable to locate credentials",
101
+ "AccessDenied: User is not authorized to perform operation",
102
+ "InvalidUserID.NotFound: The user ID does not exist"
103
+ ],
104
+ "solutions": [
105
+ "Ensure AWS credentials are configured (aws configure or environment variables)",
106
+ "Verify the AWS profile exists and is accessible",
107
+ "Check that the user/role has necessary IAM permissions",
108
+ "Try using --aws-profile to specify a different profile",
109
+ "Use 'aws-cis-assess validate-credentials' to test credentials"
110
+ ]
111
+ },
112
+ "permission_errors": {
113
+ "title": "IAM Permission Issues",
114
+ "problems": [
115
+ "AccessDenied errors for specific AWS services",
116
+ "Some controls show 'INSUFFICIENT_PERMISSIONS'",
117
+ "Assessment completes but with many errors"
118
+ ],
119
+ "solutions": [
120
+ "Ensure the user/role has ReadOnlyAccess or equivalent permissions",
121
+ "Add specific service permissions (EC2, IAM, S3, etc.)",
122
+ "Use --verbose flag to see detailed permission errors",
123
+ "Consider using a role with broader read permissions",
124
+ "Use --log-level DEBUG for detailed permission analysis"
125
+ ]
126
+ },
127
+ "configuration_errors": {
128
+ "title": "Configuration Issues",
129
+ "problems": [
130
+ "Configuration validation failed",
131
+ "Missing configuration files",
132
+ "Invalid YAML syntax in config files",
133
+ "Specific controls not found"
134
+ ],
135
+ "solutions": [
136
+ "Run 'aws-cis-assess validate-config' to check configuration",
137
+ "Ensure all required YAML files are present in config directory",
138
+ "Check YAML syntax and structure",
139
+ "Use default configuration if custom config has issues",
140
+ "Use 'aws-cis-assess list-controls' to see available controls",
141
+ "Verify control IDs match exactly (case-sensitive)"
142
+ ]
143
+ },
144
+ "network_errors": {
145
+ "title": "Network and API Issues",
146
+ "problems": [
147
+ "Connection timeouts",
148
+ "API throttling errors",
149
+ "Service unavailable errors",
150
+ "Assessment taking too long"
151
+ ],
152
+ "solutions": [
153
+ "Check internet connectivity and AWS service status",
154
+ "Reduce --max-workers to decrease API call rate",
155
+ "Increase --timeout value for large assessments",
156
+ "Retry the assessment after a few minutes",
157
+ "Use --regions to limit assessment to specific regions",
158
+ "Use --exclude-regions to skip problematic regions"
159
+ ]
160
+ },
161
+ "scope_issues": {
162
+ "title": "Assessment Scope Problems",
163
+ "problems": [
164
+ "Too many resources being assessed",
165
+ "Assessment running out of memory",
166
+ "Unexpected controls being assessed",
167
+ "Missing expected controls"
168
+ ],
169
+ "solutions": [
170
+ "Use --controls to assess only specific controls",
171
+ "Use --implementation-groups to limit scope",
172
+ "Use --exclude-controls to skip problematic controls",
173
+ "Use 'aws-cis-assess show-stats' to preview assessment scope",
174
+ "Reduce --max-workers to limit memory usage",
175
+ "Use --regions to limit geographic scope"
176
+ ]
177
+ },
178
+ "output_issues": {
179
+ "title": "Output and Reporting Problems",
180
+ "problems": [
181
+ "Reports not generated in expected location",
182
+ "Permission denied writing output files",
183
+ "Output format not as expected",
184
+ "Log files not created"
185
+ ],
186
+ "solutions": [
187
+ "Use --output-dir to specify output directory",
188
+ "Ensure write permissions for output directory",
189
+ "Check disk space availability",
190
+ "Use absolute paths for --output-file and --log-file",
191
+ "Verify output format is supported (json, html, csv)",
192
+ "Use --quiet to reduce console output if needed"
193
+ ]
194
+ }
195
+ }
196
+
197
+ BEST_PRACTICES = [
198
+ {
199
+ "title": "Start with IG1",
200
+ "description": "Begin with IG1 (Essential Cyber Hygiene) controls as they provide the foundation for security.",
201
+ "command": "aws-cis-assess assess --implementation-groups IG1"
202
+ },
203
+ {
204
+ "title": "Use Dry Run First",
205
+ "description": "Always validate your configuration before running a full assessment.",
206
+ "command": "aws-cis-assess assess --dry-run"
207
+ },
208
+ {
209
+ "title": "Preview Assessment Scope",
210
+ "description": "Use show-stats to understand what will be assessed before running.",
211
+ "command": "aws-cis-assess show-stats --implementation-groups IG1,IG2"
212
+ },
213
+ {
214
+ "title": "Focus on Specific Controls",
215
+ "description": "Start with critical controls to get faster, focused results.",
216
+ "command": "aws-cis-assess assess --controls 1.1,3.3,5.2"
217
+ },
218
+ {
219
+ "title": "Generate Multiple Formats",
220
+ "description": "Create both HTML (for viewing) and JSON (for automation) reports.",
221
+ "command": "aws-cis-assess assess --output-format html,json --output-dir ./reports/"
222
+ },
223
+ {
224
+ "title": "Focus on Critical Regions",
225
+ "description": "Expand beyond the default region (us-east-1) to include your most important regions.",
226
+ "command": "aws-cis-assess assess --regions us-east-1,us-west-2"
227
+ },
228
+ {
229
+ "title": "Exclude Problematic Regions",
230
+ "description": "Skip regions with known issues or restrictions.",
231
+ "command": "aws-cis-assess assess --exclude-regions us-gov-east-1,cn-north-1"
232
+ },
233
+ {
234
+ "title": "Use Detailed Logging for Troubleshooting",
235
+ "description": "Enable detailed logging when diagnosing issues.",
236
+ "command": "aws-cis-assess assess --log-level DEBUG --log-file debug.log"
237
+ },
238
+ {
239
+ "title": "Quiet Mode for Automation",
240
+ "description": "Use quiet mode in scripts and CI/CD pipelines.",
241
+ "command": "aws-cis-assess assess --quiet --output-format json"
242
+ },
243
+ {
244
+ "title": "Control Resource Usage",
245
+ "description": "Limit workers and set timeouts for large assessments.",
246
+ "command": "aws-cis-assess assess --max-workers 2 --timeout 1800"
247
+ },
248
+ {
249
+ "title": "Regular Assessments",
250
+ "description": "Run assessments regularly to track compliance improvements over time.",
251
+ "command": "# Set up a cron job or scheduled task"
252
+ },
253
+ {
254
+ "title": "Validate Credentials First",
255
+ "description": "Test credentials and permissions before running assessments.",
256
+ "command": "aws-cis-assess validate-credentials --aws-profile production"
257
+ }
258
+ ]
259
+
260
+ def get_usage_example(example_name: str) -> dict:
261
+ """Get a specific usage example by name."""
262
+ return USAGE_EXAMPLES.get(example_name, {})
263
+
264
+ def get_all_examples() -> dict:
265
+ """Get all usage examples."""
266
+ return USAGE_EXAMPLES
267
+
268
+ def get_troubleshooting_guide() -> dict:
269
+ """Get the troubleshooting guide."""
270
+ return TROUBLESHOOTING_GUIDE
271
+
272
+ def get_best_practices() -> list:
273
+ """Get best practices list."""
274
+ return BEST_PRACTICES