[
https://issues.apache.org/jira/browse/HDDS-17975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aryan Gupta updated HDDS-17975:
-------------------------------
Description:
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, 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) 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.
was:
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, 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) 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.
> SharedTmpDirAuthorizer does not delegate generateAssumeRoleSessionPolicy,
> breaking STS AssumeRole
> -------------------------------------------------------------------------------------------------
>
> Key: HDDS-17975
> URL: https://issues.apache.org/jira/browse/HDDS-17975
> Project: Apache Ozone
> Issue Type: Improvement
> Reporter: Aryan Gupta
> Assignee: Aryan Gupta
> Priority: Major
>
> 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, 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) 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.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]