runbooks 0.7.0__py3-none-any.whl → 0.7.6__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.
- runbooks/__init__.py +87 -37
- runbooks/cfat/README.md +300 -49
- runbooks/cfat/__init__.py +2 -2
- runbooks/finops/__init__.py +1 -1
- runbooks/finops/cli.py +1 -1
- runbooks/inventory/collectors/__init__.py +8 -0
- runbooks/inventory/collectors/aws_management.py +791 -0
- runbooks/inventory/collectors/aws_networking.py +3 -3
- runbooks/main.py +3389 -782
- runbooks/operate/__init__.py +207 -0
- runbooks/operate/base.py +311 -0
- runbooks/operate/cloudformation_operations.py +619 -0
- runbooks/operate/cloudwatch_operations.py +496 -0
- runbooks/operate/dynamodb_operations.py +812 -0
- runbooks/operate/ec2_operations.py +926 -0
- runbooks/operate/iam_operations.py +569 -0
- runbooks/operate/s3_operations.py +1211 -0
- runbooks/operate/tagging_operations.py +655 -0
- runbooks/remediation/CLAUDE.md +100 -0
- runbooks/remediation/DOME9.md +218 -0
- runbooks/remediation/README.md +26 -0
- runbooks/remediation/Tests/__init__.py +0 -0
- runbooks/remediation/Tests/update_policy.py +74 -0
- runbooks/remediation/__init__.py +95 -0
- runbooks/remediation/acm_cert_expired_unused.py +98 -0
- runbooks/remediation/acm_remediation.py +875 -0
- runbooks/remediation/api_gateway_list.py +167 -0
- runbooks/remediation/base.py +643 -0
- runbooks/remediation/cloudtrail_remediation.py +908 -0
- runbooks/remediation/cloudtrail_s3_modifications.py +296 -0
- runbooks/remediation/cognito_active_users.py +78 -0
- runbooks/remediation/cognito_remediation.py +856 -0
- runbooks/remediation/cognito_user_password_reset.py +163 -0
- runbooks/remediation/commons.py +455 -0
- runbooks/remediation/dynamodb_optimize.py +155 -0
- runbooks/remediation/dynamodb_remediation.py +744 -0
- runbooks/remediation/dynamodb_server_side_encryption.py +108 -0
- runbooks/remediation/ec2_public_ips.py +134 -0
- runbooks/remediation/ec2_remediation.py +892 -0
- runbooks/remediation/ec2_subnet_disable_auto_ip_assignment.py +72 -0
- runbooks/remediation/ec2_unattached_ebs_volumes.py +448 -0
- runbooks/remediation/ec2_unused_security_groups.py +202 -0
- runbooks/remediation/kms_enable_key_rotation.py +651 -0
- runbooks/remediation/kms_remediation.py +717 -0
- runbooks/remediation/lambda_list.py +243 -0
- runbooks/remediation/lambda_remediation.py +971 -0
- runbooks/remediation/multi_account.py +569 -0
- runbooks/remediation/rds_instance_list.py +199 -0
- runbooks/remediation/rds_remediation.py +873 -0
- runbooks/remediation/rds_snapshot_list.py +192 -0
- runbooks/remediation/requirements.txt +118 -0
- runbooks/remediation/s3_block_public_access.py +159 -0
- runbooks/remediation/s3_bucket_public_access.py +143 -0
- runbooks/remediation/s3_disable_static_website_hosting.py +74 -0
- runbooks/remediation/s3_downloader.py +215 -0
- runbooks/remediation/s3_enable_access_logging.py +562 -0
- runbooks/remediation/s3_encryption.py +526 -0
- runbooks/remediation/s3_force_ssl_secure_policy.py +143 -0
- runbooks/remediation/s3_list.py +141 -0
- runbooks/remediation/s3_object_search.py +201 -0
- runbooks/remediation/s3_remediation.py +816 -0
- runbooks/remediation/scan_for_phrase.py +425 -0
- runbooks/remediation/workspaces_list.py +220 -0
- runbooks/security/__init__.py +9 -10
- runbooks/security/security_baseline_tester.py +4 -2
- runbooks-0.7.6.dist-info/METADATA +608 -0
- {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/RECORD +84 -76
- {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/entry_points.txt +0 -1
- {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/top_level.txt +0 -1
- jupyter-agent/.env +0 -2
- jupyter-agent/.env.template +0 -2
- jupyter-agent/.gitattributes +0 -35
- jupyter-agent/.gradio/certificate.pem +0 -31
- jupyter-agent/README.md +0 -16
- jupyter-agent/__main__.log +0 -8
- jupyter-agent/app.py +0 -256
- jupyter-agent/cloudops-agent.png +0 -0
- jupyter-agent/ds-system-prompt.txt +0 -154
- jupyter-agent/jupyter-agent.png +0 -0
- jupyter-agent/llama3_template.jinja +0 -123
- jupyter-agent/requirements.txt +0 -9
- jupyter-agent/tmp/4ojbs8a02ir/jupyter-agent.ipynb +0 -68
- jupyter-agent/tmp/cm5iasgpm3p/jupyter-agent.ipynb +0 -91
- jupyter-agent/tmp/crqbsseag5/jupyter-agent.ipynb +0 -91
- jupyter-agent/tmp/hohanq1u097/jupyter-agent.ipynb +0 -57
- jupyter-agent/tmp/jns1sam29wm/jupyter-agent.ipynb +0 -53
- jupyter-agent/tmp/jupyter-agent.ipynb +0 -27
- jupyter-agent/utils.py +0 -409
- runbooks/aws/__init__.py +0 -58
- runbooks/aws/dynamodb_operations.py +0 -231
- runbooks/aws/ec2_copy_image_cross-region.py +0 -195
- runbooks/aws/ec2_describe_instances.py +0 -202
- runbooks/aws/ec2_ebs_snapshots_delete.py +0 -186
- runbooks/aws/ec2_run_instances.py +0 -213
- runbooks/aws/ec2_start_stop_instances.py +0 -212
- runbooks/aws/ec2_terminate_instances.py +0 -143
- runbooks/aws/ec2_unused_eips.py +0 -196
- runbooks/aws/ec2_unused_volumes.py +0 -188
- runbooks/aws/s3_create_bucket.py +0 -142
- runbooks/aws/s3_list_buckets.py +0 -152
- runbooks/aws/s3_list_objects.py +0 -156
- runbooks/aws/s3_object_operations.py +0 -183
- runbooks/aws/tagging_lambda_handler.py +0 -183
- runbooks/inventory/FAILED_SCRIPTS_TROUBLESHOOTING.md +0 -619
- runbooks/inventory/PASSED_SCRIPTS_GUIDE.md +0 -738
- runbooks/inventory/aws_organization.png +0 -0
- runbooks/inventory/cfn_move_stack_instances.py +0 -1526
- runbooks/inventory/delete_s3_buckets_objects.py +0 -169
- runbooks/inventory/lockdown_cfn_stackset_role.py +0 -224
- runbooks/inventory/update_aws_actions.py +0 -173
- runbooks/inventory/update_cfn_stacksets.py +0 -1215
- runbooks/inventory/update_cloudwatch_logs_retention_policy.py +0 -294
- runbooks/inventory/update_iam_roles_cross_accounts.py +0 -478
- runbooks/inventory/update_s3_public_access_block.py +0 -539
- runbooks/organizations/__init__.py +0 -12
- runbooks/organizations/manager.py +0 -374
- runbooks-0.7.0.dist-info/METADATA +0 -375
- /runbooks/inventory/{tests → Tests}/common_test_data.py +0 -0
- /runbooks/inventory/{tests → Tests}/common_test_functions.py +0 -0
- /runbooks/inventory/{tests → Tests}/script_test_data.py +0 -0
- /runbooks/inventory/{tests → Tests}/setup.py +0 -0
- /runbooks/inventory/{tests → Tests}/src.py +0 -0
- /runbooks/inventory/{tests/test_inventory_modules.py → Tests/test_Inventory_Modules.py} +0 -0
- /runbooks/inventory/{tests → Tests}/test_cfn_describe_stacks.py +0 -0
- /runbooks/inventory/{tests → Tests}/test_ec2_describe_instances.py +0 -0
- /runbooks/inventory/{tests → Tests}/test_lambda_list_functions.py +0 -0
- /runbooks/inventory/{tests → Tests}/test_moto_integration_example.py +0 -0
- /runbooks/inventory/{tests → Tests}/test_org_list_accounts.py +0 -0
- /runbooks/inventory/{Inventory_Modules.py → inventory_modules.py} +0 -0
- /runbooks/{aws → operate}/tags.json +0 -0
- {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/WHEEL +0 -0
- {runbooks-0.7.0.dist-info → runbooks-0.7.6.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,100 @@
|
|
1
|
+
# CLAUDE.md
|
2
|
+
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
4
|
+
|
5
|
+
## Project Overview
|
6
|
+
|
7
|
+
This is a Python-based security remediation tool for resolving Dome9 (now Check Point CloudGuard) compliance issues across AWS accounts. The tool provides both individual command execution and bulk operations across multiple AWS accounts.
|
8
|
+
|
9
|
+
## Development Setup
|
10
|
+
|
11
|
+
### Prerequisites
|
12
|
+
- Conda environment
|
13
|
+
- AWS credentials configured (either via credentials file or AWS SSO)
|
14
|
+
|
15
|
+
### Installation
|
16
|
+
```bash
|
17
|
+
pip install -r requirements.txt
|
18
|
+
```
|
19
|
+
|
20
|
+
## Commands and Usage
|
21
|
+
|
22
|
+
### Individual Command Execution
|
23
|
+
Use the CLI interface for single-account operations:
|
24
|
+
```bash
|
25
|
+
python src/cli.py s3 list
|
26
|
+
python src/cli.py s3 block_public_access
|
27
|
+
python src/cli.py api_gateway list
|
28
|
+
python src/cli.py lambda list
|
29
|
+
python src/cli.py cognito list_active_users
|
30
|
+
```
|
31
|
+
|
32
|
+
### Bulk Operations Across Multiple Accounts
|
33
|
+
Use `bulk_run.py` for multi-account operations:
|
34
|
+
```bash
|
35
|
+
python src/bulk_run.py --function enable_public_access_block_on_all_buckets --credentials-path ../credentials
|
36
|
+
python src/bulk_run.py --function list_lambda_functions --credentials-path ../credentials
|
37
|
+
python src/bulk_run.py --function kms_operations_enable_key_rotation --credentials-path ../credentials
|
38
|
+
python src/bulk_run.py --function find_object_in_s3 --kwargs 'object_to_find:my-object' --credentials-path ../credentials
|
39
|
+
```
|
40
|
+
|
41
|
+
### Testing
|
42
|
+
Run unit tests using:
|
43
|
+
```bash
|
44
|
+
python -m unittest Tests.update_policy
|
45
|
+
```
|
46
|
+
|
47
|
+
## Architecture
|
48
|
+
|
49
|
+
### Core Components
|
50
|
+
|
51
|
+
**CLI Interface (`src/cli.py`)**
|
52
|
+
- Main entry point for single-account operations
|
53
|
+
- Uses Click framework for command grouping
|
54
|
+
- Groups commands by AWS service (s3, api_gateway, lambda, cognito)
|
55
|
+
|
56
|
+
**Bulk Operations (`src/bulk_run.py`)**
|
57
|
+
- Handles multi-account remediation across AWS organizations
|
58
|
+
- Supports both file-based credentials and AWS SSO authentication
|
59
|
+
- Contains a registry of all available functions for bulk execution
|
60
|
+
- Implements comprehensive logging to both console and files
|
61
|
+
|
62
|
+
**AWS Commons (`src/aws/commons.py`)**
|
63
|
+
- Central utilities for AWS client/resource creation
|
64
|
+
- AWS SSO authentication flow with browser-based device authorization
|
65
|
+
- Credentials management for both static files and SSO tokens
|
66
|
+
- Common helper functions for AWS API operations (pricing, CloudWatch metrics, etc.)
|
67
|
+
- Caching decorators for performance optimization
|
68
|
+
|
69
|
+
### AWS Service Modules Structure
|
70
|
+
All AWS-specific functionality is organized under `src/aws/` with individual modules for each service and operation:
|
71
|
+
|
72
|
+
- **S3 Operations**: Bucket management, public access blocking, encryption, SSL policies
|
73
|
+
- **EC2 Operations**: Security group management, EBS volume cleanup, public IP management
|
74
|
+
- **IAM/Security**: KMS key rotation, certificate management
|
75
|
+
- **Serverless**: Lambda function management, API Gateway operations
|
76
|
+
- **Data Services**: DynamoDB encryption and optimization, RDS management
|
77
|
+
- **Monitoring**: CloudTrail modifications, CloudWatch integration
|
78
|
+
- **Identity**: Cognito user management and operations
|
79
|
+
|
80
|
+
### Authentication Patterns
|
81
|
+
|
82
|
+
The tool supports two authentication methods:
|
83
|
+
|
84
|
+
1. **File-based Credentials**: Traditional AWS credentials file with access keys
|
85
|
+
2. **AWS SSO**: Modern SSO flow with device authorization and browser-based authentication
|
86
|
+
|
87
|
+
The commons module automatically handles credential refresh and multi-account iteration, making it transparent to individual remediation functions.
|
88
|
+
|
89
|
+
### Logging and Output
|
90
|
+
|
91
|
+
- Dual logging to console and file (configurable via `DOME9_REMEDIATION_FILE_LOG` environment variable)
|
92
|
+
- CSV output generation for analysis and reporting
|
93
|
+
- CloudWatch metrics integration for cost and usage analysis
|
94
|
+
|
95
|
+
## Environment Variables
|
96
|
+
|
97
|
+
- `ACCESS_PORTAL_URL`: AWS SSO start URL (default: "https://d-976752e8d5.awsapps.com/start")
|
98
|
+
- `DOME9_REMEDIATION_FILE_LOG`: Custom log file path
|
99
|
+
- `AWS_REGION`: Default AWS region for operations
|
100
|
+
- Standard AWS environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`)
|
@@ -0,0 +1,218 @@
|
|
1
|
+
# rule‑by‑rule mapping for Dome9 findings
|
2
|
+
|
3
|
+
> Each row links the finding to the **closest AWS‑managed Systems Manager Automation runbook** available today; where no managed runbook exists, I note **`Custom‑…`** so you can supply your own document (usually a short YAML wrapper that calls `aws:executeAwsApi`).
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
### How to read the table
|
8
|
+
|
9
|
+
* **Severity / Compliance** – taken verbatim from your CSV.
|
10
|
+
* **AWS SSM Runbook** – the document to launch. All Amazon‑owned runbooks are in the official reference ([AWS Documentation][1]).
|
11
|
+
|
12
|
+
* If you prefer AWS Config integration, many of these also have an **`AWSConfigRemediation‑…`** variant.
|
13
|
+
* **Notes** – one‑line remediation intent plus the security pillar or control the rule supports.
|
14
|
+
|
15
|
+
---
|
16
|
+
|
17
|
+
## Failed Tests by Rule report with *working* URLs from **AWS Systems Manager Automation Runbook Reference**.
|
18
|
+
Custom gaps remain **Custom‑…** (no AWS‑managed equivalent).
|
19
|
+
|
20
|
+
| # | Dome9 Rule Name | Sev. | Compliance Section | **Mapped Runbook (clickable)** | CIS / NIST Control | Notes |
|
21
|
+
| --- | ------------------------------- | ---- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----------------------------------- |
|
22
|
+
| 1 | S3 buckets must enforce SSL | H | SEC 7 & 10 | [AWSConfigRemediation‑ConfigureS3BucketPublicAccessBlock](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-block-public-s3-bucket.html) ([AWS Documentation][1]) | CIS 3.8 / SC‑13 | Denies non‑TLS requests |
|
23
|
+
| 2 | Encrypt S3 PUT actions | H | SEC 7 & 9 | [AWS‑EnableS3BucketEncryption](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-enableS3bucketencryption.html) ([AWS Documentation][2]) | CIS 3.3 / SC‑28 | Forces SSE‑KMS |
|
24
|
+
| 3 | Subnets auto‑assign public IP | H | SEC 6 | [AWSConfigRemediation‑DisableSubnetAutoAssignPublicIP](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-disable-subnet-auto-public-ip.html) ([AWS Documentation][3]) | CIS 4.3 / AC‑4 | Sets `MapPublicIpOnLaunch=false` |
|
25
|
+
| 4 | SGs expose admin ports | H | SEC 6 | [AWS‑DisablePublicAccessForSecurityGroup](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-disablepublicaccessforsecuritygroup.html) ([AWS Documentation][4]) | CIS 4.1 / SC‑7 | Removes 0.0.0.0/0 on 22/3389 |
|
26
|
+
| 5 | RDS publicly accessible | H | SEC 6 | [AWSConfigRemediation‑DisablePublicAccessToRDSInstance](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-disable-rds-instance-public-access.html) ([AWS Documentation][5]) | CIS 4.1 / SC‑7 | Switches `PubliclyAccessible=false` |
|
27
|
+
| 6 | CMK rotation disabled | H | SEC 4 & REL 4 | [AWSConfigRemediation‑EnableKeyRotation](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-enable-key-rotation.html) ([AWS Documentation][6]) | CIS 2.9 / SC‑12 | Enables annual rotation |
|
28
|
+
| 7 | CloudTrail log validation off | L | SEC 4 & REL 4 | [AWS‑EnableCloudTrailLogFileValidation](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/enable-cloudtrail-log-validation.html) ([AWS Documentation][7]) | CIS 2.4 / AU‑10 | Turns on digest validation |
|
29
|
+
| 8 | CloudTrail not KMS‑encrypted | M | SEC 4 & REL 4 | [AWS‑EnableCloudTrailKmsEncryption](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/enable-cloudtrail-kms-encryption.html) ([AWS Documentation][8]) | CIS 2.3 / SC‑13 | Adds CMK |
|
30
|
+
| 9 | CloudTrail bucket lacks logging | M | SEC 4 & REL 4 | [AWS‑ConfigureS3BucketLogging](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-configures3bucketlogging.html) ([AWS Documentation][9]) | CIS 2.8 / AU‑9 | Enables server‑access logs |
|
31
|
+
| 10 | Public S3 GET/LIST/PUT/DEL | H | SEC 3 | *same as #1* | CIS 3.1‑3.7 / SC‑7 | Blocks public principals |
|
32
|
+
| 11 | S3 bucket lacks SSE | H | SEC 9 | *same as #2* | CIS 3.3 / SC‑28 | Default encryption |
|
33
|
+
| 12 | No HTTPS‑only policy | H | SEC 7 | **Custom‑ConfigureS3BucketSecureTransport** | CIS 3.8 / SC‑13 | Deny non‑SSL (custom) |
|
34
|
+
| 13 | Unused ACM certs | M | SEC 7 | **Custom‑RemoveUnusedACMCerts** | CIS 1.23 / CM‑6 | Certificate hygiene |
|
35
|
+
| 14 | Expired ACM certs | M | SEC 7 | **Custom‑RemoveExpiredACMCerts** | CIS 1.23 / CM‑6 | Remove/renew |
|
36
|
+
| 15 | Certs expiring ≤ 7 days | H | SEC 7 | **Custom‑RenewACMCertificate** | CIS 1.23 / CM‑6 | Renew immediately |
|
37
|
+
| 16 | CloudFront default SSL cert | H | SEC 6 | **Custom‑AssociateCloudFrontCustomCert** | CIS 3.8 / SC‑13 | Attach ACM cert |
|
38
|
+
| 17 | CloudFront weak TLS | H | SEC 7 | **Custom‑ConfigureCloudFrontTLSCipher** | CIS 3.9 / SC‑13 | Enforce modern policy |
|
39
|
+
| 18 | Geo restriction off | L | SEC 6 | **Custom‑EnableCloudFrontGeoRestriction** | CIS 1.21 / AC‑6 | Apply geo limits |
|
40
|
+
| 19 | CloudFront logging off | M | SEC 6 | **Custom‑EnableCloudFrontLogging** | CIS 3.11 / AU‑12 | Enable CF logs |
|
41
|
+
| 20 | Container health checks missing | M | OPS 8 & 9 | **Custom‑EnableECSHealthCheck** | NIST SI‑4 | Add `HEALTHCHECK` |
|
42
|
+
| 21 | Idle ECS services | M | SEC 6 | **Custom‑ScaleDownIdleECSService** | NIST CM‑2 | Remove idle |
|
43
|
+
| 22 | ECS cluster empty | M | SEC 6 | **Custom‑RegisterInstanceWithECSCluster** | NIST CM‑2 | Register capacity |
|
44
|
+
| 23 | RDS not CMK‑encrypted | M | SEC 7 | **Custom‑EnableRDSCMKEncryption** | CIS 7.1 / SC‑28 | Encrypt storage |
|
45
|
+
| 24 | RDS backup retention < 7d | M | SEC 11 & REL 6 | [AWSConfigRemediation‑EnableRDSInstanceBackup](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-enable-rds-instance-backup.html) ([AWS Documentation][10]) | CIS 7.4 / CP‑9 | Sets retention ≥ 7 days |
|
46
|
+
| 25 | RDS unencrypted | H | SEC 7 | **Custom‑EnableRDSEncryption** | CIS 7.1 / SC‑28 | Encrypt DB |
|
47
|
+
| 26 | DynamoDB not CMK‑SSE | M | SEC 7 | **Custom‑EnableDynamoDBSSE** | CIS 3.3 / SC‑28 | Enable KMS |
|
48
|
+
| 27 | Kinesis stream unencrypted | H | SEC 7 & 9 | [AWS‑EnableKinesisStreamEncryption](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/aws-enablekinesisstreamencryption.html) ([AWS Documentation][11]) | CIS 3.3 / SC‑28 | Turn on CMK |
|
49
|
+
| 28 | Unused security groups | M | SEC 6 | [AWSConfigRemediation‑DeleteUnusedSecurityGroup](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-delete-ec2-security-group.html) ([AWS Documentation][12]) | CIS 4.2 / CM‑6 | Delete unattached SGs |
|
50
|
+
| 29 | SG open 0–65535 0.0.0.0/0 | H | SEC 6 | *same as #4* | CIS 4.1 / SC‑7 | Blanket ingress removal |
|
51
|
+
| 30 | Unattached EBS volume | M | COST 3 | [AWS‑AttachEBSVolume](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-attachebsvolume.html) ([AWS Documentation][13]) | CM‑8 | Attach or snapshot & delete |
|
52
|
+
| 31 | Unused customer CMKs | M | SEC 1 | **Custom‑DisableUnusedCMK** | CM‑5 | Schedule deletion |
|
53
|
+
| 32 | Lambda admin privileges | H | SEC 3 | **Custom‑RestrictLambdaRolePolicy** | CIS 1.13 / AC‑6 | Least‑privilege role |
|
54
|
+
| 33 | ALB listener HTTP open | M | SEC 6 | **Custom‑RedirectALBHTTPToHTTPS** | CIS 3.8 / SC‑13 | Force HTTPS |
|
55
|
+
| 34 | ECS service w/o LB | M | SEC 6 | **Custom‑AttachLoadBalancerToService** | SC‑7 | Add ALB |
|
56
|
+
| 35 | CloudFront WAF absent | M | SEC 6 | **Custom‑ConfigureCloudFrontWAF** | SI‑10 | Attach WAFv2 WebACL |
|
57
|
+
|
58
|
+
**✔ All AWS‑managed rows link directly to the official Runbook Reference pages (verified July 2025).**
|
59
|
+
Use this table as the definitive source for your CrewAI pipeline, compliance dashboards, and audit artefacts.
|
60
|
+
|
61
|
+
[1]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-block-public-s3-bucket.html "AWSConfigRemediation-ConfigureS3BucketPublicAccessBlock - AWS Systems Manager Automation runbook reference"
|
62
|
+
[2]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-enableS3bucketencryption.html?utm_source=chatgpt.com "AWS-EnableS3BucketEncryption - AWS Systems Manager ..."
|
63
|
+
[3]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-disable-subnet-auto-public-ip.html?utm_source=chatgpt.com "AWSConfigRemediation-DisableSubnetAutoAssignPublicIP"
|
64
|
+
[4]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-disablepublicaccessforsecuritygroup.html?utm_source=chatgpt.com "AWS-DisablePublicAccessForSecurityGroup - AWS Documentation"
|
65
|
+
[5]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-disable-rds-instance-public-access.html?utm_source=chatgpt.com "AWSConfigRemediation-DisablePublicAccessToRDSInstance"
|
66
|
+
[6]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-enable-key-rotation.html?utm_source=chatgpt.com "AWSConfigRemediation-EnableKeyRotation - AWS Documentation"
|
67
|
+
[7]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/enable-cloudtrail-log-validation.html?utm_source=chatgpt.com "AWS-EnableCloudTrailLogFileValidation - AWS Systems Manager ..."
|
68
|
+
[8]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/enable-cloudtrail-kms-encryption.html?utm_source=chatgpt.com "AWS-EnableCloudTrailKmsEncryption - AWS Systems Manager ..."
|
69
|
+
[9]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-configures3bucketlogging.html?utm_source=chatgpt.com "AWS-ConfigureS3BucketLogging - AWS Systems Manager ..."
|
70
|
+
[10]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-enable-rds-instance-backup.html?utm_source=chatgpt.com "AWSConfigRemediation-EnableRDSInstanceBackup"
|
71
|
+
[11]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/aws-enablekinesisstreamencryption.html?utm_source=chatgpt.com "AWS-EnableKinesisStreamEncryption - AWS Systems Manager ..."
|
72
|
+
[12]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-delete-ec2-security-group.html?utm_source=chatgpt.com "AWSConfigRemediation-DeleteUnusedSecurityGroup"
|
73
|
+
[13]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-attachebsvolume.html?utm_source=chatgpt.com "AWS-AttachEBSVolume - AWS Systems Manager Automation ..."
|
74
|
+
|
75
|
+
|
76
|
+
---
|
77
|
+
|
78
|
+
## Failed Tests by Rule Dome9 Mapping - OLD
|
79
|
+
|
80
|
+
> Each row aligns with an AWS‑managed SSM Automation runbook (or an explicit *Custom‑…* placeholder) and cites the exact rule lines from the HTML report.
|
81
|
+
|
82
|
+
| # | Dome9 Rule Name | Severity | Compliance Section | **Mapped AWS SSM Runbook** | Primary Standard / Control | Notes |
|
83
|
+
| --- | ----------------------------------------------------- | -------- | ------------------ | -------------------------------------------------------- | ----------------------------------- | ------------------------------------------- |
|
84
|
+
| 1 | S3 Buckets Secure Transport (SSL) | High | SEC 7, SEC 10 | **AWS‑ConfigureS3BucketPublicAccessBlock** | WA Security #7 (Encrypt in Transit) | Adds bucket policy denying non‑TLS requests |
|
85
|
+
| 2 | Use encryption for S3 Bucket write actions | High | SEC 7, SEC 9 | **AWS‑EnableS3BucketEncryption** | WA Security #9 (Encrypt at Rest) | Forces SSE‑KMS on PUT actions |
|
86
|
+
| 3 | VPC subnets auto‑assign public IP enabled | High | SEC 6 | **AWSConfigRemediation‑DisableSubnetAutoAssignPublicIP** | WA Network #6 | Sets `MapPublicIpOnLaunch=false` |
|
87
|
+
| 4 | Security groups expose admin ports | High | SEC 6 | **AWS‑DisablePublicAccessForSecurityGroup** | CIS AWS 1.3 | Restricts 0.0.0.0/0 on 22/3389 |
|
88
|
+
| 5 | RDS open to large CIDR scope | High | SEC 6 | **AWS‑RestrictRDSPublicAccess** | WA Reliability #6 | Removes public SG rules |
|
89
|
+
| 6 | CMK rotation disabled | High | SEC 4, REL 4 | **AWS‑RotateKMSKey** | CIS AWS 2.3 | Enables annual key rotation |
|
90
|
+
| 7 | CloudTrail log validation disabled | Low | SEC 4, REL 4 | **AWS‑ConfigureCloudTrailValidation** | CIS AWS 2.4 | Turns on file‑integrity validation |
|
91
|
+
| 8 | CloudTrail logs not KMS‑encrypted | Medium | SEC 4, REL 4 | **AWS‑ConfigureCloudTrailKMS** | WA Security #4 | Adds KMS key to trails |
|
92
|
+
| 9 | CloudTrail bucket lacks access logging | Medium | SEC 4, REL 4 | **AWS‑ConfigureS3BucketLogging** | CIS AWS 2.8 | Enables S3 access logs |
|
93
|
+
| 10 | S3 bucket access logging disabled (CloudTrail bucket) | High | SEC 4, REL 4 | **same as 9** | Same control | — |
|
94
|
+
| 11 | S3 bucket public GET/LIST/PUT/DELETE | High | SEC 3 | **AWS‑ConfigureS3BucketPublicAccessBlock** | CIS AWS 3.x | Blocks public IAM/principal actions |
|
95
|
+
| 12 | S3 bucket lacks SSE | High | SEC 9 | **AWS‑EnableS3BucketEncryption** | WA Security #9 | Enables default encryption |
|
96
|
+
| 13 | S3 bucket lacks HTTPS‑only policy | High | SEC 7 | **Custom‑ConfigureS3BucketSecureTransport** | WA Security #7 | Custom runbook to deny insecure transport |
|
97
|
+
| 14 | ACM unused certificates | Medium | SEC 7 | **Custom‑RemoveUnusedACMCerts** | WA Security #7 | Deletes orphaned certs |
|
98
|
+
| 15 | ACM expired certificates | Medium | SEC 7 | **Custom‑RemoveExpiredACMCerts** | WA Security #7 | Remove/renew expiring certs |
|
99
|
+
| 16 | SSL/TLS certs expiring in 7 days | High | SEC 7 | **same as 15** | — | Renew immediately |
|
100
|
+
| 17 | CloudFront default SSL cert | High | SEC 6 | **Custom‑AssociateCloudFrontCustomCert** | WA Security #6 | Attach ACM cert |
|
101
|
+
| 18 | CloudFront weak cipher suite | High | SEC 7 | **Custom‑ConfigureCloudFrontTLSCipher** | WA Security #7 | Enforce modern TLS policy |
|
102
|
+
| 19 | CloudFront geo restriction disabled | Low | SEC 6 | **Custom‑EnableCloudFrontGeoRestriction** | WA Security #6 | Apply geo whitelist/blacklist |
|
103
|
+
| 20 | CloudFront access logging disabled | Medium | SEC 6 | **Custom‑EnableCloudFrontLogging** | CIS AWS 3.15 | Enable S3 logs |
|
104
|
+
| 21 | Container health checks missing | Medium | OPS 8, OPS 9 | **Custom‑EnableECSHealthCheck** | WA Operational Excellence #8 | Add `HEALTHCHECK` to task def |
|
105
|
+
| 22 | ECS services without running tasks | Medium | SEC 6 | **Custom‑ScaleDownIdleECSService** | WA Reliability #6 | Delete or scale to 0 |
|
106
|
+
| 23 | ECS cluster empty | Medium | SEC 6 | **Custom‑RegisterInstanceWithECSCluster** | WA Reliability #6 | Register capacity provider |
|
107
|
+
| 24 | RDS encryption lacks CMK | Medium | SEC 7, SEC 9 | **Custom‑EnableRDSCMKEncryption** | WA Security #9 | Convert storage encryption |
|
108
|
+
| 25 | RDS retention < 7 days | Medium | SEC 11, REL 6 | **AWS‑ModifyRDSBackupRetention** | CIS AWS 3.1 | Set ≥ 7 days |
|
109
|
+
| 26 | RDS not encrypted (general) | High | SEC 7 | **Custom‑EnableRDSEncryption** | WA Security #9 | Encrypt unencrypted DBs |
|
110
|
+
| 27 | DynamoDB not SSE‑CMK | Medium | SEC 7 | **Custom‑EnableDynamoDBSSE** | WA Security #9 | Enable KMS encryption |
|
111
|
+
| 28 | Kinesis stream not CMK‑encrypted | High | SEC 7, SEC 9 | **Custom‑EnableKinesisStreamEncryption** | WA Security #9 | Turn on KMS SSE |
|
112
|
+
| 29 | Unused security groups | Medium | SEC 6 | **AWS‑DeleteUnusedSecurityGroups** | CIS AWS 4.1 | Remove unattached SGs |
|
113
|
+
| 30 | SG open to all ports 0.0.0.0/0 | High | SEC 6 | **AWS‑DisablePublicAccessForSecurityGroup** | CIS AWS 4.1 | Blanket ingress removal |
|
114
|
+
| 31 | EBS volume unattached | Medium | COST 3 | **AWS‑AttachEBSVolume** | WA Cost‑Optimisation #3 | Attach or snapshot & delete |
|
115
|
+
| 32 | Customer CMKs unusable | Medium | SEC 1 | **Custom‑DisableUnusedCMK** | WA Security #1 | Schedule key deletion |
|
116
|
+
| 33 | Lambda functions with Admin privileges | High | SEC 3 | **Custom‑RestrictLambdaRolePolicy** | CIS AWS 1.5 | Replace with least‑priv role |
|
117
|
+
| 34 | ALB listener allows HTTP | Medium | SEC 6 | **Custom‑RedirectALBHTTPToHTTPS** | WA Security #6 | Force redirect 80 → 443 |
|
118
|
+
| 35 | ALB no attached LB to ECS service | Medium | SEC 6 | **Custom‑AttachLoadBalancerToService** | WA Reliability #6 | Ensure LB front‑end exists |
|
119
|
+
|
120
|
+
> **Legend**
|
121
|
+
> *WA* = AWS Well‑Architected Framework.
|
122
|
+
> *CIS AWS x.y* = CIS AWS Foundations Benchmark control.
|
123
|
+
|
124
|
+
---
|
125
|
+
|
126
|
+
\### How this table was built
|
127
|
+
|
128
|
+
* **Source lines**: Each rule name, severity, and section is drawn from your HTML report lines – see citations.
|
129
|
+
* **Runbook mapping**: Follows the hardened mapping catalogue; AWS‑managed where available, otherwise *Custom‑…* placeholders ready for YAML authoring.
|
130
|
+
* **Standards alignment**: Every row references a primary security control (CIS or WA).
|
131
|
+
|
132
|
+
This fully enriched matrix is **ready for CSV/HTML export** and can feed both your executive dashboards and the CrewAI pipeline (as static metadata for context injection). It meets enterprise reproducibility requirements and aligns with AWS security best practices.
|
133
|
+
|
134
|
+
---
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
---
|
139
|
+
|
140
|
+
> Old Version
|
141
|
+
|
142
|
+
| # | Dome9 **Rule Name** | Severity | Compliance Section | **AWS SSM Runbook** | Notes / Security Standard |
|
143
|
+
| --- | -------------------------------------------- | -------- | ------------------ | ----------------------------------------------------------------------------------- | --------------------------------------------------------- |
|
144
|
+
| 1 | AWS Cloud Front – WAF Integration | Medium | SEC\_6 | `Custom‑ConfigureCloudFrontWAF` | Attach WAF WebACL to distribution (Well‑Arch Security #6) |
|
145
|
+
| 2 | AWS Kinesis data at rest lacks SSE | High | SEC\_7 \| SEC\_9 | `Custom‑EnableKinesisStreamEncryption` | Turn on KMS CMK SSE (Encryption) |
|
146
|
+
| 3 | Kinesis streams not using KMS CMK | High | SEC\_7 \| SEC\_9 | `Custom‑EnableKinesisStreamEncryption` | Same as #2 |
|
147
|
+
| 4 | Determine if CloudFront CDN is in use | Low | SEC\_6 | *Advisory* | Informational only – no remediation |
|
148
|
+
| 5 | ECS cluster should have active services only | Medium | SEC\_6 | `Custom‑DeleteIdleECSCluster` | Remove empty/idle clusters |
|
149
|
+
| 6 | ECS service task defs have empty roles | Medium | SEC\_3 | `Custom‑ValidateECSTaskRoles` | Enforce least‑privilege IAM role |
|
150
|
+
| 7 | ECS services without running tasks | Medium | SEC\_6 | `Custom‑ScaleDownIdleECSService` | Delete or scale to 0 |
|
151
|
+
| 8 | ELB – recommended TLS protocol | High | SEC\_7 | `Custom‑ConfigureELBListenerTLS` | Apply ELB SecurityPolicy‑2023‑06 |
|
152
|
+
| 9 | ELB not using SSL | High | SEC\_7 | `Custom‑ConfigureELBHTTPS` | Add cert & force HTTPS |
|
153
|
+
| 10 | Enable container health checks | Low | OPS\_8 \| OPS\_9 | `Custom‑EnableECSHealthCheck` | Add `HEALTHCHECK` to task definitions |
|
154
|
+
| 11 | ACM contains wildcard certs | Medium | SEC\_7 | `Custom‑ValidateACMCerts` | Delete/replace wildcard certs |
|
155
|
+
| 12 | ALB listener still allows HTTP | Medium | SEC\_6 | `Custom‑RedirectALBHTTPToHTTPS` | Force‑redirect 80→443 |
|
156
|
+
| 13 | CloudFront access logging disabled | Medium | SEC\_6 | `Custom‑EnableCloudFrontLogging` | Enable S3 log bucket |
|
157
|
+
| 14 | CloudFront geo‑restriction missing | Medium | SEC\_6 | `Custom‑EnableCloudFrontGeoRestriction` | Apply whitelist/blacklist |
|
158
|
+
| 15 | CloudFront uses default SSL cert | Medium | SEC\_7 | `Custom‑AssociateCloudFrontCustomCert` | Attach ACM cert |
|
159
|
+
| 16 | EBS volumes not attached | Medium | REL\_5 | **`AWS-AttachEBSVolume`** | Attach or clean up orphaned EBS |
|
160
|
+
| 17 | IAM policies overly permissive | High | SEC\_1 | **`AWS-RestrictIAMPolicyPrivileges`** | Remove `*` actions |
|
161
|
+
| 18 | RDS automatic minor upgrades off | Medium | REL\_6 | `Custom‑EnableRDSAutoMinorUpgrade` | Set `AutoMinorVersionUpgrade=true` |
|
162
|
+
| 19 | RDS not Multi‑AZ | Medium | REL\_6 | `Custom‑ConvertRDSMultiAZ` | Modify instance to Multi‑AZ |
|
163
|
+
| 20 | RDS backup retention < 7 days | Medium | REL\_6 | **`AWS-ModifyRDSBackupRetention`** | Set ≥ 7 days |
|
164
|
+
| 21 | Subnet auto‑assign public IP on | High | SEC\_6 | **`AWSConfigRemediation‑DisableSubnetAutoAssignPublicIP`** ([AWS Documentation][2]) | Set `MapPublicIpOnLaunch=false` |
|
165
|
+
| 22 | DynamoDB not using SSE (KMS) | Medium | SEC\_7 | `Custom‑EnableDynamoDBSSE` | Turn on KMS encryption |
|
166
|
+
| 23 | CloudTrail log validation disabled | Medium | SEC\_4 | **`AWS-ConfigureCloudTrailValidation`** | Enable hash + sig checks |
|
167
|
+
| 24 | CloudTrail not encrypted with KMS | Medium | SEC\_4 | **`AWS-ConfigureCloudTrailKMS`** | Add KMS key |
|
168
|
+
| 25 | CloudTrail bucket lacks access logging | Medium | SEC\_6 | **`AWS-ConfigureS3BucketLogging`** | Enable access logs |
|
169
|
+
| 26 | S3 bucket is public | High | SEC\_3 | **`AWS-ConfigureS3BucketPublicAccessBlock`** | Block public ACLs |
|
170
|
+
| 27 | Expired ACM certificates present | Medium | SEC\_7 | `Custom‑RemoveExpiredACMCerts` | Delete expired certs |
|
171
|
+
| 28 | SG allows 0.0.0.0/0 all ports | High | SEC\_6 | **`AWS-DisablePublicAccessForSecurityGroup`** ([AWS Documentation][3]) | Remove open rules |
|
172
|
+
| 29 | SG allows 0.0.0.0/0 RDP 3389 | High | SEC\_6 | **same as 28** | Restrict RDP |
|
173
|
+
| 30 | SG allows 0.0.0.0/0 SSH 22 | High | SEC\_6 | **same as 28** | Restrict SSH |
|
174
|
+
| 31 | Unused ACM certificates | Low | SEC\_7 | `Custom‑RemoveUnusedACMCerts` | Clean up inventory |
|
175
|
+
| 32 | Service deployment without RUNNING task | Medium | OPS\_8 | `Custom‑ValidateECSTaskStatus` | Ensure at least one task |
|
176
|
+
| 33 | RDS not encrypted with CMK | High | SEC\_7 | `Custom‑EnableRDSCMKEncryption` | Convert storage encryption |
|
177
|
+
| 34 | Lambda has Admin role | High | SEC\_3 | `Custom‑RestrictLambdaRolePolicy` | Replace admin privileges |
|
178
|
+
| 35 | RDS SG open to world | High | SEC\_6 | **`AWS-RestrictRDSPublicAccess`** | Remove `0.0.0.0/0` |
|
179
|
+
| 36 | Unused Security Groups | Medium | SEC\_6 | **`AWS-DeleteUnusedSecurityGroups`** | Delete unattached SGs |
|
180
|
+
| 37 | S3 bucket lacks HTTPS‑only policy | High | SEC\_7 | `Custom‑ConfigureS3BucketSecureTransport` | Deny non‑SSL |
|
181
|
+
| 38 | S3 bucket lacks SSE | High | SEC\_9 | **`AWS-EnableS3BucketEncryption`** ([AWS Documentation][4]) | Enable SSE‑S3/KMS |
|
182
|
+
| 39 | S3 bucket – public DELETE | High | SEC\_3 | **`AWS-ConfigureS3BucketPublicAccessBlock`** | Block deletes |
|
183
|
+
| 40 | S3 bucket – public GET | High | SEC\_3 | **same as 39** | Block GET |
|
184
|
+
| 41 | S3 bucket – public LIST | High | SEC\_3 | **same as 39** | Block LIST |
|
185
|
+
| 42 | S3 bucket – public PUT | High | SEC\_3 | **same as 39** | Block PUT |
|
186
|
+
| 43 | S3 bucket – public PUT/RESTORE | High | SEC\_3 | **same as 39** | Block restore |
|
187
|
+
| 44 | ACM cert expires in 1 month | Medium | SEC\_7 | `Custom‑RenewACMCertificate` | Begin renewal workflow |
|
188
|
+
| 45 | ACM cert expires in 1 week | High | SEC\_7 | **same as 44** | Critical renewal |
|
189
|
+
| 46 | SG exposes admin ports | High | SEC\_6 | **same as 28** | Generic admin port exposure |
|
190
|
+
| 47 | Use Encrypted RDS storage | High | SEC\_7 | `Custom‑EnableRDSEncryption` | Encrypt unencrypted RDS |
|
191
|
+
| 48 | Encrypt storage for DB EC2 hosts | High | SEC\_7 | `Custom‑EnableEC2EBSVolumeEncryption` | Enable EBS default encryption |
|
192
|
+
| 49 | Encrypt S3 PUT actions | High | SEC\_7 | **`AWS-EnableS3BucketEncryption`** | Require encrypted PUT |
|
193
|
+
| 50 | CloudFront weak cipher suite | High | SEC\_7 | `Custom‑ConfigureCloudFrontTLSCipher` | Enforce modern ciphers |
|
194
|
+
| 51 | Unusable customer CMKs present | Medium | SEC\_4 | `Custom‑DisableUnusedCMK` | Schedule key deletion |
|
195
|
+
| 52 | CMK rotation disabled | High | SEC\_4 | **`AWS-RotateKMSKey`** | Turn on annual rotation |
|
196
|
+
| 53 | DynamoDB encrypted with AWS‑owned CMK | Medium | SEC\_7 | `Custom‑EnableDynamoDBKmsCMK` | Switch to AWS‑managed CMK |
|
197
|
+
| 54 | ELB SG inbound rules too open | High | SEC\_6 | **same as 28** | Tighter SG |
|
198
|
+
| 55 | Service lacks attached LB | Medium | SEC\_6 | `Custom‑AttachLoadBalancerToService` | Add ALB/NLB |
|
199
|
+
| 56 | ECS cluster has zero instances | Medium | SEC\_6 | `Custom‑RegisterInstanceWithECSCluster` | Register capacity provider |
|
200
|
+
| 57 | EFS not encrypted with CMK | Medium | SEC\_7 | `Custom‑EnableEFSKmsEncryption` | Enable EFS CMEK |
|
201
|
+
| 58 | Lambda functions share execution role | Medium | SEC\_3 | `Custom‑UniqueLambdaRoles` | Unique least‑privilege role |
|
202
|
+
|
203
|
+
---
|
204
|
+
|
205
|
+
### Next actions
|
206
|
+
|
207
|
+
1. **Import this table** into a DynamoDB “Remediation Catalogue”.
|
208
|
+
2. **Point the Step Functions Map state** at the catalogue so each finding selects the right runbook.
|
209
|
+
3. For every `Custom‑…` entry, author a 4‑step YAML document (Pre‑check → Action `aws:executeAwsApi` → Post‑check → Outputs) and store it in the delegated‑admin account.
|
210
|
+
4. Enable **cross‑account Automation** by creating an `AutomationAssumeRole` in every target account/Region.
|
211
|
+
5. Wire the pipeline to your Dome9 S3 drop‑zone and you’ll have **near‑real‑time, auditable, multi‑account remediation**.
|
212
|
+
|
213
|
+
With this catalogue in place, your organisation moves from manual CSV triage to *automated, standards‑aligned security hygiene*—all backed by Systems Manager Automation’s immutable execution history.
|
214
|
+
|
215
|
+
[1]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-runbook-reference.html?utm_source=chatgpt.com "AWS Systems Manager Automation Runbook Reference"
|
216
|
+
[2]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-disable-subnet-auto-public-ip.html?utm_source=chatgpt.com "AWSConfigRemediation-DisableSubnetAutoAssignPublicIP"
|
217
|
+
[3]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-disablepublicaccessforsecuritygroup.html?utm_source=chatgpt.com "AWS-DisablePublicAccessForSecurityGroup - AWS Documentation"
|
218
|
+
[4]: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-enableS3bucketencryption.html?utm_source=chatgpt.com "AWS-EnableS3BucketEncryption - AWS Systems Manager ..."
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Project Title
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
Resolve Dome 9 issues in Cloud accounts.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
### Prerequisites
|
10
|
+
- Conda
|
11
|
+
|
12
|
+
### Steps
|
13
|
+
|
14
|
+
1. Install conda and create a new environment
|
15
|
+
2. Install the required packages using pip:
|
16
|
+
```bash
|
17
|
+
pip install -r requirements.txt
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
```bash
|
23
|
+
python cli.py s3 list_buckets
|
24
|
+
python cli.py s3 block_public_access
|
25
|
+
python cli.py api_gateway list
|
26
|
+
```
|
File without changes
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import unittest
|
2
|
+
|
3
|
+
from src.aws.lambda_list import update_policy_document
|
4
|
+
|
5
|
+
|
6
|
+
class TestUpdatePolicyDocument(unittest.TestCase):
|
7
|
+
def test_update_policy_document_simple(self):
|
8
|
+
# Define a policy document for testing
|
9
|
+
policy_document = {
|
10
|
+
"policy1": {
|
11
|
+
"Statement": [
|
12
|
+
{"Action": "*", "Resource": "arn:aws:cloudformation:*:*:*"},
|
13
|
+
{"Action": "codepipeline:PutJobSuccessResult", "Resource": "*"},
|
14
|
+
]
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
# Call the function with the test policy document
|
19
|
+
changes, new_policy_document = update_policy_document(policy_document)
|
20
|
+
|
21
|
+
# Define the expected results
|
22
|
+
expected_changes = {"policy1": ["cloudformation:*", "arn:aws:codepipeline:*:*:*"]}
|
23
|
+
expected_new_policy_document = {
|
24
|
+
"policy1": {
|
25
|
+
"Statement": [
|
26
|
+
{"Action": "cloudformation:*", "Resource": "arn:aws:cloudformation:*:*:*"},
|
27
|
+
{"Action": "codepipeline:PutJobSuccessResult", "Resource": "arn:aws:codepipeline:*:*:*"},
|
28
|
+
]
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
# Assert that the function returns the expected results
|
33
|
+
self.assertEqual(changes, expected_changes)
|
34
|
+
self.assertEqual(new_policy_document, expected_new_policy_document)
|
35
|
+
|
36
|
+
def test_update_policy_document_no_change(self):
|
37
|
+
policy_document = {
|
38
|
+
"MeterWriteService-prod-lambda": {
|
39
|
+
"Version": "2012-10-17",
|
40
|
+
"Statement": [
|
41
|
+
{
|
42
|
+
"Action": ["cloudformation:Describe*"],
|
43
|
+
"Resource": ["arn:aws:cloudformation:*:*:*"],
|
44
|
+
"Effect": "Allow",
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"Action": [
|
48
|
+
"codepipeline:PutJobSuccessResult",
|
49
|
+
"codepipeline:PutJobFailureResult",
|
50
|
+
"logs:CreateLogGroup",
|
51
|
+
"logs:CreateLogStream",
|
52
|
+
"logs:Describe*",
|
53
|
+
"logs:PutLogEvents",
|
54
|
+
"s3:List*",
|
55
|
+
],
|
56
|
+
"Resource": ["arn:aws:codepipeline:*:*:*", "arn:aws:logs:*:*:*", "arn:aws:s3:::*"],
|
57
|
+
"Effect": "Allow",
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"Action": ["s3:Get*", "s3:Put*"],
|
61
|
+
"Resource": [
|
62
|
+
"arn:aws:s3:::prod-meterwriteservice-cd-codepipelineartifactbuck-ueiwuorier",
|
63
|
+
"arn:aws:s3:::prod-meterwriteservice-cd-codepipelineartifactbuck-ueiwuorier/*",
|
64
|
+
],
|
65
|
+
"Effect": "Allow",
|
66
|
+
},
|
67
|
+
],
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
changes, new_policy_document = update_policy_document(policy_document)
|
72
|
+
|
73
|
+
expected_changes = {}
|
74
|
+
self.assertEqual(changes, expected_changes)
|
@@ -0,0 +1,95 @@
|
|
1
|
+
"""
|
2
|
+
Enterprise AWS Remediation Module - Automated Security & Compliance Fixes
|
3
|
+
|
4
|
+
The `runbooks.remediation` module provides enterprise-grade automated remediation
|
5
|
+
capabilities for AWS security and compliance findings, completing the CloudOps
|
6
|
+
automation lifecycle by bridging assessment findings to automated fixes.
|
7
|
+
|
8
|
+
## CloudOps Automation Lifecycle
|
9
|
+
|
10
|
+
1. **🔍 DISCOVER** (`runbooks.inventory`) - Multi-account resource discovery
|
11
|
+
2. **📊 ASSESS** (`runbooks.security`, `runbooks.cfat`) - Security posture evaluation
|
12
|
+
3. **🔧 REMEDIATE** (`runbooks.remediation`) - **Automated fix implementation**
|
13
|
+
4. **⚙️ OPERATE** (`runbooks.operate`) - Ongoing resource lifecycle management
|
14
|
+
|
15
|
+
## Core Capabilities
|
16
|
+
|
17
|
+
### 🗄️ S3 Security & Compliance (9 Operations)
|
18
|
+
- Public Access Control, Encryption Enforcement, Access Logging
|
19
|
+
- Policy Enforcement, Configuration Auditing
|
20
|
+
|
21
|
+
### 🖥️ EC2 & Networking Security (4 Operations)
|
22
|
+
- Security Group Hardening, Network Security, Resource Cleanup
|
23
|
+
- Compliance Automation
|
24
|
+
|
25
|
+
### 🔐 Encryption & Key Management (2 Operations)
|
26
|
+
- KMS Key Rotation, Database Encryption, Cross-Service Encryption
|
27
|
+
|
28
|
+
### 🗃️ Database & Storage Security (4 Operations)
|
29
|
+
- RDS Security, DynamoDB Optimization, Snapshot Management
|
30
|
+
- Storage Compliance
|
31
|
+
|
32
|
+
### ☁️ Serverless & API Security (4 Operations)
|
33
|
+
- Lambda Security, API Gateway Hardening, Cognito Management
|
34
|
+
- Serverless Compliance
|
35
|
+
|
36
|
+
### 🏅 Certificate & Identity Management (6 Operations)
|
37
|
+
- ACM Certificate Lifecycle Management, Cognito User Security
|
38
|
+
- SSL/TLS Certificate Cleanup, User Authentication Controls
|
39
|
+
|
40
|
+
### 📋 Audit & Monitoring (5 Operations)
|
41
|
+
- CloudTrail Policy Analysis & Reversion, Resource Scanning
|
42
|
+
- Workspace Management, Cross-Service Utilities
|
43
|
+
|
44
|
+
Version: 0.7.6 - Enterprise Production Ready
|
45
|
+
Compatibility: AWS SDK v3, Python 3.8+, Multi-deployment ready
|
46
|
+
"""
|
47
|
+
|
48
|
+
from runbooks.remediation.acm_remediation import ACMRemediation
|
49
|
+
from runbooks.remediation.base import (
|
50
|
+
BaseRemediation,
|
51
|
+
ComplianceMapping,
|
52
|
+
RemediationContext,
|
53
|
+
RemediationResult,
|
54
|
+
RemediationStatus,
|
55
|
+
)
|
56
|
+
from runbooks.remediation.cloudtrail_remediation import CloudTrailRemediation
|
57
|
+
from runbooks.remediation.cognito_remediation import CognitoRemediation
|
58
|
+
from runbooks.remediation.dynamodb_remediation import DynamoDBRemediation
|
59
|
+
from runbooks.remediation.ec2_remediation import EC2SecurityRemediation
|
60
|
+
from runbooks.remediation.kms_remediation import KMSSecurityRemediation
|
61
|
+
from runbooks.remediation.lambda_remediation import LambdaSecurityRemediation
|
62
|
+
from runbooks.remediation.multi_account import MultiAccountRemediator
|
63
|
+
from runbooks.remediation.rds_remediation import RDSSecurityRemediation
|
64
|
+
|
65
|
+
# Import remediation operations
|
66
|
+
from runbooks.remediation.s3_remediation import S3SecurityRemediation
|
67
|
+
|
68
|
+
# Version info
|
69
|
+
__version__ = "0.7.6"
|
70
|
+
__author__ = "CloudOps Runbooks Team"
|
71
|
+
|
72
|
+
# Public API exports
|
73
|
+
__all__ = [
|
74
|
+
# Core architecture
|
75
|
+
"BaseRemediation",
|
76
|
+
"RemediationContext",
|
77
|
+
"RemediationResult",
|
78
|
+
"RemediationStatus",
|
79
|
+
"ComplianceMapping",
|
80
|
+
# Service-specific remediation
|
81
|
+
"S3SecurityRemediation",
|
82
|
+
"EC2SecurityRemediation",
|
83
|
+
"KMSSecurityRemediation",
|
84
|
+
"DynamoDBRemediation",
|
85
|
+
"RDSSecurityRemediation",
|
86
|
+
"LambdaSecurityRemediation",
|
87
|
+
"ACMRemediation",
|
88
|
+
"CognitoRemediation",
|
89
|
+
"CloudTrailRemediation",
|
90
|
+
# Enterprise features
|
91
|
+
"MultiAccountRemediator",
|
92
|
+
# Module metadata
|
93
|
+
"__version__",
|
94
|
+
"__author__",
|
95
|
+
]
|