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

Support STS for OSS ufs through RAMRole #16481

Merged
merged 14 commits into from
Jan 5, 2023

Conversation

StephenRi
Copy link
Contributor

@StephenRi StephenRi commented Nov 7, 2022

What changes are proposed in this pull request?

Support STS for OSS ufs

Why are the changes needed?

  1. Plaintext AccessKey/AccessSecret is not safe and not Recommended for Aliyun
  2. STS(Security Token Service) for OSS is more safe. For details, see https://help.aliyun.com/document_detail/32016.html

Does this PR introduce any user facing changes?

addition property keys

  1. UNDERFS_OSS_STS_ENABLED
  2. UNDERFS_OSS_RETRY_MAX
  3. UNDERFS_OSS_ECS_RAM_ROLE

#16510

@alluxio-bot alluxio-bot added the API Change Changes covering public API label Nov 7, 2022
@StephenRi
Copy link
Contributor Author

@fuzhengjia How can I apply a reviewer

@Jackson-Wang-7
Copy link
Contributor

So the PR is to support using RAM role to get STS temporary credentials to access OSS ufs. I think it's mostly good.
And I know there are several other Aliyun STS endpoint to get the temporary credentials, like AssumeRole. I'm not sure the title of the PR is clear enough.

@StephenRi StephenRi changed the title Support STS for OSS ufs Support STS for OSS ufs through RAMRole Nov 14, 2022
Copy link
Contributor

@Jackson-Wang-7 Jackson-Wang-7 left a comment

Choose a reason for hiding this comment

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

LGTM

@StephenRi
Copy link
Contributor Author

@Jackson-Wang-7 has finished the review. @dbw9580 Does this need another reviewer?

@StephenRi
Copy link
Contributor Author

@dbw9580 All advices have been resolved, please check again.

Copy link
Contributor

@dbw9580 dbw9580 left a comment

Choose a reason for hiding this comment

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

thanks for the improvements!

@StephenRi StephenRi force-pushed the feature/support-sts-for-oss branch 2 times, most recently from a4c0cf3 to 2db909e Compare November 17, 2022 10:22
@dbw9580
Copy link
Contributor

dbw9580 commented Nov 21, 2022

After digging into the OSS apis, I found there is a com.aliyun.oss.OSSClientBuilder#build(java.lang.String, com.aliyun.oss.common.auth.CredentialsProvider, com.aliyun.oss.ClientBuilderConfiguration) method which takes a CredentialsProvider as argument. You can implement the CredentialsProvider interface and put the token refreshing logic there. Actually I think CustomSessionCredentialsProvider already did the same thing for you.

For credentials, InstanceProfileCredentials has a method willSoonExpire which tells you whether the token needs to be refreshed.

This way, we can decouple the refreshing of credentials from the construction of the OSS client, in case in the future we want to support AssumeRole as another way to do authentication, since there is already a STSAssumeRoleSessionCredentialsProvider.

@StephenRi
Copy link
Contributor Author

StephenRi commented Nov 21, 2022

After digging into the OSS apis, I found there is a com.aliyun.oss.OSSClientBuilder#build(java.lang.String, com.aliyun.oss.common.auth.CredentialsProvider, com.aliyun.oss.ClientBuilderConfiguration) method which takes a CredentialsProvider as argument. You can implement the CredentialsProvider interface and put the token refreshing logic there. Actually I think CustomSessionCredentialsProvider already did the same thing for you.

For credentials, InstanceProfileCredentials has a method willSoonExpire which tells you whether the token needs to be refreshed.

This way, we can decouple the refreshing of credentials from the construction of the OSS client, in case in the future we want to support AssumeRole as another way to do authentication, since there is already a STSAssumeRoleSessionCredentialsProvider.

@dbw9580 I'm glad to hear about CustomSessionCredentialsProvider.

There is another project in out group which implement STS like this PR did, and it works well. So I just use STS in Alluxio as they do.

Maybe I will consider implementing it using CustomSessionCredentialsProvider and testing it later.

@LuQQiu
Copy link
Contributor

LuQQiu commented Jan 3, 2023

@dbw9580 @StephenRi Is the current code good to be merged and @StephenRi can help improve the credential provider logic and add related OSS doc in another PR?

@LuQQiu LuQQiu added the needs-response waiting on alluxio response label Jan 3, 2023
Copy link
Contributor

@dbw9580 dbw9580 left a comment

Choose a reason for hiding this comment

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

LGTM. The proposed improvement can happen in another PR.

@LuQQiu
Copy link
Contributor

LuQQiu commented Jan 4, 2023

@StephenRi please help resolve the final minor comments, and this PR is good to be merged
Please help improve the credential provider logic and add related OSS doc in following PRs.

StephenRi and others added 2 commits January 5, 2023 10:19
Co-authored-by: Bowen Ding <6999708+dbw9580@users.noreply.github.com>
@StephenRi
Copy link
Contributor Author

@StephenRi please help resolve the final minor comments, and this PR is good to be merged Please help improve the credential provider logic and add related OSS doc in following PRs.

@LuQQiu @dbw9580 All the comments have been resolved. Please check.

@StephenRi
Copy link
Contributor Author

I will use CustomSessionCredentialsProvider to improve the credential provider later. It is in my TODO list

@LuQQiu
Copy link
Contributor

LuQQiu commented Jan 5, 2023

alluxio-bot, merge this please

@alluxio-bot alluxio-bot merged commit bbe99b3 into Alluxio:master Jan 5, 2023
jja725 pushed a commit to jja725/alluxio that referenced this pull request Jan 27, 2023
### What changes are proposed in this pull request?

Support STS for OSS ufs

### Why are the changes needed?

1. Plaintext AccessKey/AccessSecret is not safe and not Recommended for
Aliyun
2. STS(Security Token Service) for OSS is more safe. For details, see
https://help.aliyun.com/document_detail/32016.html

### Does this PR introduce any user facing changes?

addition property keys
1. UNDERFS_OSS_STS_ENABLED
2. UNDERFS_OSS_RETRY_MAX
3. UNDERFS_OSS_ECS_RAM_ROLE

Alluxio#16510

pr-link: Alluxio#16481
change-id: cid-7d486e84f82e5ab5211238b1f180b4a8fd8e5742
@LuQQiu LuQQiu added area-ufs Under File Storage area-security Alluxio security relate labels Feb 4, 2023
@JiamingMai
Copy link
Contributor

alluxio-bot, cherry-pick this to dora please

@alluxio-bot
Copy link
Contributor

Auto cherry-pick unsuccessful:
Insufficient permissions to trigger a cherry-pick. user: JiamingMai

alluxio-bot pushed a commit that referenced this pull request Apr 25, 2023
This is a PR to cherry-pick committed PR #16481 and #16122 into target branch dora.
			pr-link: #17320
			change-id: cid-2056ac34c59ae3eb9678be69c8c24d55c72603e3
jiacheliu3 pushed a commit to jiacheliu3/alluxio that referenced this pull request May 12, 2023
Support STS for OSS ufs

1. Plaintext AccessKey/AccessSecret is not safe and not Recommended for
Aliyun
2. STS(Security Token Service) for OSS is more safe. For details, see
https://help.aliyun.com/document_detail/32016.html

addition property keys
1. UNDERFS_OSS_STS_ENABLED
2. UNDERFS_OSS_RETRY_MAX
3. UNDERFS_OSS_ECS_RAM_ROLE

pr-link: Alluxio#16481
change-id: cid-7d486e84f82e5ab5211238b1f180b4a8fd8e5742
jiacheliu3 pushed a commit to jiacheliu3/alluxio that referenced this pull request May 13, 2023
Support STS for OSS ufs

1. Plaintext AccessKey/AccessSecret is not safe and not Recommended for
Aliyun
2. STS(Security Token Service) for OSS is more safe. For details, see
https://help.aliyun.com/document_detail/32016.html

addition property keys
1. UNDERFS_OSS_STS_ENABLED
2. UNDERFS_OSS_RETRY_MAX
3. UNDERFS_OSS_ECS_RAM_ROLE

pr-link: Alluxio#16481
change-id: cid-7d486e84f82e5ab5211238b1f180b4a8fd8e5742
Jackson-Wang-7 pushed a commit to Jackson-Wang-7/alluxio that referenced this pull request Nov 24, 2023
### What changes are proposed in this pull request?

Support STS for OSS ufs

### Why are the changes needed?

1. Plaintext AccessKey/AccessSecret is not safe and not Recommended for
Aliyun
2. STS(Security Token Service) for OSS is more safe. For details, see
https://help.aliyun.com/document_detail/32016.html

### Does this PR introduce any user facing changes?

addition property keys
1. UNDERFS_OSS_STS_ENABLED
2. UNDERFS_OSS_RETRY_MAX
3. UNDERFS_OSS_ECS_RAM_ROLE

Alluxio#16510

pr-link: Alluxio#16481
change-id: cid-7d486e84f82e5ab5211238b1f180b4a8fd8e5742
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Change Changes covering public API area-security Alluxio security relate area-ufs Under File Storage needs-response waiting on alluxio response POM Change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants