Created
June 4, 2013 15:01
-
-
Save ndarville/5706592 to your computer and use it in GitHub Desktop.
Anti-hotlinking S3 bucket policies for www.modrenman.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2008-10-17", | |
"Statement": [ | |
{ | |
"Sid": "Deny access if referer is not set", | |
"Effect": "Deny", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::data.modrenman.com/*", | |
"Condition": { | |
"StringNotLike": { | |
"aws:Referer": "*" | |
} | |
} | |
}, | |
{ | |
"Sid": "Give access if referer is my site", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::data.modrenman.com/*", | |
"Condition": { | |
"StringLike": { | |
"aws:Referer": [ | |
"http://data.modrenman.com/*", | |
"http://www.modrenman.com/*", | |
"http://modrenman.com/*" | |
] | |
} | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2008-10-17", | |
"Statement": [ | |
{ | |
"Sid": "Deny access if referer is not set", | |
"Effect": "Deny", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::www.modrenman.com/static/*", | |
"Condition": { | |
"StringNotLike": { | |
"aws:Referer": "*" | |
} | |
} | |
}, | |
{ | |
"Sid": "Give access if referer is my site", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::www.modrenman.com/static/*", | |
"Condition": { | |
"StringLike": { | |
"aws:Referer": [ | |
"http://www.modrenman.com/*", | |
"http://modrenman.com/*" | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compare viewing an image directly versus viewing it in its article.