Sub topic 2
Defining the zone of trust
This chapter assumes you know how resource-based policies and role trust policies use the Principal element, and that you have used AWS Organizations. You should be able to run the AWS CLI.
What the zone of trust is
An external access analyzer needs a rule for deciding what counts as "outside." That rule is the zone of trust. Access Analyzer treats every principal inside the zone as trusted and reports any access granted to a principal outside it.
You choose the zone when you create the analyzer. There are two choices:
- Account: the zone is the single AWS account that owns the analyzer.
- Organization: the zone is every account in your AWS organization.
The choice changes which findings you get, even for identical policies.
How the choice changes findings
Suppose account 111122223333 has an S3 bucket policy that allows a role in account 444455556666. Both accounts belong to the same organization.
| Analyzer zone | Is `444455556666` trusted? | Result |
|---|---|---|
| Account (`111122223333`) | No | Finding: access from outside the zone |
| Organization | Yes | No finding |
A policy that uses "Principal": "*" with no restricting condition is public access. It produces a finding under either zone.
Choosing between account and organization
Use an account zone when each account owns its own security review. It is stricter. Sharing between two accounts in your own organization is reported, so you see every cross-account path.
Use an organization zone when accounts in the organization routinely share resources and you only care about access that leaves the organization. It produces fewer findings and less noise.
You can also run both. An account analyzer shows internal cross-account sharing, and an organization analyzer shows what leaves the organization.
Creating an organization analyzer
You create an organization analyzer from the organization's management account, or from an account you have registered as the delegated administrator for Access Analyzer. The command differs from the account version only in --type:
aws accessanalyzer create-analyzer \
--analyzer-name org-external \
--type ORGANIZATIONAn analyzer works in one Region. It reports resources in the Region where you create it. To cover several Regions, create an analyzer in each one.
Conditions and the zone
Access Analyzer reads the conditions in a policy when it decides who can reach a resource. A condition that limits access to your organization can keep a wide principal inside the zone. This policy uses "Principal": "*", but aws:PrincipalOrgID restricts it to members of one organization:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowOrgRead",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example-bucket/*",
"Condition": {
"StringEquals": {
"aws:PrincipalOrgID": "o-exampleorgid"
}
}
}
]
}With an organization analyzer for o-exampleorgid, this policy does not produce a public access finding. Remove the condition and the same policy is reported as public. With an account analyzer, the policy is still reported, because other accounts in the organization are outside a single-account zone.
Common mistakes
- Creating an account analyzer and expecting it to ignore sibling accounts in your organization. It does not.
- Creating an analyzer in one Region and assuming it covers all Regions.
- Trying to create an organization analyzer from a member account that is not the delegated administrator.
Exercise
A bucket policy in account A allows s3:GetObject for a role in account B. Both accounts are in the same organization. Which analyzer zone produces a finding, and why?
Show answer
The account zone for account A produces a finding, because account B is outside that single-account zone. An organization zone does not, because account B is a member of the trusted organization.