cloudg 0.3.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.
- cloudg/__init__.py +21 -0
- cloudg/api.py +613 -0
- cloudg/cli.py +934 -0
- cloudg/collectors/__init__.py +5 -0
- cloudg/collectors/aws.py +830 -0
- cloudg/collectors/azure.py +362 -0
- cloudg/collectors/base.py +44 -0
- cloudg/collectors/gcp.py +170 -0
- cloudg/collectors/multi.py +329 -0
- cloudg/config.py +261 -0
- cloudg/coverage.py +93 -0
- cloudg/credentials.py +451 -0
- cloudg/graph/__init__.py +6 -0
- cloudg/graph/builder.py +336 -0
- cloudg/graph/ontology.py +914 -0
- cloudg/graph/rag_export.py +533 -0
- cloudg/graph/reachability.py +237 -0
- cloudg/normaliser.py +390 -0
- cloudg/policies/custodian-aws-security.yml +139 -0
- cloudg/policies/custodian-azure.yml +95 -0
- cloudg/policies/custodian-gcp.yml +87 -0
- cloudg/policies/custodian.yml +131 -0
- cloudg/region_discovery.py +330 -0
- cloudg/registry.py +142 -0
- cloudg/renderers/__init__.py +1 -0
- cloudg/renderers/html_report.py +430 -0
- cloudg/renderers/json_export.py +65 -0
- cloudg/renderers/svg.py +689 -0
- cloudg/renderers/terraform_export.py +666 -0
- cloudg/retry.py +103 -0
- cloudg/rules/cis_aws_v3.yaml +148 -0
- cloudg/rules/cis_azure_v2.yaml +142 -0
- cloudg/rules/cis_gcp_v3.yaml +133 -0
- cloudg/rules/frameworks/aws_foundational_security_best_practices_aws.yaml +1286 -0
- cloudg/rules/frameworks/cis_5.0_aws.yaml +280 -0
- cloudg/rules/frameworks/cis_5.0_azure.yaml +475 -0
- cloudg/rules/frameworks/cis_5.0_gcp.yaml +327 -0
- cloudg/rules/frameworks/gdpr_aws.yaml +95 -0
- cloudg/rules/frameworks/hipaa_aws.yaml +461 -0
- cloudg/rules/frameworks/hipaa_azure.yaml +504 -0
- cloudg/rules/frameworks/hipaa_gcp.yaml +211 -0
- cloudg/rules/frameworks/iso27001_2022_aws.yaml +789 -0
- cloudg/rules/frameworks/iso27001_2022_azure.yaml +477 -0
- cloudg/rules/frameworks/iso27001_2022_gcp.yaml +240 -0
- cloudg/rules/frameworks/mitre_attack_aws.yaml +596 -0
- cloudg/rules/frameworks/mitre_attack_azure.yaml +418 -0
- cloudg/rules/frameworks/mitre_attack_gcp.yaml +300 -0
- cloudg/rules/frameworks/nist_800_53_revision_5_aws.yaml +3234 -0
- cloudg/rules/frameworks/nist_csf_2.0_aws.yaml +828 -0
- cloudg/rules/frameworks/pci_4.0_aws.yaml +7108 -0
- cloudg/rules/frameworks/pci_4.0_azure.yaml +4696 -0
- cloudg/rules/frameworks/pci_4.0_gcp.yaml +5405 -0
- cloudg/rules/frameworks/soc2_aws.yaml +421 -0
- cloudg/rules/frameworks/soc2_azure.yaml +477 -0
- cloudg/rules/frameworks/soc2_gcp.yaml +342 -0
- cloudg/rules/gdpr.yaml +56 -0
- cloudg/rules/hipaa_security_rule.yaml +83 -0
- cloudg/rules/iso_27001_2022.yaml +88 -0
- cloudg/rules/nist_800_53.yaml +134 -0
- cloudg/rules/pci_dss_v4.yaml +108 -0
- cloudg/rules/soc2_tsc.yaml +93 -0
- cloudg/scanners/__init__.py +1 -0
- cloudg/scanners/checkov.py +174 -0
- cloudg/scanners/iam_linter.py +200 -0
- cloudg/scanners/prowler.py +237 -0
- cloudg/scanners/scoutsuite.py +163 -0
- cloudg/scanners/trivy.py +339 -0
- cloudg/schema/__init__.py +25 -0
- cloudg/schema/models.py +260 -0
- cloudg/templates/report.html.j2 +828 -0
- cloudg-0.3.0.dist-info/METADATA +330 -0
- cloudg-0.3.0.dist-info/RECORD +75 -0
- cloudg-0.3.0.dist-info/WHEEL +4 -0
- cloudg-0.3.0.dist-info/entry_points.txt +14 -0
- cloudg-0.3.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# ─────────────────────────────────────────────────────────────────
|
|
2
|
+
# Cloud Custodian — AWS Security Policies
|
|
3
|
+
# ─────────────────────────────────────────────────────────────────
|
|
4
|
+
# Detection-only policies (notify, never remediate) covering the most
|
|
5
|
+
# common AWS misconfigurations. Aligned with CIS AWS Foundations
|
|
6
|
+
# Benchmark v3.0 controls where noted.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# uv pip install c7n
|
|
10
|
+
# custodian run --output-dir ./custodian-output cloudg/policies/custodian-aws-security.yml
|
|
11
|
+
|
|
12
|
+
policies:
|
|
13
|
+
|
|
14
|
+
# ── S3 buckets with public ACL grants (CIS 2.1.2) ──
|
|
15
|
+
- name: s3-public-global-grants
|
|
16
|
+
resource: s3
|
|
17
|
+
description: "S3 buckets that grant access to AllUsers or AuthenticatedUsers"
|
|
18
|
+
filters:
|
|
19
|
+
- type: global-grants
|
|
20
|
+
actions:
|
|
21
|
+
- type: notify
|
|
22
|
+
subject: "Public S3 bucket detected"
|
|
23
|
+
violation_desc: "Bucket ACL grants access to everyone or any AWS authenticated user."
|
|
24
|
+
action_desc: "Remove the public grant and enable S3 Block Public Access."
|
|
25
|
+
|
|
26
|
+
# ── Security groups open to the world on SSH (CIS 5.2) ──
|
|
27
|
+
- name: sg-open-ssh
|
|
28
|
+
resource: security-group
|
|
29
|
+
description: "Security groups allowing SSH (22) from 0.0.0.0/0"
|
|
30
|
+
filters:
|
|
31
|
+
- type: ingress
|
|
32
|
+
Ports: [22]
|
|
33
|
+
Cidr:
|
|
34
|
+
value: "0.0.0.0/0"
|
|
35
|
+
actions:
|
|
36
|
+
- type: notify
|
|
37
|
+
subject: "Security group allows SSH from the Internet"
|
|
38
|
+
violation_desc: "Port 22 is reachable from 0.0.0.0/0."
|
|
39
|
+
action_desc: "Restrict the source to a bastion, VPN range, or use SSM Session Manager."
|
|
40
|
+
|
|
41
|
+
# ── Security groups open to the world on RDP (CIS 5.3) ──
|
|
42
|
+
- name: sg-open-rdp
|
|
43
|
+
resource: security-group
|
|
44
|
+
description: "Security groups allowing RDP (3389) from 0.0.0.0/0"
|
|
45
|
+
filters:
|
|
46
|
+
- type: ingress
|
|
47
|
+
Ports: [3389]
|
|
48
|
+
Cidr:
|
|
49
|
+
value: "0.0.0.0/0"
|
|
50
|
+
actions:
|
|
51
|
+
- type: notify
|
|
52
|
+
subject: "Security group allows RDP from the Internet"
|
|
53
|
+
violation_desc: "Port 3389 is reachable from 0.0.0.0/0."
|
|
54
|
+
action_desc: "Restrict the source range or use a bastion host."
|
|
55
|
+
|
|
56
|
+
# ── Unencrypted EBS volumes (CIS 2.2.1) ──
|
|
57
|
+
- name: ebs-unencrypted
|
|
58
|
+
resource: ebs
|
|
59
|
+
description: "EBS volumes without encryption at rest"
|
|
60
|
+
filters:
|
|
61
|
+
- Encrypted: false
|
|
62
|
+
actions:
|
|
63
|
+
- type: notify
|
|
64
|
+
subject: "Unencrypted EBS volume"
|
|
65
|
+
violation_desc: "Volume is not encrypted at rest."
|
|
66
|
+
action_desc: "Snapshot, copy with encryption enabled, and swap the volume."
|
|
67
|
+
|
|
68
|
+
# ── Unencrypted RDS instances (CIS 2.3.1) ──
|
|
69
|
+
- name: rds-unencrypted
|
|
70
|
+
resource: rds
|
|
71
|
+
description: "RDS instances without storage encryption"
|
|
72
|
+
filters:
|
|
73
|
+
- StorageEncrypted: false
|
|
74
|
+
actions:
|
|
75
|
+
- type: notify
|
|
76
|
+
subject: "Unencrypted RDS instance"
|
|
77
|
+
violation_desc: "Database storage is not encrypted at rest."
|
|
78
|
+
action_desc: "Create an encrypted snapshot copy and restore from it."
|
|
79
|
+
|
|
80
|
+
# ── Publicly accessible RDS instances ──
|
|
81
|
+
- name: rds-publicly-accessible
|
|
82
|
+
resource: rds
|
|
83
|
+
description: "RDS instances reachable from the Internet"
|
|
84
|
+
filters:
|
|
85
|
+
- PubliclyAccessible: true
|
|
86
|
+
actions:
|
|
87
|
+
- type: notify
|
|
88
|
+
subject: "Publicly accessible RDS instance"
|
|
89
|
+
violation_desc: "The database endpoint resolves to a public IP."
|
|
90
|
+
action_desc: "Disable public accessibility and route access through the VPC."
|
|
91
|
+
|
|
92
|
+
# ── IAM access keys older than 90 days (CIS 1.4) ──
|
|
93
|
+
- name: iam-stale-access-keys
|
|
94
|
+
resource: iam-user
|
|
95
|
+
description: "IAM users with active access keys older than 90 days"
|
|
96
|
+
filters:
|
|
97
|
+
- type: credential
|
|
98
|
+
key: access_keys.active
|
|
99
|
+
value: true
|
|
100
|
+
- type: credential
|
|
101
|
+
key: access_keys.last_rotated
|
|
102
|
+
value: 90
|
|
103
|
+
op: greater-than
|
|
104
|
+
value_type: age
|
|
105
|
+
actions:
|
|
106
|
+
- type: notify
|
|
107
|
+
subject: "Stale IAM access key"
|
|
108
|
+
violation_desc: "An active access key has not been rotated in over 90 days."
|
|
109
|
+
action_desc: "Rotate the key and update the consuming application."
|
|
110
|
+
|
|
111
|
+
# ── IAM users without MFA (CIS 1.10) ──
|
|
112
|
+
- name: iam-user-no-mfa
|
|
113
|
+
resource: iam-user
|
|
114
|
+
description: "IAM users with console access but no MFA device"
|
|
115
|
+
filters:
|
|
116
|
+
- type: credential
|
|
117
|
+
key: password_enabled
|
|
118
|
+
value: true
|
|
119
|
+
- type: credential
|
|
120
|
+
key: mfa_active
|
|
121
|
+
value: false
|
|
122
|
+
actions:
|
|
123
|
+
- type: notify
|
|
124
|
+
subject: "IAM user without MFA"
|
|
125
|
+
violation_desc: "Console login is enabled without a second factor."
|
|
126
|
+
action_desc: "Enforce MFA enrollment or disable the console password."
|
|
127
|
+
|
|
128
|
+
# ── S3 buckets without default encryption (CIS 2.1.1) ──
|
|
129
|
+
- name: s3-no-default-encryption
|
|
130
|
+
resource: s3
|
|
131
|
+
description: "S3 buckets without default server-side encryption"
|
|
132
|
+
filters:
|
|
133
|
+
- type: bucket-encryption
|
|
134
|
+
state: false
|
|
135
|
+
actions:
|
|
136
|
+
- type: notify
|
|
137
|
+
subject: "S3 bucket without default encryption"
|
|
138
|
+
violation_desc: "Objects written without an encryption header are stored unencrypted."
|
|
139
|
+
action_desc: "Enable default SSE-S3 or SSE-KMS encryption on the bucket."
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# ─────────────────────────────────────────────────────────────────
|
|
2
|
+
# Cloud Custodian — Azure Security & Governance Policies
|
|
3
|
+
# ─────────────────────────────────────────────────────────────────
|
|
4
|
+
# Detection-only policies for common Azure misconfigurations. Aligned
|
|
5
|
+
# with CIS Microsoft Azure Foundations Benchmark v2.0 where noted.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# uv pip install c7n c7n-azure
|
|
9
|
+
# custodian run --output-dir ./custodian-output cloudg/policies/custodian-azure.yml
|
|
10
|
+
|
|
11
|
+
policies:
|
|
12
|
+
|
|
13
|
+
# ── Storage accounts allowing plain HTTP (CIS Azure 3.1) ──
|
|
14
|
+
- name: azure-storage-http-allowed
|
|
15
|
+
resource: azure.storage
|
|
16
|
+
description: "Storage accounts that do not require secure transfer"
|
|
17
|
+
filters:
|
|
18
|
+
- type: value
|
|
19
|
+
key: properties.supportsHttpsTrafficOnly
|
|
20
|
+
value: false
|
|
21
|
+
actions:
|
|
22
|
+
- type: notify
|
|
23
|
+
subject: "Storage account allows HTTP"
|
|
24
|
+
violation_desc: "Secure transfer (HTTPS-only) is disabled."
|
|
25
|
+
action_desc: "Enable 'Secure transfer required' on the storage account."
|
|
26
|
+
|
|
27
|
+
# ── NSGs allowing SSH from anywhere (CIS Azure 6.2) ──
|
|
28
|
+
- name: azure-nsg-open-ssh
|
|
29
|
+
resource: azure.networksecuritygroup
|
|
30
|
+
description: "Network security groups allowing SSH (22) from any source"
|
|
31
|
+
filters:
|
|
32
|
+
- type: ingress
|
|
33
|
+
ports: "22"
|
|
34
|
+
access: Allow
|
|
35
|
+
source: "*"
|
|
36
|
+
actions:
|
|
37
|
+
- type: notify
|
|
38
|
+
subject: "NSG allows SSH from the Internet"
|
|
39
|
+
violation_desc: "Port 22 is open to any source address."
|
|
40
|
+
action_desc: "Restrict the source or use Azure Bastion."
|
|
41
|
+
|
|
42
|
+
# ── NSGs allowing RDP from anywhere (CIS Azure 6.1) ──
|
|
43
|
+
- name: azure-nsg-open-rdp
|
|
44
|
+
resource: azure.networksecuritygroup
|
|
45
|
+
description: "Network security groups allowing RDP (3389) from any source"
|
|
46
|
+
filters:
|
|
47
|
+
- type: ingress
|
|
48
|
+
ports: "3389"
|
|
49
|
+
access: Allow
|
|
50
|
+
source: "*"
|
|
51
|
+
actions:
|
|
52
|
+
- type: notify
|
|
53
|
+
subject: "NSG allows RDP from the Internet"
|
|
54
|
+
violation_desc: "Port 3389 is open to any source address."
|
|
55
|
+
action_desc: "Restrict the source or use Azure Bastion."
|
|
56
|
+
|
|
57
|
+
# ── VMs without managed disks ──
|
|
58
|
+
- name: azure-vm-unmanaged-disks
|
|
59
|
+
resource: azure.vm
|
|
60
|
+
description: "VMs still using unmanaged (storage account) disks"
|
|
61
|
+
filters:
|
|
62
|
+
- type: value
|
|
63
|
+
key: properties.storageProfile.osDisk.managedDisk
|
|
64
|
+
value: null
|
|
65
|
+
actions:
|
|
66
|
+
- type: notify
|
|
67
|
+
subject: "VM uses unmanaged disks"
|
|
68
|
+
violation_desc: "Unmanaged disks miss per-disk encryption and RBAC controls."
|
|
69
|
+
action_desc: "Migrate the VM to managed disks."
|
|
70
|
+
|
|
71
|
+
# ── SQL servers without auditing (CIS Azure 4.1.1) ──
|
|
72
|
+
- name: azure-sqlserver-no-auditing
|
|
73
|
+
resource: azure.sqlserver
|
|
74
|
+
description: "SQL servers without blob auditing enabled"
|
|
75
|
+
filters:
|
|
76
|
+
- type: value
|
|
77
|
+
key: properties.state
|
|
78
|
+
value: Ready
|
|
79
|
+
actions:
|
|
80
|
+
- type: notify
|
|
81
|
+
subject: "Review SQL server auditing"
|
|
82
|
+
violation_desc: "Verify that auditing is enabled for this SQL server."
|
|
83
|
+
action_desc: "Enable auditing to a storage account or Log Analytics workspace."
|
|
84
|
+
|
|
85
|
+
# ── Untagged resource groups ──
|
|
86
|
+
- name: azure-untagged-resource-groups
|
|
87
|
+
resource: azure.resourcegroup
|
|
88
|
+
description: "Resource groups missing an Owner tag"
|
|
89
|
+
filters:
|
|
90
|
+
- "tag:Owner": absent
|
|
91
|
+
actions:
|
|
92
|
+
- type: notify
|
|
93
|
+
subject: "Untagged resource group"
|
|
94
|
+
violation_desc: "Resource group has no Owner tag for cost and ownership tracking."
|
|
95
|
+
action_desc: "Add an Owner tag."
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# ─────────────────────────────────────────────────────────────────
|
|
2
|
+
# Cloud Custodian — GCP Security & Governance Policies
|
|
3
|
+
# ─────────────────────────────────────────────────────────────────
|
|
4
|
+
# Detection-only policies for common GCP misconfigurations. Aligned
|
|
5
|
+
# with CIS GCP Foundation Benchmark v3.0 where noted.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# uv pip install c7n c7n-gcp
|
|
9
|
+
# custodian run --output-dir ./custodian-output cloudg/policies/custodian-gcp.yml
|
|
10
|
+
|
|
11
|
+
policies:
|
|
12
|
+
|
|
13
|
+
# ── Firewall rules open to the world on SSH (CIS GCP 3.6) ──
|
|
14
|
+
- name: gcp-firewall-open-ssh
|
|
15
|
+
resource: gcp.firewall
|
|
16
|
+
description: "Firewall rules allowing 0.0.0.0/0 ingress (review SSH/RDP exposure)"
|
|
17
|
+
filters:
|
|
18
|
+
- type: value
|
|
19
|
+
key: sourceRanges[]
|
|
20
|
+
op: contains
|
|
21
|
+
value: "0.0.0.0/0"
|
|
22
|
+
- type: value
|
|
23
|
+
key: direction
|
|
24
|
+
value: INGRESS
|
|
25
|
+
actions:
|
|
26
|
+
- type: notify
|
|
27
|
+
subject: "Firewall rule open to the Internet"
|
|
28
|
+
violation_desc: "Ingress rule accepts traffic from 0.0.0.0/0."
|
|
29
|
+
action_desc: "Restrict source ranges or use IAP TCP forwarding."
|
|
30
|
+
|
|
31
|
+
# ── Buckets with public IAM bindings (CIS GCP 5.1) ──
|
|
32
|
+
- name: gcp-bucket-public
|
|
33
|
+
resource: gcp.bucket
|
|
34
|
+
description: "Cloud Storage buckets granting access to allUsers or allAuthenticatedUsers"
|
|
35
|
+
filters:
|
|
36
|
+
- type: iam-policy
|
|
37
|
+
key: "bindings[*].members[]"
|
|
38
|
+
op: intersect
|
|
39
|
+
value: ["allUsers", "allAuthenticatedUsers"]
|
|
40
|
+
actions:
|
|
41
|
+
- type: notify
|
|
42
|
+
subject: "Public Cloud Storage bucket"
|
|
43
|
+
violation_desc: "Bucket IAM policy grants access to everyone."
|
|
44
|
+
action_desc: "Remove the public binding and enable public access prevention."
|
|
45
|
+
|
|
46
|
+
# ── Default network still present (CIS GCP 3.1) ──
|
|
47
|
+
- name: gcp-default-network
|
|
48
|
+
resource: gcp.vpc
|
|
49
|
+
description: "Projects still containing the default network"
|
|
50
|
+
filters:
|
|
51
|
+
- type: value
|
|
52
|
+
key: name
|
|
53
|
+
value: default
|
|
54
|
+
actions:
|
|
55
|
+
- type: notify
|
|
56
|
+
subject: "Default network present"
|
|
57
|
+
violation_desc: "The auto-created default network has permissive firewall rules."
|
|
58
|
+
action_desc: "Create a custom VPC and delete the default network."
|
|
59
|
+
|
|
60
|
+
# ── Instances with public IPs (CIS GCP 4.9) ──
|
|
61
|
+
- name: gcp-instance-public-ip
|
|
62
|
+
resource: gcp.instance
|
|
63
|
+
description: "Compute instances with external IP addresses"
|
|
64
|
+
filters:
|
|
65
|
+
- type: value
|
|
66
|
+
key: networkInterfaces[0].accessConfigs
|
|
67
|
+
value: present
|
|
68
|
+
actions:
|
|
69
|
+
- type: notify
|
|
70
|
+
subject: "Instance with public IP"
|
|
71
|
+
violation_desc: "Instance is directly reachable from the Internet."
|
|
72
|
+
action_desc: "Remove the external IP and use Cloud NAT or IAP instead."
|
|
73
|
+
|
|
74
|
+
# ── Cloud SQL instances open to the world (CIS GCP 6.5) ──
|
|
75
|
+
- name: gcp-cloudsql-open
|
|
76
|
+
resource: gcp.sql-instance
|
|
77
|
+
description: "Cloud SQL instances with 0.0.0.0/0 in authorized networks"
|
|
78
|
+
filters:
|
|
79
|
+
- type: value
|
|
80
|
+
key: "settings.ipConfiguration.authorizedNetworks[].value"
|
|
81
|
+
op: contains
|
|
82
|
+
value: "0.0.0.0/0"
|
|
83
|
+
actions:
|
|
84
|
+
- type: notify
|
|
85
|
+
subject: "Cloud SQL instance open to the Internet"
|
|
86
|
+
violation_desc: "Authorized networks include 0.0.0.0/0."
|
|
87
|
+
action_desc: "Remove the open range and use private IP or the Cloud SQL Auth Proxy."
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# ─────────────────────────────────────────────────────────────────
|
|
2
|
+
# Cloud Custodian Efficiency & Governance Policies
|
|
3
|
+
# ─────────────────────────────────────────────────────────────────
|
|
4
|
+
# Usage:
|
|
5
|
+
# pip install c7n
|
|
6
|
+
# custodian run --output-dir ./custodian-output policies/custodian.yml
|
|
7
|
+
|
|
8
|
+
policies:
|
|
9
|
+
|
|
10
|
+
# ── Unattached EBS Volumes ──
|
|
11
|
+
- name: unattached-ebs-volumes
|
|
12
|
+
resource: ebs
|
|
13
|
+
description: "Find EBS volumes that are not attached to any instance"
|
|
14
|
+
filters:
|
|
15
|
+
- type: value
|
|
16
|
+
key: Attachments
|
|
17
|
+
value: empty
|
|
18
|
+
actions:
|
|
19
|
+
- type: notify
|
|
20
|
+
subject: "Unattached EBS volume detected"
|
|
21
|
+
violation_desc: "EBS volume is not attached to any instance and may be wasting costs."
|
|
22
|
+
action_desc: "Review and delete if no longer needed, or snapshot for backup."
|
|
23
|
+
|
|
24
|
+
# ── Idle Load Balancers ──
|
|
25
|
+
- name: idle-load-balancers
|
|
26
|
+
resource: app-elb
|
|
27
|
+
description: "Find ALBs with zero healthy targets"
|
|
28
|
+
filters:
|
|
29
|
+
- type: metrics
|
|
30
|
+
name: HealthyHostCount
|
|
31
|
+
statistics: Average
|
|
32
|
+
days: 7
|
|
33
|
+
value: 0
|
|
34
|
+
op: equal
|
|
35
|
+
actions:
|
|
36
|
+
- type: notify
|
|
37
|
+
subject: "Idle load balancer detected"
|
|
38
|
+
violation_desc: "ALB has had 0 healthy targets for 7+ days."
|
|
39
|
+
action_desc: "Review and remove if no longer serving traffic."
|
|
40
|
+
|
|
41
|
+
# ── Stopped EC2 Instances (30+ days) ──
|
|
42
|
+
- name: stopped-instances-30-days
|
|
43
|
+
resource: ec2
|
|
44
|
+
description: "Find EC2 instances stopped for 30+ days"
|
|
45
|
+
filters:
|
|
46
|
+
- type: instance-age
|
|
47
|
+
op: greater-than
|
|
48
|
+
days: 30
|
|
49
|
+
- type: value
|
|
50
|
+
key: State.Name
|
|
51
|
+
value: stopped
|
|
52
|
+
actions:
|
|
53
|
+
- type: notify
|
|
54
|
+
subject: "Long-stopped EC2 instance"
|
|
55
|
+
violation_desc: "EC2 instance has been stopped for 30+ days."
|
|
56
|
+
action_desc: "Terminate instance or create AMI backup and terminate."
|
|
57
|
+
|
|
58
|
+
# ── Unused Elastic IPs ──
|
|
59
|
+
- name: unused-elastic-ips
|
|
60
|
+
resource: network-addr
|
|
61
|
+
description: "Find Elastic IPs not associated with a running instance"
|
|
62
|
+
filters:
|
|
63
|
+
- type: value
|
|
64
|
+
key: AssociationId
|
|
65
|
+
value: absent
|
|
66
|
+
actions:
|
|
67
|
+
- type: notify
|
|
68
|
+
subject: "Unused Elastic IP"
|
|
69
|
+
violation_desc: "Elastic IP is not associated and incurs hourly charges."
|
|
70
|
+
action_desc: "Release the Elastic IP if no longer needed."
|
|
71
|
+
|
|
72
|
+
# ── Untagged Resources ──
|
|
73
|
+
- name: untagged-resources-ec2
|
|
74
|
+
resource: ec2
|
|
75
|
+
description: "Find EC2 instances missing required tags"
|
|
76
|
+
filters:
|
|
77
|
+
- or:
|
|
78
|
+
- "tag:Owner": absent
|
|
79
|
+
- "tag:Environment": absent
|
|
80
|
+
- "tag:CostCentre": absent
|
|
81
|
+
actions:
|
|
82
|
+
- type: notify
|
|
83
|
+
subject: "Untagged EC2 instance"
|
|
84
|
+
violation_desc: "EC2 instance is missing required tags (Owner, Environment, CostCentre)."
|
|
85
|
+
action_desc: "Add the required tags for cost tracking and governance."
|
|
86
|
+
|
|
87
|
+
- name: untagged-resources-rds
|
|
88
|
+
resource: rds
|
|
89
|
+
description: "Find RDS instances missing required tags"
|
|
90
|
+
filters:
|
|
91
|
+
- or:
|
|
92
|
+
- "tag:Owner": absent
|
|
93
|
+
- "tag:Environment": absent
|
|
94
|
+
actions:
|
|
95
|
+
- type: notify
|
|
96
|
+
subject: "Untagged RDS instance"
|
|
97
|
+
violation_desc: "RDS instance is missing required tags."
|
|
98
|
+
action_desc: "Add Owner and Environment tags."
|
|
99
|
+
|
|
100
|
+
- name: untagged-resources-s3
|
|
101
|
+
resource: s3
|
|
102
|
+
description: "Find S3 buckets missing required tags"
|
|
103
|
+
filters:
|
|
104
|
+
- or:
|
|
105
|
+
- "tag:Owner": absent
|
|
106
|
+
- "tag:Environment": absent
|
|
107
|
+
actions:
|
|
108
|
+
- type: notify
|
|
109
|
+
subject: "Untagged S3 bucket"
|
|
110
|
+
violation_desc: "S3 bucket is missing required tags."
|
|
111
|
+
action_desc: "Add Owner and Environment tags."
|
|
112
|
+
|
|
113
|
+
# ── Oversized Instances ──
|
|
114
|
+
- name: oversized-instances
|
|
115
|
+
resource: ec2
|
|
116
|
+
description: "Flag instances with <5% CPU over 14 days"
|
|
117
|
+
filters:
|
|
118
|
+
- type: metrics
|
|
119
|
+
name: CPUUtilization
|
|
120
|
+
statistics: Average
|
|
121
|
+
days: 14
|
|
122
|
+
value: 5
|
|
123
|
+
op: less-than
|
|
124
|
+
- type: value
|
|
125
|
+
key: State.Name
|
|
126
|
+
value: running
|
|
127
|
+
actions:
|
|
128
|
+
- type: notify
|
|
129
|
+
subject: "Oversized EC2 instance"
|
|
130
|
+
violation_desc: "Instance has <5% average CPU utilisation over 14 days."
|
|
131
|
+
action_desc: "Consider downsizing the instance type or migrating to a smaller instance."
|