|
@@ -56,6 +56,7 @@ import static org.apache.hadoop.fs.s3a.Statistic.OBJECT_DELETE_REQUEST;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleModel.Effects;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleModel.Effects;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleModel.Statement;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleModel.Statement;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleModel.directory;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleModel.directory;
|
|
|
|
+import static org.apache.hadoop.fs.s3a.auth.RoleModel.resource;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleModel.statement;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleModel.statement;
|
|
import static org.apache.hadoop.fs.s3a.auth.RolePolicies.*;
|
|
import static org.apache.hadoop.fs.s3a.auth.RolePolicies.*;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleTestUtils.bindRolePolicyStatements;
|
|
import static org.apache.hadoop.fs.s3a.auth.RoleTestUtils.bindRolePolicyStatements;
|
|
@@ -144,6 +145,11 @@ public class ITestPartialRenamesDeletes extends AbstractS3ATestBase {
|
|
*/
|
|
*/
|
|
private Path writableDir;
|
|
private Path writableDir;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Instruction file created when using CSE, required to be added to policies.
|
|
|
|
+ */
|
|
|
|
+ private Path writableDirInstructionFile;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* A directory to which restricted roles have only read access.
|
|
* A directory to which restricted roles have only read access.
|
|
*/
|
|
*/
|
|
@@ -216,6 +222,7 @@ public class ITestPartialRenamesDeletes extends AbstractS3ATestBase {
|
|
basePath = uniquePath();
|
|
basePath = uniquePath();
|
|
readOnlyDir = new Path(basePath, "readonlyDir");
|
|
readOnlyDir = new Path(basePath, "readonlyDir");
|
|
writableDir = new Path(basePath, "writableDir");
|
|
writableDir = new Path(basePath, "writableDir");
|
|
|
|
+ writableDirInstructionFile = new Path(basePath, "writableDir.instruction");
|
|
readOnlyChild = new Path(readOnlyDir, "child");
|
|
readOnlyChild = new Path(readOnlyDir, "child");
|
|
noReadDir = new Path(basePath, "noReadDir");
|
|
noReadDir = new Path(basePath, "noReadDir");
|
|
// the full FS
|
|
// the full FS
|
|
@@ -225,8 +232,7 @@ public class ITestPartialRenamesDeletes extends AbstractS3ATestBase {
|
|
|
|
|
|
// create the baseline assumed role
|
|
// create the baseline assumed role
|
|
assumedRoleConfig = createAssumedRoleConfig();
|
|
assumedRoleConfig = createAssumedRoleConfig();
|
|
- bindRolePolicyStatements(assumedRoleConfig,
|
|
|
|
- STATEMENT_ALLOW_SSE_KMS_RW,
|
|
|
|
|
|
+ bindRolePolicyStatements(assumedRoleConfig, STATEMENT_ALLOW_KMS_RW,
|
|
STATEMENT_ALL_BUCKET_READ_ACCESS, // root: r-x
|
|
STATEMENT_ALL_BUCKET_READ_ACCESS, // root: r-x
|
|
new Statement(Effects.Allow) // dest: rwx
|
|
new Statement(Effects.Allow) // dest: rwx
|
|
.addActions(S3_PATH_RW_OPERATIONS)
|
|
.addActions(S3_PATH_RW_OPERATIONS)
|
|
@@ -365,13 +371,13 @@ public class ITestPartialRenamesDeletes extends AbstractS3ATestBase {
|
|
public void testRenameParentPathNotWriteable() throws Throwable {
|
|
public void testRenameParentPathNotWriteable() throws Throwable {
|
|
describe("rename with parent paths not writeable; multi=%s", multiDelete);
|
|
describe("rename with parent paths not writeable; multi=%s", multiDelete);
|
|
final Configuration conf = createAssumedRoleConfig();
|
|
final Configuration conf = createAssumedRoleConfig();
|
|
- bindRolePolicyStatements(conf,
|
|
|
|
- STATEMENT_ALLOW_SSE_KMS_RW,
|
|
|
|
|
|
+ bindRolePolicyStatements(conf, STATEMENT_ALLOW_KMS_RW,
|
|
STATEMENT_ALL_BUCKET_READ_ACCESS,
|
|
STATEMENT_ALL_BUCKET_READ_ACCESS,
|
|
new Statement(Effects.Allow)
|
|
new Statement(Effects.Allow)
|
|
.addActions(S3_PATH_RW_OPERATIONS)
|
|
.addActions(S3_PATH_RW_OPERATIONS)
|
|
.addResources(directory(readOnlyDir))
|
|
.addResources(directory(readOnlyDir))
|
|
- .addResources(directory(writableDir)));
|
|
|
|
|
|
+ .addResources(directory(writableDir))
|
|
|
|
+ .addResources(resource(writableDirInstructionFile, false, false)));
|
|
roleFS = (S3AFileSystem) readOnlyDir.getFileSystem(conf);
|
|
roleFS = (S3AFileSystem) readOnlyDir.getFileSystem(conf);
|
|
|
|
|
|
S3AFileSystem fs = getFileSystem();
|
|
S3AFileSystem fs = getFileSystem();
|
|
@@ -733,8 +739,7 @@ public class ITestPartialRenamesDeletes extends AbstractS3ATestBase {
|
|
// s3:DeleteObjectVersion permission, and attempt rename
|
|
// s3:DeleteObjectVersion permission, and attempt rename
|
|
// and then delete.
|
|
// and then delete.
|
|
Configuration roleConfig = createAssumedRoleConfig();
|
|
Configuration roleConfig = createAssumedRoleConfig();
|
|
- bindRolePolicyStatements(roleConfig,
|
|
|
|
- STATEMENT_ALLOW_SSE_KMS_RW,
|
|
|
|
|
|
+ bindRolePolicyStatements(roleConfig, STATEMENT_ALLOW_KMS_RW,
|
|
STATEMENT_ALL_BUCKET_READ_ACCESS, // root: r-x
|
|
STATEMENT_ALL_BUCKET_READ_ACCESS, // root: r-x
|
|
new Statement(Effects.Allow) // dest: rwx
|
|
new Statement(Effects.Allow) // dest: rwx
|
|
.addActions(S3_PATH_RW_OPERATIONS)
|
|
.addActions(S3_PATH_RW_OPERATIONS)
|