s3 bucket policies

19

Click here to load reader

Upload: jiri-pihik

Post on 15-Apr-2017

134 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: S3 Bucket Policies

S3 Bucket Policies

Jiri PihikIdentity Management, Automation

Page 2: S3 Bucket Policies

Concepts

Page 3: S3 Bucket Policies

Users

Instances

Services

Metadata

Configuration

Security

Data

Data read-only

S3 bucket layered permissions

Bucket policy

Page 4: S3 Bucket Policies

Metadata

Configuration

Security

Data

Data read-only

~ 46 permissions to define S3 bucket access

s3:PutBucketCORSs3:PutBucketVersionings3:PutBucketWebsites3:DeleteBucketWebsites3:GetLifecycleConfigurations3:PutLifecycleConfigurations3:PutReplicationConfigurations3:GetReplicationConfiguration...

Page 5: S3 Bucket Policies
Page 6: S3 Bucket Policies

Who are you?

What IP do you have?

Is this right time to access me?

Page 7: S3 Bucket Policies

Who are you?

What IP do you have?

Is this right time to access me? Which parts of me

you can access?

What can you do here?

Can you set lifecycle here?

Are you able to write content?

Page 8: S3 Bucket Policies

Bucket access logging

my-s3-log-system

Page 9: S3 Bucket Policies

Example log

0b0fbd7ab5d1058f35535fec64595ed51f7fa26ef77ac8e5d88230898be92e2f my-corp-bucket [21/Jan/2016:12:47:32 +0000] 125.12.36.95 arn:aws:sts::012345678912:assumed-role/my-role/pihik 9E15D396E0071675 REST.PUT.OBJECT report.html "PUT /report.html HTTP/1.1" 200 - - 5134 457 6 "-" "aws-cli/1.9.21 Python/2.7.11 Windows/7 botocore/1.3.21" -

aws-cli s3 upload object

Page 10: S3 Bucket Policies

Use cases

● Prevent unauthorized access to your S3 resources● Enables you to store application configs, secrets in S3 bucket● Enables development for 3rd parties● Ensure only users from corp network can access your S3 resources● S3 static websites● Enables fine-grained permissions inside bucket - one folder for public access,

another one for internal assets● Improve your compliance level

Page 11: S3 Bucket Policies

DEMO!

Page 12: S3 Bucket Policies

Example bucket policies

Page 13: S3 Bucket Policies

{ "Version": "2012-10-17", "Statement": [ { "Action": [ "s3:PutObject" ], "Effect": "Allow", "Resource": "arn:aws:s3:::my-corp-bucket/reports/*.pdf", "Condition": { "IpAddress": { "aws:SourceIp": "108.72.209.118" } } } ]}

3rd party vendor access

Page 14: S3 Bucket Policies

{"Version": "2012-10-17","Statement": [

{"Effect": "Deny","Principal": "*","Action": "s3:*","Resource": "arn:aws:s3:::corp-bucket/tools/*","Condition": {

"NotIpAddress": {"aws:SourceIp": [

"125.10.15.0/16","125.12.36.95","10.0.0.0/24"

]}

}}

]}

restricted access only to corp network

Page 15: S3 Bucket Policies

How to read that crazy stuff?!

Page 16: S3 Bucket Policies

How to read that crazy stuff?!

Deny all S3 actionson specified resource

IFip address IS NOT 125.x.x.x

Page 17: S3 Bucket Policies

{"Version": "2012-10-17","Statement": [

{"Effect": "Deny","Principal": "*","Action": "s3:*","Resource": "arn:aws:s3:::corp-bucket/tools/*","Condition": {

"NotIpAddress": {"aws:SourceIp": [

"125.10.15.0/16","125.12.36.95","10.0.0.0/24"

]}

}}

]}

DENYALL S3 ACTIONS

ON SPECIFIED RESOURCEIF

IP ADDRESS IS NOT

125.x.x.x, OR …OR ...

Page 18: S3 Bucket Policies

"Condition" : { "DateGreaterThan" : { "aws:CurrentTime" : "2016-02-09T12:00:00Z" }, "DateLessThan": { "aws:CurrentTime" : "2016-02-09T15:00:00Z" }, "IpAddress" : { "aws:SourceIp" : ["192.0.2.0/24", "203.0.113.0/24"] }}

Limited 3rd party bucket access

IP address AND specific time range

Page 19: S3 Bucket Policies

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Principal": "*", "Action": "s3:*", "Resource": "arn:aws:s3:::my-corp-bucket/finance/*", "Condition": { "Null": { "aws:MultiFactorAuthAge": true } } }, { "Effect": "Allow", "Principal": "*", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::my-corp-bucket/public/*" } ]}

require MFA for sensitive data access

folder /public is accessible via internet