aryangupta1998 opened a new pull request, #12224:
URL: https://github.com/apache/ozone/pull/12224

   ## What changes were proposed in this pull request?
   
   When ozone.om.enable.ofs.shared.tmp.dir=true and a non-native authorizer 
such as Ranger is configured, OzoneAuthorizerFactory wraps it in 
SharedTmpDirAuthorizer. That wrapper overrides only checkAccess. It does not 
override generateAssumeRoleSessionPolicy, added to IAccessAuthorizer in 
[HDDS-13848](https://issues.apache.org/jira/browse/HDDS-13848), so the call 
falls through to the interface default, which throws NOT_SUPPORTED_OPERATION.
   
   As a result, every S3 STS AssumeRole request fails, even though the wrapped 
authorizer (Ranger, 
[RANGER-5393](https://issues.apache.org/jira/browse/RANGER-5393)) implements 
the method:
   An error occurred (UnsupportedOperation) when calling the AssumeRole 
operation:
   The generateAssumeRoleSessionPolicy call is not supported
   Unauthorized callers get the same error instead of AccessDenied, because the 
request never reaches the authorizer's assume_role check.
   
   On an affected OM, the startup log shows:
   OzoneAuthorizerFactory: omX: Authorizer for OM is class 
org.apache.hadoop.ozone.security.acl.SharedTmpDirAuthorizer
   Steps to reproduce
   
   Secure cluster with ozone.acl.enabled=true, 
ozone.acl.authorizer.class=org.apache.ranger.authorization.ozone.authorizer.RangerOzoneAuthorizer,
 ozone.om.enable.ofs.shared.tmp.dir=true and S3 STS enabled on the S3 Gateway.
   Create a Ranger role and a policy granting assume_role on it to a user.
   As that user, run aws sts assume-role --role-arn 
arn:aws:iam::123456789012:role/<role> --role-session-name s1 --endpoint-url 
https://<s3g>:9881.
   AssumeRole fails with UnsupportedOperation. With 
ozone.om.enable.ofs.shared.tmp.dir=false, the authorizer is not wrapped and 
AssumeRole succeeds.
   
   Fix
   
   Override generateAssumeRoleSessionPolicy in SharedTmpDirAuthorizer and 
delegate it to the wrapped authorizer. AssumeRole authorizes a role rather than 
a path, so the shared tmp bucket routing does not apply and the native 
authorizer is never involved. Added a unit test in TestSharedTmpDirAuthorizer.
   
   Workaround
   
   Set ozone.om.enable.ofs.shared.tmp.dir=false on the OMs and restart them. 
This disables the shared ofs:///tmp bucket.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17975
   
   ## How was this patch tested?
   
   Unit test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to