-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDDS-2181. Ozone Manager should send correct ACL type in ACL requests… #1528
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
Changes from 14 commits
dc9b448
3d84d0c
58eec26
10d74f9
5dc6674
bd7f713
6b0b9ef
952708e
9073b31
7649171
0f407f0
720a711
a69137d
92b7d3e
0873e26
50777ec
cf1ba2b
6e6f952
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,7 @@ | |
| import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.VOLUME_NOT_FOUND; | ||
| import static org.apache.hadoop.ozone.om.lock.OzoneManagerLock.Resource.BUCKET_LOCK; | ||
| import static org.apache.hadoop.ozone.security.acl.OzoneObj.ResourceType.KEY; | ||
| import static org.apache.hadoop.ozone.security.acl.OzoneObj.ResourceType.OPEN_KEY; | ||
| import static org.apache.hadoop.util.Time.monotonicNow; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
@@ -1656,8 +1657,13 @@ public boolean checkAccess(OzoneObj ozObject, RequestContext context) | |
| validateBucket(volume, bucket); | ||
| OmKeyInfo keyInfo = null; | ||
| try { | ||
| OzoneFileStatus fileStatus = getFileStatus(args); | ||
| keyInfo = fileStatus.getKeyInfo(); | ||
| if (ozObject.getResourceType() == OPEN_KEY) { | ||
| keyInfo = metadataManager.getOpenKeyTable().get(objectKey); | ||
| } else { | ||
| OzoneFileStatus fileStatus = getFileStatus(args); | ||
| keyInfo = fileStatus.getKeyInfo(); | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We Should remove lines from 1675-1677 And 1680-1683. As we have handled using openKey. So, we should throw an exception in CatchBlock |
||
| if (keyInfo == null) { | ||
| // the key does not exist, but it is a parent "dir" of some key | ||
| // let access be determined based on volume/bucket/prefix ACL | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,11 @@ | |
|
|
||
| import com.google.common.base.Optional; | ||
| import com.google.common.base.Preconditions; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.ozone.OmUtils; | ||
| import org.apache.hadoop.ozone.om.ratis.utils.OzoneManagerDoubleBufferHelper; | ||
| import org.apache.hadoop.ozone.security.acl.IAccessAuthorizer; | ||
| import org.apache.hadoop.ozone.security.acl.OzoneObj; | ||
| import org.apache.hadoop.util.Time; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
@@ -169,7 +173,22 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager, | |
| OmKeyInfo omKeyInfo = null; | ||
| try { | ||
| // check Acl | ||
| checkBucketAcls(ozoneManager, volumeName, bucketName, keyName); | ||
| // Native authorizer requires client id as part of keyname to check | ||
| // write ACL on key. Add client id to key name if ozone native | ||
| // authorizer is configured. | ||
| Configuration config = ozoneManager.getConfiguration(); | ||
| if (OmUtils.isNativeAuthorizerEnabled(config)) { | ||
|
||
| String keyNameForAclCheck = | ||
| keyName + "/" + allocateBlockRequest.getClientID(); | ||
| // During allocate block request, it is possible that key is | ||
| // not present in the key table and hence setting the resource type | ||
|
||
| // to OPEN_KEY to check the openKeyTable. | ||
| checkKeyAcls(ozoneManager, volumeName, bucketName, keyNameForAclCheck, | ||
| IAccessAuthorizer.ACLType.WRITE, OzoneObj.ResourceType.OPEN_KEY); | ||
| } else { | ||
| checkKeyAcls(ozoneManager, volumeName, bucketName, keyName, | ||
| IAccessAuthorizer.ACLType.WRITE, OzoneObj.ResourceType.KEY); | ||
| } | ||
|
|
||
| OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager(); | ||
| validateBucketAndVolume(omMetadataManager, volumeName, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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 you add some comment on why OPEN_KEY is needed as ozone object type?
Do we have the corresponding acl type semantics documented somewhere?