Skip to main content
Home
badllama.com
  • Search
  • Log In

Securing S3 part 2: Locking your buckets and objects

cpeters's picture

Tue, 11/28/2017 - 18:57 by cpeters

Building on this post, below are some examples of how to traverse your entire S3 inventory and:

  1. Apply bucket policies that prevent
    • Users from uploading content that's publicly available
    • Prevent users from making existing content public
  2. Remove any public or semi-public access to your objects stored in S3

Get the code here. Converting these scripts to Ansible isn't an incredibly straightforward exercise, because you have to customize each and every policy document to contain the name of the bucket. I'd recommend simply running these shell commands idempotently from Ansible, and then either using cron or AWS System Manager to schedule it. One can also pair this with AWS Config to set up a compliance alert so if something DOES get past the script, you'll know about it.

Tags: 
aws cli security s3
Powered by Backdrop CMS