Skip to content

[Question] Service Account Specifications #2597

@stephen-crawford

Description

@stephen-crawford

Problem Statement

This issue tracks specific design questions about Service Accounts.

$\textcolor{orange}{\textsf{Orange text is a header for a decision that is not made }}$
$\textcolor{teal}{\textsf{Teal text is a header for a decision that is made }}$
$\textcolor{violet}{\textsf{Violet text is the recommended option }}$
$\textcolor{lime}{\textsf{Lime text is the chosen option }}$

What type of REST requests are intended for extensions?
How does the Security Plugin interact with REST requests?
What is the current method of signifying things?

Action items decided on this issue:

  • How is extension registration tied to service accounts?
  • How is a service account represented inside of the Security Plugin?
  • Is a service account limited/different from normal internal account?
  • How can an extension use its service account?
  • Can an extension have more than one service account?

$\textcolor{teal}{\textsf{How is extension registration tied to service accounts?}}$

In order to make extension registration tied to service accounts, the obvious choice appears to be forcing the extension to check in with the Security Plugin.

Using this method, we can force an extension to request a service account from the Security Plugin during registration and make the extension responsible for tracking its account credentials.

On service startup, all extenesions are loaded, and scopes are validated.

For every extensions they make a call to enable or disable service accounts:

  1. If Enabled, create or return existing service account with 'Enabled: true'
  2. If Disabled, create or update existing service account with 'Enabled: false', do not return the account to OpenSearch core.

$\textcolor{teal}{\textsf{How is a service account represented inside of the Security Plugin?}}$

The current design implements service accounts in a similar manner to a standard internal user account. This extends to the storage of service accounts which places the service accounts inside the configuration index of the Security Plugin.

$\textcolor{teal}{\textsf{Is a service account limited/different from normal internal account?}}$

There are two main options for whether service accounts should be different from normal internal user accounts.

  1. $\textcolor{lime}{\textsf{Service accounts are basically the same as any other account}}$ The first option is for service accounts to be the same as any other account. Based on this option, service accounts would have the same attributes as any other account. They may possibly have an additional attribute mapped to them i.e. "service":"true" but otherwise there should be no specifications as to the types of properties a service account should have.
Pros Cons
Easy to implement May not need all of the normal properties
More flexibility for what accounts can do
Puts more responsibility on extension authors
  1. The second option is to restrict the properties associated with a service account. For example:

    • Service accounts are passwordless - you cannot login to OSD using a service account
    • Service accounts are mapped to at most 1 role
    • Service accounts cannot be assigned backend roles

This option adds specific requirements to service accounts and enforces rules based on an account's status. This option may still require the addition of new attributes such as the above mentioned service field.

Pros Cons
Least privileges Not clear why we need to restrict these
Less areas for a rouge extension to exploit

$\textcolor{teal}{\textsf{How can an extension use its service account?}}$

The current plan is for an extension to use its service account for:

  1. Authorization and authentication of requests the extension is performing on its own behalf
  2. Making configuration changes to the security settings associated with the extension
  3. Specifying the permissions of the extension

$\textcolor{teal}{\textsf{Can an extension have more than one service account?}}$

There are two main options for whether an extension should be able to have more than one service account.

  1. $\textcolor{lime}{\textsf{Extensions can only have one service account}}$ The first option is extensions to only be able to have a single service account. This option restricts extensions from having more than one service account and as a result makes it easier to track the roles associated with each extension. Because an extension cannot have multiple accounts, the Security Plugin will only have to deal with a single mapping of the extension id to the corresponding account.
Pros Cons
Only have to resolve a single service account May restrict things?
Easier to track roles and scopes Requires modification of the existing service account for changes to occur
  1. The second option is to allow an extension to have multiple accounts. This option complicates scenarios for registering an extension since the unique extension id could not automatically be used for a service account name. It also makes permissions management more complicated since multiple service accounts with multiple roles may need to be resolved for each extension request.
Pros Cons
Do not need to change existing service accounts Complicated permission resolution
Does not require enforcement of the service account creation process No clear use case

Flow Diagrams

  1. Extension Requests its Service Account (same as registration process)
flowchart TD
    A[Extension_1] -->|Install| B(Core ServiceAccountManager)
    B --> |getOrCreate ServiceAccount|C{Security Plugin}
    C -->| Check ServiceAccount| D[InternalUsers]
    D --> | ServiceAccount Exists | E(Response)
    D --> | ServiceAccount does not exist | F[Create ServiceAccount]
    F --> | Store ServiceAccount | D
    E --> | Return ServiceAccount Info | B
Loading
  1. Cluster administrator requests a list of all service accounts
flowchart TD
    A[Admin_1] -->|REST GET localhost:9200/_extensions/accounts/list| B(Core RestHandler)
    B --> |Forward to Security Plugin|C{Security Plugin}
    C -->| Authorize request| C
    C -->| Access internalUser Storage| D[InternalUsers]
    D --> | Iterate over accounts | D
    D --> | Build response list of all with 'Service' : 'true' | E[ResponseObject]
    E --> | Return ServiceAccount List | B
Loading
  1. Extension tries to execute a request
flowchart TD
    A[Extension_1] -->|Operation Request| B(Core)
    B --> | Redirect to ServiceAccountManager | C(Core ServiceAccountManager)
    C --> |getOrCreate ServiceAccount|D{Security Plugin}
    D -->| Check ServiceAccount| E[InternalUsers]
    E --> | ServiceAccount Exists | F(Response)
    F --> | Return ServiceAccount Info | D
    D --> | Authorize ServiceAccount | D
    D --> | Return Authorization | C
    C --> | Give 200 | B
    B --> | Execute Request | B
Loading

Metadata

Metadata

Labels

triagedIssues labeled as 'Triaged' have been reviewed and are deemed actionable.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions