Skip to content

[RFC] Support for API Keys in OpenSearch Security Plugin #4009

@cwperks

Description

@cwperks

Introduction

This proposal seeks to introduce API Key authentication as a feature within the OpenSearch Security Plugin, responding to significant community demand as evidenced by the number of thumbs up reactions on #1504. This feature aims to enhance security and usability for OpenSearch users by providing a more flexible and secure method of authentication for various use cases, including scheduled jobs.

Background

The OpenSearch Security Plugin currently supports a variety of authentication methods including HTTP Basic Authentication, JWT, SAML, OpenID Connect and others. However, the lack of API Key support limits the flexibility and ease of use for developers and administrators, particularly in scenarios involving automated processes or services that require access to the OpenSearch cluster without human intervention.

API Keys are a widely adopted method for service-to-service authentication, offering a secure and convenient way to grant access to APIs without exposing user credentials. They are particularly useful for scheduled jobs, where a job needs to authenticate with OpenSearch to perform operations in a known context.

Proposal

We propose the addition of an API Key authentication mechanism to the OpenSearch Security Plugin with the following features:

1. API Key Generation

  • Users can generate API Keys through a REST API endpoint or the OpenSearch Dashboards UI.
  • The generation process should allow users to specify:
    • The name of the API Key for identification.
    • An optional expiration date/time.
    • Permissions associated with the API Key, leveraging the existing roles and permissions model in OpenSearch Security.

2. API Key Storage

  • Generated API Keys will be securely stored in the OpenSearch cluster with their metadata, including the creator, creation date, expiration date, and associated permissions.

3. API Key Usage

  • API Keys can be used by including them in the request header when making calls to the OpenSearch cluster.
  • The Security Plugin will authenticate requests by validating the API Key against the stored keys and their associated permissions.

4. API Key Revocation

  • Users can revoke API Keys at any time before their expiration through the REST API or the OpenSearch Dashboards UI.
  • Revoked keys will be immediately invalidated and cannot be used for authentication.

5. UX Component

  • The OpenSearch Dashboards UI will include a new section for managing API Keys, allowing users to:
    • Generate new API Keys.
    • List all their API Keys with their status (active, expired, revoked) and expiration dates.
    • Revoke active API Keys.

6. Scheduled Jobs Support

  • API Keys can be used to authenticate scheduled jobs, allowing these jobs to run in a known context with specific permissions.
  • This will enable more secure and controlled access for automated processes interacting with the OpenSearch cluster.

Security Considerations

  • API Key transmission will be secured using HTTPS to prevent exposure.
  • The storage of API Keys will be encrypted at rest (as is done with encrypted passwords using bcrypt).
  • Audit logging will be enhanced to include all operations related to API Key management (generation, usage, revocation).

Conclusion

The introduction of API Key support in the OpenSearch Security Plugin will significantly enhance the security and usability of OpenSearch, particularly for automated processes and services. This feature will provide a flexible, secure, and user-friendly method of authentication, aligning with modern security practices and meeting the needs of the OpenSearch community.

We invite comments, suggestions, and contributions from the community to refine and implement this proposal.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedCommunity contributions are especially encouraged for these issues.triagedIssues labeled as 'Triaged' have been reviewed and are deemed actionable.v3.0.0

Type

No type

Projects

Status

New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions