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

Add shared access signature authentication support #42117

Closed
wants to merge 2 commits into from

Conversation

slider
Copy link

@slider slider commented May 13, 2019

The current default authentication scheme for the azure repository plugin are the account name/key credentials of a storage account. This is basically "root" access for all the containers/blobs within a storage account and makes it hard to safely seperate multiple tenants within a storage account.

This change adds support for shared access signatures, which allow to control access on container or blob level instead of only having service level authentication.

To achieve that I introduced a new config setting (sas_token) and had to move the connection String methods around a bit.

Since I last used Java about a decade ago I'm happy about any feedback regarding the code style, I tried my best ;)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@slider
Copy link
Author

slider commented May 22, 2019

Jenkins run elasticsearch-ci/bwc

@slider slider marked this pull request as ready for review May 23, 2019 08:07
@pmoust
Copy link
Member

pmoust commented May 23, 2019

I see this labelled as v7.2.0 and v8.0.0 - can we please examine 6.x and 7.1.x for this too?

Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

I think this looks fine in general :) But two things:

  1. I think we can make this a lot simpler code wise as suggested in-line by not having the credentials interface.
  2. We need to add a third party test for this imo. If you need help with this, let me know in Slack and I'm happy to give you some pointers or code it up myself real quick (we'll also need infra's help here after we've coded it up).


package org.elasticsearch.repositories.azure;

public interface AzureCredentials {
Copy link
Member

Choose a reason for hiding this comment

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

@slider It seems to me we're building the connection string from final fields only in AzureStorageSettings. Can't we simply build that string in the constructor of AzureStorageSettings and put it in a final String field instead? It seems to me that would save a lot of code?
We could just build the string in https://github.com/elastic/elasticsearch/pull/42117/files#diff-fa5785f3bb417953978dce2a4d63bbebR202 where we currently set up the instances of this interface and it would be simpler all around wouldn't it?

@original-brownbear
Copy link
Member

Side note: I think a back port to 6.x+ should be safe here (IMO). If we simplify the code the way I suggested above this is a really short and isolated change.

@original-brownbear original-brownbear self-assigned this Jun 7, 2019
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Jun 7, 2019
* Added setting for SAS token
* Added support for the token in tests
* Relates elastic#42117
@original-brownbear
Copy link
Member

I opened #42982 now that implements SAS tokens in a minimal-invasive manner including third party tests. => I'll close here, hope it's ok :)
Thanks for the work on this @slider !

original-brownbear added a commit that referenced this pull request Jun 11, 2019
* Added setting for SAS token
* Added support for the token in tests
* Relates #42117
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Jun 26, 2019
)

* Added setting for SAS token
* Added support for the token in tests
* Relates elastic#42117
original-brownbear added a commit that referenced this pull request Jun 26, 2019
…43618)

* Added setting for SAS token
* Added support for the token in tests
* Relates #42117
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Jul 1, 2019
) (elastic#43618)

* Added setting for SAS token
* Added support for the token in tests
* Relates elastic#42117
original-brownbear added a commit that referenced this pull request Jul 2, 2019
* Add SAS Token Authentication Support to Azure Repo Plugin (#42982) (#43618)

* Added setting for SAS token
* Added support for the token in tests
* Relates #42117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants