-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDDS-1611. Evaluate ACL on volume bucket key and prefix to authorize access. Contributed by Ajay Kumar. #973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Draft patch for initial feedback, will ad robot test and more unit tests soon. |
💔 -1 overall
This message was automatically generated. |
BitSet rights = BitSet.valueOf(a.getRights().toByteArray()); | ||
switch (a.getType()) { | ||
case USER: | ||
if (a.getName().equals(context.getClientUgi().getUserName())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move context.getClientUgi().getUserName() out of the for loop?
* | ||
* @return true if given ugi has acl set, else false. | ||
* */ | ||
public boolean hasAccess(ACLType acl, ACLIdentityType aclType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline, we need to handle different identity types.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Should contain ${result} createdOn | ||
${result} = Execute ozone sh volume list --user bilbo | grep -Ev 'Removed|DEBUG|ERROR|INFO|TRACE|WARN' | jq -r '.[] | select(.volumeName=="${volume}")' | ||
${result} = Execute ozone sh volume list | grep -Ev 'Removed|DEBUG|ERROR|INFO|TRACE|WARN' | jq -r '.[] | select(.volumeName=="${volume}")' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
Test native authorizer | ||
Execute ozone sh volume removeacl ${volume3} -a group:root:a | ||
Execute kdestroy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
Execute kdestroy | ||
Run Keyword Kinit test user testuser2 testuser2.keytab | ||
${result} = Execute And Ignore Error ozone sh bucket list /${volume3}/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
Should contain ${result} PERMISSION_DENIED org.apache.hadoop.ozone.om.exceptions.OMException: User testuser2/scm@EXAMPLE.COM doesn't have LIST permission to access volume | ||
Execute ozone sh volume addacl ${volume3} -a user:testuser2/scm@EXAMPLE.COM:l | ||
Execute ozone sh bucket list /${volume3}/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
Execute ozone sh volume addacl ${volume3} -a user:testuser2/scm@EXAMPLE.COM:l | ||
Execute ozone sh bucket list /${volume3}/ | ||
Execute ozone sh volume getacl /${volume3}/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
@@ -33,21 +33,21 @@ Setup volume names | |||
*** Test Cases *** | |||
Create volume bucket with wrong credentials | |||
Execute kdestroy | |||
${rc} ${output} = Run And Return Rc And Output ozone sh volume create o3://om/fstest --user bilbo --quota 100TB --root | |||
${rc} ${output} = Run And Return Rc And Output ozone sh volume create o3://om/fstest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
@@ -356,7 +359,7 @@ public void testFailedDeleteVolume() throws IOException, OzoneException { | |||
// Create a volume and test Volume access for a different user | |||
@Test | |||
public void testAccessVolume() throws IOException, OzoneException { | |||
String userName = "user" + RandomStringUtils.randomNumeric(5); | |||
String userName = UserGroupInformation.getCurrentUser().getUserName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
private void validateAll(OzoneObj obj, RequestContext.Builder | ||
builder) throws OMException { | ||
List<ACLType> allAcls = new ArrayList<>(Arrays.asList(ACLType.values())); | ||
allAcls.remove(ALL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
*/ | ||
private void validateNone(OzoneObj obj, RequestContext.Builder | ||
builder) throws OMException { | ||
List<ACLType> allAcls = new ArrayList<>(Arrays.asList(ACLType.values())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
metadataManager.getLock().acquireBucketLock(volume, bucket); | ||
try { | ||
validateBucket(volume, bucket); | ||
String objectKey = metadataManager.getOzoneKey(volume, bucket, keyName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
args.getVolumeName(), args.getBucketName(), args.getKeyName()); | ||
} else { | ||
throw ex; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
@@ -78,4 +78,12 @@ | |||
* @throws IOException - incase of volume creation failure. | |||
*/ | |||
boolean createOzoneVolumeIfNeeded(String userName) throws IOException; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
.setQuotaInBytes(OzoneConsts.MAX_QUOTA_IN_BYTES); | ||
for (OzoneAcl acl : getDefaultAcls()) { | ||
builder.addOzoneAcls(OzoneAcl.toProtobuf(acl)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace:end of line
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@@ -118,6 +118,10 @@ | |||
* */ | |||
public static final String OZONE_ADMINISTRATORS = | |||
"ozone.administrators"; | |||
/** | |||
* Make every user an admin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps write more detailed comment here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
|
||
public static int getNoOfAcls() { | ||
return length; | ||
} | ||
|
||
public static ACLType getAclTypeFromOrdinal(int ordinal) { | ||
if (ordinal > length - 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should perhaps add a not less than zero check also , so we can throw exception correctly.
testMatrix.put(" world:bilbo:w", Boolean.FALSE); | ||
testMatrix.put(" world:bilbo:rw", Boolean.FALSE); | ||
testMatrix.put(" world:bilbo:w", Boolean.TRUE); | ||
testMatrix.put(" world:bilbo:rw", Boolean.TRUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good catch. I think we should move to more explicit error, where if the users tries to set world and a user name, we should throw an error, that way user is not making a mistake, which we are silently ignoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
checkAcls(ResourceType.KEY, StoreType.OZONE, ACLType.WRITE, | ||
args.getVolumeName(), args.getBucketName(), args.getKeyName()); | ||
try { | ||
checkAcls(ResourceType.KEY, StoreType.OZONE, ACLType.WRITE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to make sure that Audit system knows about these ACL check failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created HDDS-1768 to track it.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
4ba675f
to
881c4da
Compare
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
…access. Contributed by Ajay Kumar.
seems like some error in reporting, acceptance tests passed. |
/retest |
failed junit tests look unrelated, TestWatchForCommit & TestFailureHandlingByClient fail for trunk as well. |
…authorize access. Contributed by Ajay Kumar. (#973) Fixes a build break in ozone.
…access. Contributed by Ajay Kumar. (apache#973)
…authorize access. Contributed by Ajay Kumar. (apache#973) Fixes a build break in ozone.
No description provided.