Skip to content

Commit

Permalink
feat: strip s3 global grants on bucket creation.
Browse files Browse the repository at this point in the history
Also add a tag for exemption from the global grants removal policies.
  • Loading branch information
jimrazmus committed Sep 3, 2019
1 parent f5d41b9 commit cf81dac
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions policies/s3-global-grants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ policies:
region: us-east-1
resource: aws.s3
filters:
- "tag:c7n_s3_global_grants_exempt": absent
- "tag:c7n_s3_global_grants": absent
- type: global-grants
mode:
Expand Down Expand Up @@ -34,6 +35,7 @@ policies:
region: us-east-1
resource: aws.s3
filters:
- "tag:c7n_s3_global_grants_exempt": absent
- "tag:c7n_s3_global_grants": not-null
- not:
- type: global-grants
Expand Down Expand Up @@ -61,6 +63,7 @@ policies:
Remove global grants from S3 buckets marked for today's date.
region: us-east-1
filters:
- "tag:c7n_s3_global_grants_exempt": absent
- type: global-grants
- type: marked-for-op
tag: c7n_s3_global_grants
Expand All @@ -83,3 +86,29 @@ policies:
type: sqs
queue: c7nMessageQueue
violation_desc: "S3 bucket had global grants."

- name: s3-global-grants-remove-on-creation
resource: aws.s3
comment: |
Remove global grants from S3 buckets at time of creation.
region: us-east-1
filters:
- "tag:c7n_s3_global_grants_exempt": absent
- type: global-grants
mode:
type: cloudtrail
events:
- CreateBucket
actions:
- type: delete-global-grants
- type: notify
action_desc: |
Custodian removed global grants from S3 bucket(s).
No further action is required.
cc: ["#000000"]
subject: "S3 Bucket Security"
to: ["slack"]
transport:
type: sqs
queue: c7nMessageQueue
violation_desc: "S3 bucket had global grants."

0 comments on commit cf81dac

Please sign in to comment.