[Extensions] Add Transport API for fetching Service Account information from security plugin #2609
Labels
enhancement
New feature or request
triaged
Issues labeled as 'Triaged' have been reviewed and are deemed actionable.
In order to implement Service Accounts (#2597), it needs to be possible to fetch service account details. To do this, OpenSearch core should be able to call the Security Plugin to provide a Service Account Authorization Header back to the Extensions Manager in core. This will let core then verify the operations of the associated extension.
The process should follow
The alt and else blocks show the decision point where the process either checks if the service account exists or creates it if it does not exist.
The general implementation process will require adding a transport layer API to the Security Plugin so that Core can call the API with a provided
extensionId
string. This can take the form of an API stack in a package located atsrc/main/java/org/opensearch/security/extensions/api/
. Since we are only concerned with getting the Service Account credentials, the plan is to combine both thecreateServiceAccount
andgetServiceAccount
actions into one. Basically, we want a single actionServiceAccountGetAction
to provide service account auth credentials regardless if a service account was created for that specific extension before or not.When the request reaches the Security Plugin, the Security Plugin should look in the
InternalUsers
for a matching Service Account (denoted by a name which equals theextensionUniqueId
and with an attributeservice:true
). If one exists, the Security Plugin should generate an auth token to return to OpenSearch core based on the information in theInternalUsers
store (this is a separate issue, for now we can just return a string saying "account found" or something).If no matching Service Account is found, then the Security Plugin will need to create a new Service Account for the extension and store it in the InternalUsers Storage. Again, this will be a separate issue, so for now it is sufficient to return "no account found, new service account created" etc. This response should be passed back to OpenSearch core so that the Extensions Manager will ultiamtely be able to parse the message and act on its content.
Completion of this issue will look like a PR which adds the required classes to the
../extensions/api/
package that would allow OpenSearch core to provide anextensionId
and either get the matching service account credentials or create a new service account based on that ID and then return the new credentials. The PR will need to test that the API accepts and responds appropriately to a mocked request from core but does not need to make any changes in core. Likewise, Service Account lookup, auth token creation, and service account creation are outside the scope of this issue. You can make this PR against themain
branch if that seems appropriate or alternatively against thefeature/identity
branch if the PR does not seem self-contained enough that merging tomain
would be appropriate (generally, we only want tested, and isolated changes inmain
). You can reach out to @scrawfor99 on this issue or on the OpenSearch slack for questions about the PR completion.A basic starting point for this comes from the refactor of the user system. Specifically #2594, which introduces a user service for handling service accounts and internal users.
Eventually, inside Core, a hook will need to be added that allows the API to be called when a new extension is registered with the Extension Manager. An outline of what this may look like can be found here. This may be helpful when completing this issue.
The text was updated successfully, but these errors were encountered: