Skip to content

Commit

Permalink
[s3-repository] Don't fail if there no symlink for AWS Web Identity T…
Browse files Browse the repository at this point in the history
…oken (#84697) (#84825)

Make sure users can use the static credentials even if there is a service account with IAM roles configured on the system.

See #52625 (comment)
  • Loading branch information
arteam committed Mar 9, 2022
1 parent 861bd0e commit cd7da80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/changelog/84697.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 84697
summary: Don't fail if there no symlink for AWS Web Identity Token
area: Snapshot/Restore
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,14 @@ static class CustomWebIdentityTokenCredentialsProvider implements AWSCredentials
return;
}
// Make sure that a readable symlink to the token file exists in the plugin config directory
// AWS_WEB_IDENTITY_TOKEN_FILE exists but we only use Web Identity Tokens if a corresponding symlink exists and is readable
Path webIdentityTokenFileSymlink = environment.configFile().resolve("repository-s3/aws-web-identity-token-file");
if (Files.exists(webIdentityTokenFileSymlink) == false) {
throw new IllegalStateException("A Web Identity Token symlink in the config directory doesn't exist");
LOGGER.warn(
"Cannot use AWS Web Identity Tokens: AWS_WEB_IDENTITY_TOKEN_FILE is defined but no corresponding symlink exists "
+ "in the config directory"
);
return;
}
if (Files.isReadable(webIdentityTokenFileSymlink) == false) {
throw new IllegalStateException("Unable to read a Web Identity Token symlink in the config directory");
Expand Down

0 comments on commit cd7da80

Please sign in to comment.