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

repository-azure plugin: SAS authentication fails with endpoint_suffix #2462

Closed
raphlopez opened this issue Mar 14, 2022 · 8 comments
Closed
Labels
enhancement Enhancement or improvement to existing feature or request Plugins

Comments

@raphlopez
Copy link
Contributor

Describe the bug
Loading the repository-azure plugin fails when providing a SAS token rather than a Storage Account key for Azure authentication.

To Reproduce
Steps to reproduce the behavior:

  1. Start an opensearch server with a keystore containing the following keys (any value should work to reproduce this bug):
  • azure.client.default.account
  • azure.client.default.sas_token
  • azure.client.default.endpoint_suffix
  1. Load the repository-azure plugin
  2. Upon load, the following exception should occur
  java.lang.IllegalArgumentException: missing required setting [azure.client.default.key] for setting [azure.client.default.endpoint_suffix]
          at org.opensearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:606)
          at org.opensearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:530)
          at org.opensearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:500)
          at org.opensearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:470)
          at org.opensearch.common.settings.SettingsModule.<init>(SettingsModule.java:161)
          at org.opensearch.node.Node.<init>(Node.java:463)
          at org.opensearch.node.Node.<init>(Node.java:319)
          at org.opensearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:242)
          at org.opensearch.bootstrap.Bootstrap.setup(Bootstrap.java:242)
          at org.opensearch.bootstrap.Bootstrap.init(Bootstrap.java:412)
          at org.opensearch.bootstrap.OpenSearch.init(OpenSearch.java:178)
          at org.opensearch.bootstrap.OpenSearch.execute(OpenSearch.java:169)
          at org.opensearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:100)
          at org.opensearch.cli.Command.mainWithoutErrorHandling(Command.java:138)
          at org.opensearch.cli.Command.main(Command.java:101)
          at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:135)
          at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:101)


Expected behavior
According to the checks in buildConnectString() method, authentication can be done by providing either a storage account name and key, or a storage account name and a SAS token.

However, providing only a SAS_TOKEN_SETTING results in the following error on plugin load (from above trace):

java.lang.IllegalArgumentException: missing required setting [azure.client.default.key] for setting [azure.client.default.endpoint_suffix]

The error message above points to the ENDPOINT_SUFFIX_SETTING, which has a dependency on storage account name and key only (i.e. does not account for SAS token).

Given that SAS_TOKEN_SETTING can be set and is mutually exclusive with KEY_SETTING, the ENDPOINT_SUFFIX_SETTING's dependencies should account for this alternative authentication method.

Plugins
repository-azure

@raphlopez raphlopez added bug Something isn't working untriaged labels Mar 14, 2022
@reta
Copy link
Collaborator

reta commented Mar 14, 2022

@raphlopez could you please try without using azure.client.default.endpoint_suffix? Or it is required to be used?

@raphlopez
Copy link
Contributor Author

@reta it does work with azure.client.default.endpoint_suffix removed, but there is a use-case for authenticating to other clouds in azure with different endpoint_suffix (e.g. core.chinacloudapi.cn for Azure China, or core.cloudapi.de for Azure Germany.)

Looking back, I could see this being categorized as a feature request more than a bug report - let me know if you'd like me to adjust the title/tags accordingly.

@kotwanikunal kotwanikunal added feature New feature or request enhancement Enhancement or improvement to existing feature or request and removed untriaged bug Something isn't working labels Mar 15, 2022
@raphlopez raphlopez changed the title [BUG] repository-azure plugin: SAS authentication fails repository-azure plugin: SAS authentication fails Mar 15, 2022
@raphlopez raphlopez changed the title repository-azure plugin: SAS authentication fails repository-azure plugin: SAS authentication fails with endpoint_suffix Mar 15, 2022
@kotwanikunal kotwanikunal added Plugins and removed feature New feature or request labels Mar 15, 2022
@raphlopez
Copy link
Contributor Author

ENDPOINT_SUFFIX dependency on KEY_SETTING has been removed in #2485, and backports to 2.x and 2.0 respectively in #2807 and #2808

@reta
Copy link
Collaborator

reta commented May 3, 2022

@dblock @nknize since 2.0 release is a bit far from now, would you think we could backport this small change to 1.3.x (to get it as part of 1.3.2)? thank you!

@dblock
Copy link
Member

dblock commented May 4, 2022

I think that 1.3.2 ship just sailed, hasn't it?

@reta
Copy link
Collaborator

reta commented May 4, 2022

I think that 1.3.2 ship just sailed, hasn't it?

Yes, you are right, I discovered that yesterday at open hours, thanks!

@dblock
Copy link
Member

dblock commented May 5, 2022

Generally those releases are for security fixes only. While backporting other fixes and even features seems nice because one feels like they are doing a no-risk upgrade, it doesn't always work out that way.

@reta
Copy link
Collaborator

reta commented May 5, 2022

Generally those releases are for security fixes only. While backporting other fixes and even features seems nice because one feels like they are doing a no-risk upgrade, it doesn't always work out that way.

I agree, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Plugins
Projects
None yet
Development

No branches or pull requests

4 participants