-
Notifications
You must be signed in to change notification settings - Fork 617
Add documentation for Experimental Security Configuration Versioning Management and APIs #11195
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
Changes from 3 commits
131c220
2c993b8
11ebb12
0f715e3
a21532f
ac25dd4
234d8c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,239 @@ | ||
--- | ||
layout: default | ||
title: Security configuration versioning | ||
parent: Configuration | ||
nav_order: 27 | ||
--- | ||
|
||
# Security Configuration Versioning and Rollback API | ||
Check failure on line 8 in _security/configuration/versioning.md
|
||
**Introduced 3.3** | ||
{: .label .label-purple } | ||
|
||
The Security Configuration Versioning and Rollback API provides version control for OpenSearch security configurations, enabling administrators to track changes, maintain audit trails, and restore previous configurations when needed. | ||
|
||
This API automatically creates versions when security configurations change, allowing you to track the complete history of security configuration modifications, view detailed information about any previous version, and roll back to any previous configuration version, thus maintaining operational safety. | ||
|
||
## How versioning works | ||
|
||
The system automatically creates a new version when a security configuration change is detected, the change differs from the most recent saved version, and an administrator makes modifications through supported APIs. | ||
|
||
Each version contains a version ID (unique identifier such as `v1`, `v2`), a configuration snapshot (complete security configuration at the time of creation), a timestamp indicating when the version was created, and user information identifying who made the change. | ||
|
||
A new version is created **only when a change is detected** compared to the latest saved version. This prevents redundant versions and ensures meaningful version history. | ||
|
||
## Enabling versioning | ||
|
||
To use the security configuration versioning, you must enable it in your OpenSearch configuration. Add the following setting to your `opensearch.yml` configuration file: | ||
|
||
```yaml | ||
plugins.security.configurations_versions.enabled: true | ||
``` | ||
|
||
Optionally, you can control the number of retained versions by specifying the following setting: | ||
|
||
```yaml | ||
plugins.security.config_version.retention_count: 10 | ||
``` | ||
|
||
The default retention count is 10 versions, with a valid range of v1 to vN versions. When the retention limit is reached, the oldest version is automatically removed to make space for new one version | ||
|
||
After modifying `opensearch.yml`, restart your OpenSearch cluster for the changes to take effect. For more information, see [Experimental feature flags]({{site.url}}{{site.baseurl}}/install-and-configure/configuring-opensearch/experimental/). | ||
|
||
## Endpoints | ||
|
||
```json | ||
GET /_plugins/_security/api/versions | ||
GET /_plugins/_security/api/version/<version_id> | ||
POST /_plugins/_security/api/version/rollback | ||
POST /_plugins/_security/api/version/rollback/<version_id> | ||
``` | ||
|
||
## Path parameters | ||
|
||
The following table lists the available path parameters. All path parameters are optional. | ||
|
||
| Parameter | Data type | Description | | ||
| :--- | :--- | :--- | | ||
| `version_id` | String | The version identifier to view or roll back to (for example, `v1`, `v2`). Required for specific version operations. | | ||
kolchfa-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## View a specific version | ||
|
||
Use this endpoint to retrieve the complete security configuration for a specified version. | ||
|
||
### Endpoint | ||
|
||
```json | ||
GET /_plugins/_security/api/version/<version_id> | ||
``` | ||
|
||
### Example request | ||
|
||
```json | ||
GET /_plugins/_security/api/version/v2 | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
### Example response | ||
|
||
```json | ||
{ | ||
"versions": [ | ||
{ | ||
"version_id": "v2", | ||
"timestamp": "2025-05-23T06:56:20.081933886Z", | ||
"modified_by": "admin", | ||
"security_configs": {...} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Response body fields | ||
|
||
The following table lists all response body fields for viewing a specific version. | ||
|
||
<!-- fill in the table --> | ||
|
||
| Field | Data type | Description | | ||
|:-----------------|:----------|:------------------------------------------------------------------------------------------| | ||
| versions | Array | Array of security configuration versions | | ||
| version_id | String | Version of security configuration | | ||
| timestamp | Datetime | Timestamp of security configuration change | | ||
Check failure on line 101 in _security/configuration/versioning.md
|
||
| modified_by | String | User who modified security configuration | | ||
| security_configs | String | Security configuration for a particular version. It holds all the security configurations | | ||
|
||
## View all versions | ||
|
||
Use this endpoint to retrieve a list of all available configuration versions. | ||
|
||
### Endpoint | ||
|
||
```json | ||
GET /_plugins/_security/api/versions | ||
``` | ||
|
||
### Example request | ||
|
||
```json | ||
GET /_plugins/_security/api/versions | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
### Example response | ||
|
||
```json | ||
{ | ||
"versions": [ | ||
{ | ||
"version_id": "v1", | ||
"timestamp": "2025-05-22T08:46:11.887620466Z", | ||
"modified_by": "admin", | ||
"security_configs": {...} | ||
}, | ||
{ | ||
"version_id": "v2", | ||
"timestamp": "2025-05-23T06:56:20.081933886Z", | ||
"modified_by": "admin", | ||
"security_configs": {...} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Response body fields | ||
|
||
The following table lists all response body fields for viewing all versions. | ||
|
||
<!-- fill in the table --> | ||
|
||
| Field | Data type | Description | | ||
| :--- | :--- | :--- | | ||
| versions | Array | Array of security configuration versions | | ||
| version_id | String | Version of security configuration | | ||
| timestamp | Datetime | Timestamp of security configuration change | | ||
Check failure on line 153 in _security/configuration/versioning.md
|
||
| modified_by | String | User who modified security configuration | | ||
| security_configs | String | Security configuration for a particular version. It holds all the security configurations | | ||
|
||
## Roll back to previous version | ||
natebower marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Use this endpoint to restore the security configuration to the immediately preceding version. | ||
|
||
### Endpoint | ||
|
||
```json | ||
POST /_plugins/_security/api/version/rollback | ||
``` | ||
|
||
### Example request | ||
|
||
```json | ||
POST /_plugins/_security/api/version/rollback | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
### Example response | ||
|
||
Assuming there are 5 versions and v4 is the preceding version | ||
|
||
```json | ||
{ | ||
"status" : "OK", | ||
"message" : "config rolled back to version v4" | ||
} | ||
``` | ||
|
||
### Response body fields | ||
|
||
The following table lists all response body fields for rollback operations. | ||
|
||
| Field | Data type | Description | | ||
| :--- | :--- | :--- | | ||
| status | String | Rollback status | | ||
| message | String | Description of rollback operation | | ||
|
||
## Roll back to a specific version | ||
|
||
Use this endpoint to restore the security configuration to a specified version. | ||
|
||
### Endpoint | ||
|
||
```json | ||
POST /_plugins/_security/api/version/rollback/<version_id> | ||
``` | ||
|
||
### Example request | ||
|
||
```json | ||
POST /_plugins/_security/api/version/rollback/v2 | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
### Example response | ||
|
||
```json | ||
{ | ||
"status" : "OK", | ||
"message" : "config rolled back to version v2" | ||
} | ||
``` | ||
|
||
### Response body fields | ||
|
||
The following table lists all response body fields for rollback operations. | ||
|
||
| Field | Data type | Description | | ||
|:--------|:----------|:----------------------------------| | ||
| status | String | Rollback status | | ||
| message | String | Description of rollback operation | | ||
|
||
## Required permissions | ||
|
||
Ensure that you have the appropriate permissions for the operations you want to perform. | ||
|
||
| Operation | Required Permission | | ||
Check failure on line 233 in _security/configuration/versioning.md
|
||
| :--- | :--- | | ||
| View versions | `restapi:admin/view_version` | | ||
| Rollback configuration | `restapi:admin/rollback_version` | | ||
|
||
These permissions are included in the default `security_manager` and `all_access` roles. | ||
These API follow same [access control]({{site.url}}{{site.baseurl}}/access-control/api/#access-control-for-the-api) like any other security API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nagarajg17 So the versions must be specified in the form of
vN
or can they be any string?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its like,
v1
,v2
...v10
. It can hold upto maximum number of versions mentioned in this configplugins.security.config_version.retention_count
or default upto to 10 i.ev10