【发布时间】:2018-03-15 20:58:50
【问题描述】:
我正在尝试按角色限制用户仅访问 S3 存储桶中的特定文件夹。可以说,存储桶被配置为“模拟安装”,这样我们就可以将它用于文件共享,就好像它是一个更传统的服务器一样。每个用户都在使用 CloudBerry 远程访问 S3。
这是我当前的(损坏的)策略,存储桶名称是“bluebolt”。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUserToSeeBucketListInTheConsole",
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:ListAllMyBuckets"
],
"Resource": [
"arn:aws:s3:::*"
]
},
{
"Sid": "AllowRootAndHomeListingOfCompanySharedAndPAndP",
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::bluebolt"
],
"Condition": {
"StringEquals": {
"s3:prefix": [
"",
"Production and Processing/",
"Production and Processing/${aws:username}",
"Company Shared/"
],
"s3:delimiter": [
"/"
]
}
}
},
{
"Sid": "AllowListingOfCompanyShared",
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::bluebolt"
],
"Condition": {
"StringLike": {
"s3:prefix": [
"Company Shared/*"
]
}
}
},
{
"Sid": "AllowListingOfUserFolder",
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::bluebolt"
],
"Condition": {
"StringLike": {
"s3:prefix": [
"Production and Processing/${aws:username}/",
"Production and Processing/${aws:username}/*"
]
}
}
},
{
"Sid": "AllowAllS3ActionsCompanyShared",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::bluebolt/Company Shared/*"
]
},
{
"Sid": "AllowAllS3ActionsInUserFolder",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::bluebolt/Production and Processing/${aws:username}/*"
]
},
{
"Sid": "DenyAllS3ActionsInManagement",
"Effect": "Deny",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::bluebolt/Management/*"
]
}
]
}
所以,我想做的是限制用户仅列出/读取/写入“/Production and Processing/[UserName]”中的内容,同时能够列出/读取“/Company Shared”中的所有内容同时明确禁止对“/Management”以及“/Production and Processing/*”中除用户文件夹之外的所有内容的所有访问。理想情况下,用户只会在 bluebolt 中看到“/Company Shared”和“/Production and Processing”,一旦他们进入“/Production and Processing”,他们只会看到他们的用户名文件夹,即他们的工作区。
现在,一旦用户在 bluebolt 顶级存储桶下方进行挖掘,我就会得到零星的访问权限(“您没有访问权限”)。
我不知道这个用例是否常见,或者我是否试图将太方的钉子放入圆孔中,但欢迎任何反馈/提示/类似的政策应用程序/严厉的批评,并非常感谢!
【问题讨论】:
-
您最好的办法是查看存储桶日志以了解软件正在尝试执行的操作。它可能不会根据用户实际尝试执行的操作来发出合理的请求。您还可能会在键前缀中使用空格来寻求麻烦。 S3 在内部以奇怪的方式处理它们,我怀疑这是遗留原因,可能期望
"Production and Processing/"是"Production+and+Processing/"(未确认)。
标签: amazon-s3 amazon-iam amazon-policy