Skip to content

Instantly share code, notes, and snippets.

@felipekiko
Last active November 10, 2020 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipekiko/b3d107c67249af3043c89631aaa54bc2 to your computer and use it in GitHub Desktop.
Save felipekiko/b3d107c67249af3043c89631aaa54bc2 to your computer and use it in GitHub Desktop.
policies:
- name: s3-check-with-public-access
resource: aws.s3
comment: Checks if has some S3 bucket with public access
filters:
- or:
- type: global-grants
- type: cross-account
everyone_only: true
actions:
- type: tag
key: Cloud-Custodian-S3-With-Public-Access
value: true
- name: s3-tag-when-create-with-public-access
resource: aws.s3
comment: Checks if has some S3 bucket with public access
mode:
type: cloudtrail
events:
- CreateBucket
- source: 's3.amazonaws.com'
event: PutBucketPolicy
ids: 'requestParameters.bucketName'
role: arn:aws:iam::{account_id}:role/YOUR-CUSTODIAN-ROLE
timeout: 200
filters:
- or:
- type: global-grants
- type: cross-account
everyone_only: true
actions:
- type: tag
key: Cloud-Custodian-S3-With-Public-Access
value: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment