Skip to content

Conversation

@z-bb
Copy link
Contributor

@z-bb z-bb commented May 8, 2023

What changes were proposed in this pull request?

In the listKeys method,ACLType is LIST, but in the listStatus method, ACLType is READ
So it causes inconsistent return information.
I think listStatus should also check LIST.

ozone cli

[hadoop@presto-test-006 ~]$ om-current/bin/ozone sh vol addacl -a user:test:r vol-1-29165
ACL user:test:r[ACCESS] added successfully.
[hadoop@presto-test-006 ~]$ om-current/bin/ozone sh  bucket addacl -a user:test:r vol-1-29165/bucket-188-54163
ACL user:test:r[ACCESS] added successfully.
[hadoop@presto-test-006 ~]$ export HADOOP_USER_NAME=test
[hadoop@presto-test-006 ~]$ om-current/bin/ozone sh key list --prefix=h vol-1-29165/bucket-188-54163/
PERMISSION_DENIED User test doesn't have LIST permission to access bucket Volume:vol-1-29165 Bucket:bucket-188-54163 Key:h

[hadoop@presto-test-006 ~]$ om-current/bin/ozone sh bucket list --prefix=b vol-1-29165/
PERMISSION_DENIED User test doesn't have LIST permission to access volume Volume:vol-1-29165
[hadoop@bigdata-pre-hdp02.nmg01 ~/hadoop-2.7.2-5504-ozone-client]$ export HADOOP_USER_NAME=test
[hadoop@bigdata-pre-hdp02.nmg01 ~/hadoop-2.7.2-5504-ozone-client]$ ./bin/hadoop fs -ls /vol-1-29165/bucket-188-54163/h*
-rw-rw-rw-   3 test test        243 2023-05-08 14:13 /vol-1-29165/bucket-188-54163/hosts

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-8566

How was this patch tested?

Unit tests.

@umamaheswararao
Copy link
Contributor

@swamirishi could you please help to review it?

@z-bb z-bb changed the title ListSatus should check LIST ACL HDDS-8566.ListSatus should check LIST ACL. May 9, 2023
Copy link
Contributor

@ashishkumar50 ashishkumar50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@z-bb Thanks for working on this, Please find comment inline.
Also please update PR according to template given in https://github.com/apache/ozone/blob/master/.github/pull_request_template.md

objectStore.setAcl(volumeObj, OzoneAcl.parseAcls(
"user:" + USER1 + ":r," +
"user:" + USER2 + ":r"));
"user:" + USER1 + ":l," +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need ":l" permission for volume object? You have modified to handle only keys permission in ListStatus.

Copy link
Contributor Author

@z-bb z-bb May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashishkumar50 Hi, Because list the volume or bucket also requires the "l" permission
For example

[hadoop@bigdata-pre-master01.nmg01 ~]$ ~/om-current/bin/ozone sh  vol create vol-test
[hadoop@bigdata-pre-master01.nmg01 ~]$ ~/om-current/bin/ozone sh  bucket create vol-test/blk-test

[hadoop@bigdata-pre-hdp02.nmg01 ~]$ export HADOOP_USER_NAME=test
[hadoop@bigdata-pre-hdp02.nmg01 ~]$  ~/hadoop-2.7.2-5504-ozone-client/bin/hadoop fs -ls /
[hadoop@bigdata-pre-hdp02.nmg01 ~]$  ~/hadoop-2.7.2-5504-ozone-client/bin/hadoop fs -ls /vol-test
-ls: Fatal internal error
java.lang.RuntimeException: PERMISSION_DENIED org.apache.hadoop.ozone.om.exceptions.OMException: User test doesn't have LIST permission to access volume Volume:vol-test
	at org.apache.hadoop.ozone.client.OzoneVolume$BucketIterator.getNextListOfBuckets(OzoneVolume.java:527)
	at org.apache.hadoop.ozone.client.OzoneVolume$BucketIterator.<init>(OzoneVolume.java:497)
	at org.apache.hadoop.ozone.client.OzoneVolume.listBuckets(OzoneVolume.java:368)
	at org.apache.hadoop.fs.ozone.BasicRootedOzoneClientAdapterImpl.listStatusVolume(BasicRootedOzoneClientAdapterImpl.java:801)
	at org.apache.hadoop.fs.ozone.BasicRootedOzoneClientAdapterImpl.listStatus(BasicRootedOzoneClientAdapterImpl.java:885)
	at org.apache.hadoop.fs.ozone.BasicRootedOzoneFileSystem.listStatusAdapter(BasicRootedOzoneFileSystem.java:869)
	at org.apache.hadoop.fs.ozone.BasicRootedOzoneFileSystem.listStatus(BasicRootedOzoneFileSystem.java:844)
	at org.apache.hadoop.fs.shell.PathData.getDirectoryContents(PathData.java:268)
	at org.apache.hadoop.fs.shell.Command.recursePath(Command.java:373)
	at org.apache.hadoop.fs.shell.Ls.processPathArgument(Ls.java:90)
	at org.apache.hadoop.fs.shell.Command.processArgument(Command.java:271)
	at org.apache.hadoop.fs.shell.Command.processArguments(Command.java:255)
	at org.apache.hadoop.fs.shell.Command.processRawArguments(Command.java:201)
	at org.apache.hadoop.fs.shell.Command.run(Command.java:165)
	at org.apache.hadoop.fs.FsShell.run(FsShell.java:287)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
	at org.apache.hadoop.fs.FsShell.main(FsShell.java:340)
Caused by: PERMISSION_DENIED org.apache.hadoop.ozone.om.exceptions.OMException: User test doesn't have LIST permission to access volume Volume:vol-test
	at org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB.handleError(OzoneManagerProtocolClientSideTranslatorPB.java:710)
	at org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB.listBuckets(OzoneManagerProtocolClientSideTranslatorPB.java:632)
	at org.apache.hadoop.ozone.client.rpc.RpcClient.listBuckets(RpcClient.java:1188)
	at org.apache.hadoop.ozone.client.OzoneVolume$BucketIterator.getNextListOfBuckets(OzoneVolume.java:525)
	... 17 more

If add "l" permission to volume, then

[hadoop@bigdata-pre-master01.nmg01 ~]$ export HADOOP_USER_NAME=hadoop
[hadoop@bigdata-pre-master01.nmg01 ~]$ ~/om-current/bin/ozone sh vol addacl -a user:test:l /vol-test
ACL user:test:l[ACCESS] added successfully.

[hadoop@bigdata-pre-hdp02.nmg01 ~]$ export HADOOP_USER_NAME=test
[hadoop@bigdata-pre-hdp02.nmg01 ~]$  ~/hadoop-2.7.2-5504-ozone-client/bin/hadoop fs -ls /vol-test
Found 1 items
drwxrwxrwx   - hadoop hadoop          0 2023-05-10 17:17 /vol-test/blk-test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But according to documentation it needs only READ permission on volume and for bucket it needs LIST and READ for listKeys. Can you please check for list Key behaviour as well.
https://ozone.apache.org/docs/1.3.0/security/securitywithranger.html

@neils-dev neils-dev changed the title HDDS-8566.ListSatus should check LIST ACL. HDDS-8566. ListSatus should check LIST ACL. May 11, 2023
@z-bb z-bb closed this May 17, 2023
@z-bb z-bb deleted the HDDS-8566 branch May 17, 2023 03:20
@z-bb z-bb restored the HDDS-8566 branch May 18, 2023 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants