Skip to content
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

HDDS-11041. Add admin request filter for S3 requests and UGI support for GrpcOmTransport #7268

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

devabhishekpal
Copy link
Contributor

What changes were proposed in this pull request?

HDDS-11041. Add admin request filter for S3 requests and UGI support for GrpcOmTransport

Please describe your PR in detail:

  • Currently the s3secret endpoints do not support checking for the user making the request. This causes issues like HDDS-11040 where any user can modify the secrets
  • As a part of this PR we are adding a new filter to check if the user making the request is a part of Ozone Admins, if not we will not trigger the generation/revocation of secret
  • We are also adding the passing of UserGroupInformation to the GrpcOmTransport while creating the proxy connection to allow accessing the user ticket similar to the Hadoop3OmTransport

What is the link to the Apache JIRA

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

How was this patch tested?

Patch was tested using unit tests

@adoroszlai
Copy link
Contributor

@ivanzlenko please take a look

@adoroszlai adoroszlai added the s3 S3 Gateway label Oct 4, 2024
@ivanzlenko
Copy link
Contributor

General question: do we have any new tests for this?

@devabhishekpal
Copy link
Contributor Author

Hi @ivanzlenko, new tests have not yet been added. We will need to modify existing tests to add user as an admin and generate request.
New test will be having a random user try to generate the request and get a forbidden response.

Waiting for go on code change before modifying the tests.

@ivanzlenko
Copy link
Contributor

@devabhishekpal new filter could and should be covered with unit tests at least.

@devabhishekpal
Copy link
Contributor Author

Yes, these new cases will be added to check for the filter working

Copy link
Contributor

@myskov myskov left a comment

Choose a reason for hiding this comment

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

Thanks @devabhishekpal for updating the patch.

hadoop-ozone/s3gateway/pom.xml Outdated Show resolved Hide resolved
@ivanzlenko
Copy link
Contributor

Thanks @devabhishekpal for tiding up code!

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @devabhishekpal for working on this.

  1. Please enable existing robot tests related to HDDS-11041, e.g.:

[Tags] robot:skip # TODO: Enable after HDDS-11041 is done.

  1. Please add a new test case similar to ... By Username For Other User, but with testuser2 (non-admin) logged in, and expecting request to be rejected.

hadoop-ozone/common/pom.xml Outdated Show resolved Hide resolved
@devabhishekpal
Copy link
Contributor Author

Hi @ivanzlenko, @adoroszlai, @myskov, @vtutrinov could you take another look at the changes?
Thanks.

  • Added new robot test to verify the filter
  • Refactored the common config related utils to OzoneAdmins class
  • Re-enabled the skipped robot tests added by @ivanzlenko initially as a part of HDDS-11040
  • Added unit tests for the new utils

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @devabhishekpal for updating the patch. Mostly looks good.

I just realized that GrpcOmTransport is not used in any acceptance test environments. Can you please enable it in ozonesecure env. by the following change?

diff --git hadoop-ozone/dist/src/main/compose/ozonesecure/docker-compose.yaml hadoop-ozone/dist/src/main/compose/ozonesecure/docker-compose.yaml
index 39d26c362f..3fb7525f20 100644
--- hadoop-ozone/dist/src/main/compose/ozonesecure/docker-compose.yaml
+++ hadoop-ozone/dist/src/main/compose/ozonesecure/docker-compose.yaml
@@ -96,7 +96,7 @@ services:
       - 9878:9878
     env_file:
       - ./docker-config
-    command: ["/opt/hadoop/bin/ozone","s3g"]
+    command: ["/opt/hadoop/bin/ozone","s3g","-Dozone.om.transport.class=org.apache.hadoop.ozone.om.protocolPB.GrpcOmTransportFactory"]
     environment:
       OZONE_OPTS:
   recon:

@devabhishekpal
Copy link
Contributor Author

Thanks for the review @adoroszlai , addressed the test failures.

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @devabhishekpal for iterating on the patch.

@adoroszlai adoroszlai requested review from errose28, vtutrinov and ivanzlenko and removed request for ivanzlenko and vtutrinov October 23, 2024 11:16
@ivanzlenko
Copy link
Contributor

ivanzlenko commented Oct 24, 2024

@devabhishekpal from my point of view should be enough to have unit tests with mocks to verify that the contract for the filter will remain the same with any changes and extensively cover this functionality with integration tests. Unit tests should be simple and I don't think it will be a good to write something very comprehensive to mimic what could be done with integration tests.
P.S. sorry for waiting for a response from me.

@devabhishekpal
Copy link
Contributor Author

Thanks for the input @ivanzlenko.
We re-enabled robot tests to verify this as well as new robot tests to verify the admin filter.
New unit tests were also added for the utils. It would be great if you could take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s3 S3 Gateway
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants