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
docs/cli-reference.md ADDED
@@ -0,0 +1,698 @@
1
+ # CLI Reference
2
+
3
+ Complete command-line interface reference for the AWS CIS Controls Compliance Assessment Framework - a production-ready enterprise solution with 136 implemented rules (131 CIS Controls + 5 bonus security enhancements).
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Global Options](#global-options)
8
+ 2. [Commands Overview](#commands-overview)
9
+ 3. [assess Command](#assess-command)
10
+ 4. [list-controls Command](#list-controls-command)
11
+ 5. [list-regions Command](#list-regions-command)
12
+ 6. [show-stats Command](#show-stats-command)
13
+ 7. [validate-credentials Command](#validate-credentials-command)
14
+ 8. [validate-config Command](#validate-config-command)
15
+ 9. [help-guide Command](#help-guide-command)
16
+ 10. [benchmark Command](#benchmark-command)
17
+ 11. [validate-accuracy Command](#validate-accuracy-command)
18
+ 12. [Environment Variables](#environment-variables)
19
+ 13. [Exit Codes](#exit-codes)
20
+
21
+ ## Global Options
22
+
23
+ These options are available for all commands:
24
+
25
+ ```bash
26
+ aws-cis-assess [GLOBAL_OPTIONS] COMMAND [COMMAND_OPTIONS]
27
+ ```
28
+
29
+ | Option | Description |
30
+ |--------|-------------|
31
+ | `--version` | Show version information and exit |
32
+ | `--verbose, -v` | Enable verbose output |
33
+ | `--debug` | Enable debug logging |
34
+ | `--help` | Show help message and exit |
35
+
36
+ ### Examples
37
+
38
+ ```bash
39
+ # Show version
40
+ aws-cis-assess --version
41
+
42
+ # Enable verbose output for any command
43
+ aws-cis-assess --verbose assess
44
+
45
+ # Enable debug logging
46
+ aws-cis-assess --debug assess --log-file debug.log
47
+ ```
48
+
49
+ ## Commands Overview
50
+
51
+ | Command | Purpose |
52
+ |---------|---------|
53
+ | `assess` | Run CIS Controls compliance assessment |
54
+ | `list-controls` | List available CIS Controls and Config rules |
55
+ | `list-regions` | List available AWS regions |
56
+ | `show-stats` | Show assessment statistics and scope |
57
+ | `validate-credentials` | Test AWS credentials and permissions |
58
+ | `validate-config` | Validate CIS Controls configuration files |
59
+ | `help-guide` | Show detailed help and examples |
60
+ | `benchmark` | Run performance benchmarks |
61
+ | `validate-accuracy` | Validate assessment accuracy against AWS Config |
62
+
63
+ ## assess Command
64
+
65
+ Run CIS Controls compliance assessment.
66
+
67
+ ### Syntax
68
+
69
+ ```bash
70
+ aws-cis-assess assess [OPTIONS]
71
+ ```
72
+
73
+ ### Options
74
+
75
+ #### Scope Options
76
+
77
+ | Option | Type | Description |
78
+ |--------|------|-------------|
79
+ | `--implementation-groups, -ig` | Choice | Implementation Groups to assess (IG1, IG2, IG3) |
80
+ | `--controls, -ctrl` | String | Comma-separated list of specific CIS Control IDs |
81
+ | `--exclude-controls` | String | Comma-separated list of CIS Control IDs to exclude |
82
+ | `--regions, -r` | String | Comma-separated list of AWS regions |
83
+ | `--exclude-regions` | String | Comma-separated list of AWS regions to exclude |
84
+
85
+ #### AWS Credentials Options
86
+
87
+ | Option | Type | Description |
88
+ |--------|------|-------------|
89
+ | `--aws-profile, -p` | String | AWS profile to use for credentials |
90
+ | `--aws-access-key-id` | String | AWS Access Key ID |
91
+ | `--aws-secret-access-key` | String | AWS Secret Access Key |
92
+ | `--aws-session-token` | String | AWS Session Token (for temporary credentials) |
93
+
94
+ #### Configuration Options
95
+
96
+ | Option | Type | Description |
97
+ |--------|------|-------------|
98
+ | `--config-path, -c` | Path | Path to CIS Controls configuration directory |
99
+
100
+ #### Output Options
101
+
102
+ | Option | Type | Description |
103
+ |--------|------|-------------|
104
+ | `--output-format, -f` | Choice | Output format(s): json, html, csv (can specify multiple) |
105
+ | `--output-file, -o` | String | Output file path (extension added based on format) |
106
+ | `--output-dir` | Path | Output directory for generated reports |
107
+
108
+ #### Performance Options
109
+
110
+ | Option | Type | Description |
111
+ |--------|------|-------------|
112
+ | `--max-workers, -w` | Integer | Maximum number of parallel workers (default: 4) |
113
+ | `--timeout` | Integer | Assessment timeout in seconds (default: 3600) |
114
+
115
+ #### Behavior Options
116
+
117
+ | Option | Type | Description |
118
+ |--------|------|-------------|
119
+ | `--enable-error-recovery` / `--disable-error-recovery` | Flag | Enable/disable error recovery mechanisms (default: enabled) |
120
+ | `--enable-audit-trail` / `--disable-audit-trail` | Flag | Enable/disable audit trail logging (default: enabled) |
121
+ | `--dry-run` | Flag | Validate configuration without running assessment |
122
+ | `--quiet, -q` | Flag | Suppress progress output |
123
+
124
+ #### Logging Options
125
+
126
+ | Option | Type | Description |
127
+ |--------|------|-------------|
128
+ | `--log-level` | Choice | Set logging level: DEBUG, INFO, WARNING, ERROR |
129
+ | `--log-file` | Path | Write logs to specified file |
130
+
131
+ ### Examples
132
+
133
+ #### Basic Usage
134
+
135
+ ```bash
136
+ # Run full assessment with default settings
137
+ aws-cis-assess assess
138
+
139
+ # Assess only IG1 controls
140
+ aws-cis-assess assess --implementation-groups IG1
141
+
142
+ # Assess specific controls
143
+ aws-cis-assess assess --controls 1.1,3.3,4.1
144
+
145
+ # Assess specific regions
146
+ aws-cis-assess assess --regions us-east-1,us-west-2
147
+ ```
148
+
149
+ #### Output Formats
150
+
151
+ ```bash
152
+ # Generate HTML report
153
+ aws-cis-assess assess --output-format html --output-file report.html
154
+
155
+ # Generate multiple formats
156
+ aws-cis-assess assess --output-format json,html,csv --output-dir ./reports/
157
+
158
+ # Quiet mode with JSON output
159
+ aws-cis-assess assess --quiet --output-format json --output-file results.json
160
+ ```
161
+
162
+ #### AWS Credentials
163
+
164
+ ```bash
165
+ # Use specific AWS profile
166
+ aws-cis-assess assess --aws-profile production
167
+
168
+ # Use short flag for profile
169
+ aws-cis-assess assess -p production
170
+
171
+ # Use access keys directly
172
+ aws-cis-assess assess --aws-access-key-id AKIA... --aws-secret-access-key ...
173
+
174
+ # Use temporary credentials
175
+ aws-cis-assess assess --aws-access-key-id AKIA... --aws-secret-access-key ... --aws-session-token ...
176
+ ```
177
+
178
+ #### Advanced Options
179
+
180
+ ```bash
181
+ # Custom configuration with detailed logging
182
+ aws-cis-assess assess --config-path ./config/ --log-level DEBUG --log-file assessment.log
183
+
184
+ # Performance tuning
185
+ aws-cis-assess assess --max-workers 2 --timeout 1800
186
+
187
+ # Dry run validation
188
+ aws-cis-assess assess --dry-run --verbose
189
+ ```
190
+
191
+ ## list-controls Command
192
+
193
+ List available CIS Controls and their Config rules.
194
+
195
+ ### Syntax
196
+
197
+ ```bash
198
+ aws-cis-assess list-controls [OPTIONS]
199
+ ```
200
+
201
+ ### Options
202
+
203
+ | Option | Type | Description |
204
+ |--------|------|-------------|
205
+ | `--config-path, -c` | Path | Path to CIS Controls configuration directory |
206
+ | `--output-format, -f` | Choice | Output format: table, json (default: table) |
207
+
208
+ ### Examples
209
+
210
+ ```bash
211
+ # List controls in table format
212
+ aws-cis-assess list-controls
213
+
214
+ # List controls in JSON format
215
+ aws-cis-assess list-controls --output-format json
216
+
217
+ # Use custom configuration
218
+ aws-cis-assess list-controls --config-path ./custom-config/
219
+ ```
220
+
221
+ ### Output Format
222
+
223
+ #### Table Format
224
+ ```
225
+ IG1 - Essential Cyber Hygiene
226
+ ================================================================================
227
+ Control ID | Title | Config Rules
228
+ -----------|------------------------------------------|------------------
229
+ 1.1 | Establish and Maintain Detailed... | 5 Config rules
230
+ 3.3 | Configure Data Access Control Lists | 10 Config rules
231
+ 4.1 | Establish and Maintain a Secure... | 5 Config rules
232
+ ```
233
+
234
+ #### JSON Format
235
+ ```json
236
+ {
237
+ "1.1": {
238
+ "title": "Establish and Maintain Detailed Enterprise Asset Inventory",
239
+ "implementation_group": "IG1",
240
+ "weight": 1.0,
241
+ "config_rules": [
242
+ {
243
+ "name": "eip-attached",
244
+ "resource_types": ["AWS::EC2::EIP"],
245
+ "description": "Ensures Elastic IPs are attached to EC2 instances or ENIs"
246
+ }
247
+ ]
248
+ }
249
+ }
250
+ ```
251
+
252
+ ## list-regions Command
253
+
254
+ List available AWS regions.
255
+
256
+ ### Syntax
257
+
258
+ ```bash
259
+ aws-cis-assess list-regions [OPTIONS]
260
+ ```
261
+
262
+ ### Options
263
+
264
+ | Option | Type | Description |
265
+ |--------|------|-------------|
266
+ | `--aws-profile, -p` | String | AWS profile to use for credentials |
267
+ | `--output-format, -f` | Choice | Output format: table, json (default: table) |
268
+
269
+ ### Examples
270
+
271
+ ```bash
272
+ # List regions in table format
273
+ aws-cis-assess list-regions
274
+
275
+ # List regions in JSON format
276
+ aws-cis-assess list-regions --output-format json
277
+
278
+ # Use specific AWS profile
279
+ aws-cis-assess list-regions --aws-profile production
280
+ ```
281
+
282
+ ### Output Format
283
+
284
+ #### Table Format
285
+ ```
286
+ 📍 Available AWS Regions
287
+ ==================================================
288
+ Region | Default
289
+ ----------------|--------
290
+ us-east-1 | ✓
291
+ us-west-2 | ✓
292
+ eu-west-1 | ✓
293
+ ap-southeast-1 |
294
+ ```
295
+
296
+ #### JSON Format
297
+ ```json
298
+ {
299
+ "enabled_regions": [
300
+ "us-east-1",
301
+ "us-west-2",
302
+ "eu-west-1",
303
+ "ap-southeast-1"
304
+ ],
305
+ "default_regions": [
306
+ "us-east-1",
307
+ "us-west-2",
308
+ "eu-west-1"
309
+ ],
310
+ "total_enabled": 4,
311
+ "total_default": 3
312
+ }
313
+ ```
314
+
315
+ ## show-stats Command
316
+
317
+ Show assessment statistics and scope.
318
+
319
+ ### Syntax
320
+
321
+ ```bash
322
+ aws-cis-assess show-stats [OPTIONS]
323
+ ```
324
+
325
+ ### Options
326
+
327
+ | Option | Type | Description |
328
+ |--------|------|-------------|
329
+ | `--config-path, -c` | Path | Path to CIS Controls configuration directory |
330
+ | `--implementation-groups, -ig` | Choice | Implementation Groups to analyze |
331
+ | `--controls` | String | Comma-separated list of specific CIS Control IDs |
332
+ | `--regions, -r` | String | Comma-separated list of AWS regions |
333
+ | `--output-format, -f` | Choice | Output format: table, json (default: table) |
334
+
335
+ ### Examples
336
+
337
+ ```bash
338
+ # Show statistics for all controls
339
+ aws-cis-assess show-stats
340
+
341
+ # Show statistics for specific Implementation Groups
342
+ aws-cis-assess show-stats --implementation-groups IG1,IG2
343
+
344
+ # Show statistics for specific controls
345
+ aws-cis-assess show-stats --controls 1.1,3.3,4.1
346
+
347
+ # Show statistics in JSON format
348
+ aws-cis-assess show-stats --output-format json
349
+ ```
350
+
351
+ ### Output Format
352
+
353
+ ```
354
+ 📊 Assessment Statistics
355
+ ==================================================
356
+ Total Controls: 15
357
+ Total Config Rules: 106
358
+ Total Regions: 3
359
+ Estimated Assessments: 318
360
+
361
+ By Implementation Group:
362
+ IG1: 8 controls, 56 rules
363
+ IG2: 5 controls, 30 rules
364
+ IG3: 2 controls, 20 rules
365
+
366
+ By AWS Service:
367
+ EC2: 45 assessments
368
+ IAM: 32 assessments
369
+ S3: 28 assessments
370
+ ...
371
+ ```
372
+
373
+ ## validate-credentials Command
374
+
375
+ Test AWS credentials and permissions.
376
+
377
+ ### Syntax
378
+
379
+ ```bash
380
+ aws-cis-assess validate-credentials [OPTIONS]
381
+ ```
382
+
383
+ ### Options
384
+
385
+ | Option | Type | Description |
386
+ |--------|------|-------------|
387
+ | `--aws-profile, -p` | String | AWS profile to use for credentials |
388
+ | `--aws-access-key-id` | String | AWS Access Key ID |
389
+ | `--aws-secret-access-key` | String | AWS Secret Access Key |
390
+ | `--aws-session-token` | String | AWS Session Token |
391
+ | `--regions, -r` | String | Comma-separated list of AWS regions to validate |
392
+
393
+ ### Examples
394
+
395
+ ```bash
396
+ # Validate default credentials
397
+ aws-cis-assess validate-credentials
398
+
399
+ # Validate specific AWS profile
400
+ aws-cis-assess validate-credentials --aws-profile production
401
+
402
+ # Validate credentials for specific regions
403
+ aws-cis-assess validate-credentials --regions us-east-1,us-west-2
404
+
405
+ # Validate access keys directly
406
+ aws-cis-assess validate-credentials --aws-access-key-id AKIA... --aws-secret-access-key ...
407
+ ```
408
+
409
+ ### Output Format
410
+
411
+ ```
412
+ 🔧 Validating AWS credentials...
413
+ ✅ AWS credentials are valid
414
+ Account ID: 123456789012
415
+ User/Role: arn:aws:iam::123456789012:user/assessment-user
416
+ Regions: ['us-east-1', 'us-west-2', 'eu-west-1']
417
+ Supported Services: ec2, iam, s3, rds, cloudtrail...
418
+ ```
419
+
420
+ ## validate-config Command
421
+
422
+ Validate CIS Controls configuration files.
423
+
424
+ ### Syntax
425
+
426
+ ```bash
427
+ aws-cis-assess validate-config [OPTIONS]
428
+ ```
429
+
430
+ ### Options
431
+
432
+ | Option | Type | Description |
433
+ |--------|------|-------------|
434
+ | `--config-path, -c` | Path | Path to CIS Controls configuration directory |
435
+
436
+ ### Examples
437
+
438
+ ```bash
439
+ # Validate default configuration
440
+ aws-cis-assess validate-config
441
+
442
+ # Validate custom configuration
443
+ aws-cis-assess validate-config --config-path ./custom-config/
444
+ ```
445
+
446
+ ### Output Format
447
+
448
+ ```
449
+ 🔧 Validating CIS Controls configuration...
450
+ ✅ Configuration is valid
451
+
452
+ Configuration Summary:
453
+ IG1: 56 Config rules
454
+ IG2: 30 Config rules
455
+ IG3: 20 Config rules
456
+ ```
457
+
458
+ ## help-guide Command
459
+
460
+ Show detailed help, examples, and troubleshooting guide.
461
+
462
+ ### Syntax
463
+
464
+ ```bash
465
+ aws-cis-assess help-guide [OPTIONS]
466
+ ```
467
+
468
+ ### Options
469
+
470
+ | Option | Type | Description |
471
+ |--------|------|-------------|
472
+ | `--topic, -t` | Choice | Specific help topic: examples, troubleshooting, best-practices |
473
+
474
+ ### Examples
475
+
476
+ ```bash
477
+ # Show all help topics
478
+ aws-cis-assess help-guide
479
+
480
+ # Show usage examples
481
+ aws-cis-assess help-guide --topic examples
482
+
483
+ # Show troubleshooting guide
484
+ aws-cis-assess help-guide --topic troubleshooting
485
+
486
+ # Show best practices
487
+ aws-cis-assess help-guide --topic best-practices
488
+ ```
489
+
490
+ ## benchmark Command
491
+
492
+ Run performance benchmarks for regression testing.
493
+
494
+ ### Syntax
495
+
496
+ ```bash
497
+ aws-cis-assess benchmark [OPTIONS]
498
+ ```
499
+
500
+ ### Options
501
+
502
+ | Option | Type | Description |
503
+ |--------|------|-------------|
504
+ | `--output-dir, -o` | Path | Output directory for benchmark results (default: benchmarks) |
505
+ | `--iterations, -i` | Integer | Number of iterations per benchmark test (default: 3) |
506
+ | `--baseline-file, -b` | Path | Baseline file for regression detection |
507
+ | `--regression-threshold` | Float | Performance regression threshold (default: 1.3) |
508
+ | `--verbose, -v` | Flag | Enable verbose output |
509
+
510
+ ### Examples
511
+
512
+ ```bash
513
+ # Run basic benchmark
514
+ aws-cis-assess benchmark
515
+
516
+ # Run with custom iterations and output directory
517
+ aws-cis-assess benchmark --iterations 5 --output-dir ./perf-results
518
+
519
+ # Run with baseline comparison
520
+ aws-cis-assess benchmark --baseline-file baseline.json --regression-threshold 1.2
521
+ ```
522
+
523
+ ## validate-accuracy Command
524
+
525
+ Validate assessment accuracy against AWS Config rule evaluations.
526
+
527
+ ### Syntax
528
+
529
+ ```bash
530
+ aws-cis-assess validate-accuracy [OPTIONS]
531
+ ```
532
+
533
+ ### Options
534
+
535
+ | Option | Type | Description |
536
+ |--------|------|-------------|
537
+ | `--aws-profile, -p` | String | AWS profile to use for credentials |
538
+ | `--aws-access-key-id` | String | AWS Access Key ID |
539
+ | `--aws-secret-access-key` | String | AWS Secret Access Key |
540
+ | `--aws-session-token` | String | AWS Session Token |
541
+ | `--regions, -r` | String | Comma-separated list of AWS regions to validate |
542
+ | `--config-rules` | String | Comma-separated list of specific Config rules to validate |
543
+ | `--output-file, -o` | Path | Output file for validation report |
544
+ | `--check-config-availability` | Flag | Check AWS Config service availability in regions |
545
+ | `--verbose, -v` | Flag | Enable verbose output |
546
+
547
+ ### Examples
548
+
549
+ ```bash
550
+ # Basic accuracy validation
551
+ aws-cis-assess validate-accuracy
552
+
553
+ # Validate specific regions
554
+ aws-cis-assess validate-accuracy --regions us-east-1,us-west-2
555
+
556
+ # Validate specific Config rules
557
+ aws-cis-assess validate-accuracy --config-rules eip-attached,iam-password-policy
558
+
559
+ # Check Config availability first
560
+ aws-cis-assess validate-accuracy --check-config-availability
561
+ ```
562
+
563
+ ## Environment Variables
564
+
565
+ The tool recognizes these environment variables:
566
+
567
+ | Variable | Description |
568
+ |----------|-------------|
569
+ | `AWS_ACCESS_KEY_ID` | AWS access key ID |
570
+ | `AWS_SECRET_ACCESS_KEY` | AWS secret access key |
571
+ | `AWS_SESSION_TOKEN` | AWS session token |
572
+ | `AWS_DEFAULT_REGION` | Default AWS region |
573
+ | `AWS_PROFILE` | AWS profile name |
574
+ | `AWS_CONFIG_FILE` | AWS config file path |
575
+ | `AWS_SHARED_CREDENTIALS_FILE` | AWS credentials file path |
576
+ | `HTTP_PROXY` | HTTP proxy URL |
577
+ | `HTTPS_PROXY` | HTTPS proxy URL |
578
+ | `NO_PROXY` | Comma-separated list of hosts to bypass proxy |
579
+
580
+ ### Examples
581
+
582
+ ```bash
583
+ # Set AWS credentials via environment variables
584
+ export AWS_ACCESS_KEY_ID=AKIA...
585
+ export AWS_SECRET_ACCESS_KEY=...
586
+ export AWS_DEFAULT_REGION=us-east-1
587
+
588
+ # Set proxy configuration
589
+ export HTTPS_PROXY=https://proxy.company.com:8080
590
+ export NO_PROXY=localhost,127.0.0.1,.company.com
591
+
592
+ # Run assessment
593
+ aws-cis-assess assess
594
+ ```
595
+
596
+ ## Exit Codes
597
+
598
+ The tool uses these exit codes:
599
+
600
+ | Code | Description |
601
+ |------|-------------|
602
+ | 0 | Success |
603
+ | 1 | General error |
604
+ | 2 | Configuration error |
605
+ | 3 | Credential error |
606
+ | 4 | Permission error |
607
+ | 5 | Network error |
608
+ | 130 | Interrupted by user (Ctrl+C) |
609
+
610
+ ### Examples
611
+
612
+ ```bash
613
+ # Check exit code in scripts
614
+ aws-cis-assess assess --quiet
615
+ if [ $? -eq 0 ]; then
616
+ echo "Assessment completed successfully"
617
+ else
618
+ echo "Assessment failed with exit code $?"
619
+ fi
620
+
621
+ # Handle specific error codes
622
+ case $? in
623
+ 0) echo "Success" ;;
624
+ 2) echo "Configuration error - check your config files" ;;
625
+ 3) echo "Credential error - check your AWS credentials" ;;
626
+ 4) echo "Permission error - check your IAM permissions" ;;
627
+ *) echo "Unknown error" ;;
628
+ esac
629
+ ```
630
+
631
+ ## Common Usage Patterns
632
+
633
+ ### CI/CD Integration
634
+
635
+ ```bash
636
+ #!/bin/bash
637
+ # CI/CD pipeline script
638
+
639
+ # Validate credentials
640
+ aws-cis-assess validate-credentials --aws-profile ci-role || exit 1
641
+
642
+ # Run assessment
643
+ aws-cis-assess assess \
644
+ --aws-profile ci-role \
645
+ --implementation-groups IG1 \
646
+ --quiet \
647
+ --output-format json \
648
+ --output-file ci-results.json || exit 1
649
+
650
+ # Check compliance threshold
651
+ COMPLIANCE=$(jq -r '.compliance_summary.ig1_compliance_percentage' ci-results.json)
652
+ if (( $(echo "$COMPLIANCE < 80" | bc -l) )); then
653
+ echo "Compliance below threshold: $COMPLIANCE%"
654
+ exit 1
655
+ fi
656
+ ```
657
+
658
+ ### Multi-Account Assessment
659
+
660
+ ```bash
661
+ #!/bin/bash
662
+ # Multi-account assessment script
663
+
664
+ ACCOUNTS=("account1-prod" "account2-prod" "account3-prod")
665
+
666
+ for account in "${ACCOUNTS[@]}"; do
667
+ echo "Assessing $account..."
668
+ aws-cis-assess assess \
669
+ --aws-profile "$account" \
670
+ --output-format json \
671
+ --output-file "${account}-results.json" \
672
+ --quiet
673
+ done
674
+ ```
675
+
676
+ ### Scheduled Assessment
677
+
678
+ ```bash
679
+ #!/bin/bash
680
+ # Cron job script for regular assessments
681
+
682
+ DATE=$(date +%Y%m%d_%H%M%S)
683
+ OUTPUT_DIR="/var/log/cis-assessments/$DATE"
684
+
685
+ mkdir -p "$OUTPUT_DIR"
686
+
687
+ aws-cis-assess assess \
688
+ --output-format html,json \
689
+ --output-dir "$OUTPUT_DIR" \
690
+ --log-file "$OUTPUT_DIR/assessment.log" \
691
+ --quiet
692
+
693
+ # Send notification if compliance drops
694
+ COMPLIANCE=$(jq -r '.compliance_summary.overall_compliance_percentage' "$OUTPUT_DIR"/*.json)
695
+ if (( $(echo "$COMPLIANCE < 85" | bc -l) )); then
696
+ echo "Compliance alert: $COMPLIANCE%" | mail -s "CIS Compliance Alert" admin@company.com
697
+ fi
698
+ ```