根据Restricting Access to a Specific HTTP Referrer中的文档,我已授予对一组给定域的访问权限,并根据指示,拒绝访问除那些域之外的任何站点。除尝试使用根凭据或任何IAM用户执行任何操作外,这一切都很好并且很好。
接着说:
此示例阻止所有用户(包括root用户)执行所有Amazon S3操作,包括管理存储桶策略。考虑添加第三个Sid以授予root用户s3:*操作。
在第二个sid中,我看不到任何指定拒绝的方法,除非它是root用户或特定的IAM用户。
问题是如何“添加第三个sid”。
非常清楚,我是AWS权限的新手。我尝试了多种方法来指定此神奇的“ 3rd sid”,但显然这样做是不正确的。我尝试了以下文档中的许多变体,例如以下,没有运气,也没有明确的想法在何处/如何在策略中授予Root特权。
{
"Sid": "Allow Root All Access",
"Effect": "Allow",
"Principal": {
"AWS": "123456789012",
"CanonicalUser": "57bb2cb8as978f89sreuruapouduasp8udc5ba524fe20eb22853f19088600a67"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::our-bucket/*"
}
通过示例实现的政策,并且确实(效果很好)
{
"Version": "2012-10-17",
"Id": "http referer policy example",
"Statement": [
{
"Sid": "Allow get requests originating from Our Site.",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::our-bucket/*",
"Condition": {
"StringLike": {
"aws:Referer": [
"http://www.oursite.com/*",
"https://www.oursite.com/*"
]
}
}
},
{
"Sid": "Explicit deny to ensure requests are allowed only from specific referer.",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::our-bucket/*",
"Condition": {
"StringNotLike": {
"aws:Referer": [
"*oursite.com/*"
]
}
}
}
]
}
在此先感谢任何可以提供帮助的人!
而不是-
{
"Sid":"Allow Root All Access",
"Effect":"Allow",
"Principal":{
"AWS":"123456789012",
"CanonicalUser":"..."
},
"Action":"s3:*",
"Resource":"arn:aws:s3:::our-bucket/*"
}
请尝试-
{
"Sid":"Allow Root All Access",
"Effect":"Allow",
"Principal":{
"AWS":"arn:aws:iam::123456789012:root"
},
"Action":"s3:*",
"Resource":"arn:aws:s3:::our-bucket/*"
}
我从此link获得了这种格式。