INF-40Recommended
Block dangerous actions for the whole organization
Set organization-wide policies that refuse the most dangerous actions in every account, even for admins.
How to do it
Use the cloud's organization policies, such as AWS service control policies, Google Cloud organization policies or Azure Policy. Deny turning off or deleting the audit trail, leaving the organization, and using regions outside the list. Block public storage and service account keys. Keep a short exception for the break-glass role. Apply them from code in the management account. AWS service control policies do not bind the management account itself, so run no workloads there.
Examples
JSON example
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ProtectAuditTrail",
"Effect": "Deny",
"Action": ["cloudtrail:StopLogging", "cloudtrail:DeleteTrail", "organizations:LeaveOrganization"],
"Resource": "*",
"Condition": { "ArnNotLike": { "aws:PrincipalARN": "arn:aws:iam::*:role/break-glass" } }
},
{
"Sid": "AllowedRegionsOnly",
"Effect": "Deny",
"NotAction": ["iam:*", "organizations:*", "sts:*", "support:*", "cloudfront:*", "route53:*"],
"Resource": "*",
"Condition": { "StringNotEquals": { "aws:RequestedRegion": ["eu-north-1", "eu-west-1"] } }
}
]
}
How to check
In a sandbox account, an admin tries to stop the audit trail and to start a server in a region outside the list. Both calls end in AccessDenied.
Sources
Related rules
- AID-13 Block dangerous actions with hooks in AI-assisted development
- INF-14 Start every account from one baseline in Infrastructure and environments
- INF-85 Keep one audit trail for the whole organization that no account can change in Infrastructure and environments
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/policy-as-code/cloud-guardrails">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.