Versioned Security Configuration Management#5357
Versioned Security Configuration Management#5357shikharj05 merged 17 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Divyanshi Chouksey <divvv@amazon.com>
Signed-off-by: Divyanshi Chouksey <divvv@amazon.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5357 +/- ##
==========================================
+ Coverage 72.33% 72.42% +0.08%
==========================================
Files 384 388 +4
Lines 23820 24177 +357
Branches 3669 3706 +37
==========================================
+ Hits 17231 17509 +278
- Misses 4785 4850 +65
- Partials 1804 1818 +14
🚀 New features to boost your workflow:
|
|
@divyanshi-0402 Thanks for working on this. Maybe this is a good opportunity to change the configuration process to instead add a new version in a single index (Great opportunity to rename our index!) and when loading the configuration the plugin loads specific versions from the set of all changes. For rollback this would mean just changing pointers rather than having to change the data itself. |
|
Here is a diagram showing how we'd move between immutable versions of the configuration. I'll be curious what you think of this approach. flowchart LR
subgraph .security_config
v1["v1"]
v2["v2"]
v3["v3"]
end
Load["Active Security Config"]
%% Initial pointer to v3
Load --> v3
%% Rollback pointer to v2 (dashed red)
Load -. rollback .-> v2
%% Style the rollback link
linkStyle 1 stroke:#f66,stroke-width:2px,stroke-dasharray:5,5
|
src/main/java/org/opensearch/security/configuration/SecurityConfigDiffCalculator.java
Outdated
Show resolved
Hide resolved
|
Thank you for the PR @divyanshi-0402 ! I will take a pass shortly and provide some comments. On a high-level, I think we should store the diffs instead of the full snapshots as there would be a lot of redundant information stored for each snapshot of the security config for small changes. I believe that's how collaborative word editors work where they keep track of the diffs in order to implement undo and redo without having to keep snapshots of the document being edited. For clusters where the security index is small, snapshots may be performant but we should design this regardless of the size of the security index and support cases where the security index could contain MBs of data with more frequent changes. The audit log does have capability to keep track of diffs to the security index using the |
shikharj05
left a comment
There was a problem hiding this comment.
Thanks for the work @divyanshi-0402 ! Some general comments-
JavaDoc on the classes will be helpful; add comments in places there is custom logic to retain, delete, sort, etc. Add more coverage for tests :)
You should also update the README file with this new feature - this will help to understand what the feature does and how it can be used.
Similarly, add Changelog entry as well.
src/main/java/org/opensearch/security/support/ConfigConstants.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/support/ConfigConstants.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionsLoader.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Outdated
Show resolved
Hide resolved
Storing the diffs/incremental changes can be helpful to reduce storage overhead. I think for now allowing users to configure versions to retain is also a good start. One problem with just storing diffs is that it would require more logic to restore versions or for users to look at different versions of the security config. For example, for a search request on the index that stores versions, this would mean using the current config and adding/removing configs (replay the changes) to show a meaningful response OR maybe showing the diff is okay for now. I think the current mindset is to support versioning of configs - however, we should allow customers to enable this and dynamically change number of versions to store. |
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Outdated
Show resolved
Hide resolved
@peternied Thanks for you suggestions! |
Signed-off-by: Divyanshi Chouksey <divvv@amazon.com>
Signed-off-by: Divyanshi Chouksey <77962346+divyanshi-0402@users.noreply.github.com>
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionsLoader.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionsLoader.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/support/ConfigConstants.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Divyanshi Chouksey <divvv@amazon.com>
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/configuration/SecurityConfigVersionHandler.java
Show resolved
Hide resolved
|
One question: In the PR description, you describe your manual testing steps. Could you give also the specs of the cluster on which you did the manual testing? Especially, I would be interested in the number of nodes in the cluster. |
|
couple of high-level questions- (let me know if you have already addressed these elsewhere)
|
Signed-off-by: Divyanshi Chouksey <77962346+divyanshi-0402@users.noreply.github.com>
Signed-off-by: Divyanshi Chouksey <divvv@amazon.com>
We have tested in a single node cluster, will be doing testing with multiple nodes as well. |
|
cwperks
left a comment
There was a problem hiding this comment.
@divyanshi-0402 thank you for replying to and addressing the feedback in a timely manner.
I think any outstanding comments can be addressed in a follow-up PR.
To be honest, IMHO, a multi node test is absolutely essential, especially if there are no integration tests. |
+1, Thanks @divyanshi-0402! Can you or @nagarajg17 create a GH issue to keep track of pending comments/changes/follow-ups etc? |
|
@shikharj05, @cwperks, @nibix Tracking the follow up items here #5407 |
|
Test details for multi-node testing: Created two nodes : node 1 : node 2 : Updated Security Configurations from node 1 : Fetched users from node 2 : |
Signed-off-by: Divyanshi Chouksey <divvv@amazon.com> Signed-off-by: Divyanshi Chouksey <77962346+divyanshi-0402@users.noreply.github.com> Co-authored-by: Divyanshi Chouksey <divvv@amazon.com> Co-authored-by: Jialiang Liang <ryanleeang@gmail.com> Co-authored-by: Darshit Chanpura <dchanp@amazon.com> Signed-off-by: Aiden Lindsay <aiden.o.lindsay@gmail.com>
Signed-off-by: Divyanshi Chouksey <divvv@amazon.com> Signed-off-by: Divyanshi Chouksey <77962346+divyanshi-0402@users.noreply.github.com> Co-authored-by: Divyanshi Chouksey <divvv@amazon.com> Co-authored-by: Jialiang Liang <ryanleeang@gmail.com> Co-authored-by: Darshit Chanpura <dchanp@amazon.com> Signed-off-by: Aiden Lindsay <aiden.o.lindsay@gmail.com>
Description
Implementing a comprehensive versioning system for the OpenSearch security index. This system will enable rollback and roll-forward capabilities, provide a history of changes, and allow administrators to easily view and select specific configurations from the past.
New System Index: Introduce a dedicated system index named
.opendistro_security_config_versionsto store versioned security configurations.Versioning Mechanism:
Updated Security Config Update Flow: Modify the existing security configuration update process to
.opendistro_security_config_versionsindexIndex status with 10 security config versions :
green open .opendistro_security_config_versions 4Hvxs5KOST6gN2YtFNHlZg 1 0 1 0 60.1kb 60.1kbIndex Structure :
Issues Resolved
Related to #5093
Testing
Manual Testing :
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.