HDDS-9663. Allow OM to detect client address when using gRPC#5590
Merged
adoroszlai merged 3 commits intoapache:masterfrom Nov 18, 2023
Merged
HDDS-9663. Allow OM to detect client address when using gRPC#5590adoroszlai merged 3 commits intoapache:masterfrom
adoroszlai merged 3 commits intoapache:masterfrom
Conversation
This was referenced Nov 13, 2023
d512ca5 to
02fb168
Compare
… grpc request context key
02fb168 to
fea5c15
Compare
adoroszlai
reviewed
Nov 15, 2023
Contributor
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @vtutrinov for the patch.
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressClientInterceptor.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/ClientAddressClientInterceptor.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/grpc/package-info.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataReader.java
Show resolved
Hide resolved
…e blocks and javadocs
adoroszlai
reviewed
Nov 15, 2023
Contributor
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @vtutrinov for updating the patch, LGTM.
I'll let other reviewers (@kerneltime, @xBis7) take a look before merging it.
Contributor
|
@kerneltime would you like to take a look? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
A lot of code pieces in OM proto method handlers use OMClientRequest.preExecute method to define/detect userInfo for consequent ACLs checks. But if the provided client hostname is null (in case of GRPC transport) the user will be replaced by an 'om' one and the consequent ACLs check through a custom authorizer (e.g. Ranger) will fail due to non-existent permission policies for the 'om' user.
So, the PR introduces a new client&server interceptor to send/receive header with the client IP and hostname and uses it in GrpcOmTransport
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9663
How was this patch tested?
1 unit test to check that userInfo has hostname and IP in case of GRPC transport (ozone-manager)
2 unit tests to check that client and server interceptors set and read client IP and hostname to/from the GRPC request header
Manual test of the expected behavior (the ACLs will be checked for the current user, not for 'om' on committing the key) on cluster with Ranger