Add new setting for standby_mode to allow replicating security configuration (system) indices#92
Open
cwperks wants to merge 5 commits into
Open
Add new setting for standby_mode to allow replicating security configuration (system) indices#92cwperks wants to merge 5 commits into
cwperks wants to merge 5 commits into
Conversation
…uration (system) indices Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <craig5008@gmail.com>
Signed-off-by: Craig Perkins <craig5008@gmail.com>
Signed-off-by: Craig Perkins <craig5008@gmail.com>
Signed-off-by: Craig Perkins <craig5008@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a
plugins.security.standby_modesetting that enables the security plugin to operate in a read-only standby mode, designed for disaster recovery (DR) architectures where a follower cluster receives replicated security configuration via Cross-Cluster Replication (CCR).Background: Current CCR does not support system indices (indices starting with
.). A companion change to the CCR plugin removes this restriction for the Security index path. However, even with that restriction lifted, the security plugin needs to be aware that it is operating as a follower: it should not bootstrap its own security index, should not accept config mutations, and should refresh its caches from the replicated index.This PR also includes the Security-side transport and authorization support needed for actual CCR replication of
.opendistro_security. CCR bootstrap restore can create the follower shard before the security config documents are available; the documents may arrive through CCR replay shortly afterward. Security therefore needs a narrow pre-initialization path for both CCR restore and CCR replay so the replicated config can land before Security has initialized.What standby mode does:
/_plugins/_security/api/*) with a clear 403 response: "Security configuration is read-only because this cluster is in standby mode."ConfigUpdateActionbroadcastplugins.security.standby_modevalue, so a follower cluster can be promoted by disabling standby mode without restarting nodesCCR replicated system index handling:
opensearch.ccr.replicated_system_index = <exact index name>SystemIndexRegistryRestoreSnapshotRequestfor the exact marked registered system indexindices:data/write/plugins/replication/changesfor the exact marked registered system indexThis avoids adding a broad allowlist for dot indices or arbitrary system indices. The source of truth remains plugin system-index registration.
Setting:
plugins.security.standby_mode(boolean, defaultfalse, dynamic, sensitive)Promotion workflow:
plugins.security.standby_mode: falsevia the cluster settings APIRelated work:
Changes
ConfigConstants.javaSECURITY_STANDBY_MODEconstant plus CCR replicated-system-index marker/header constantsStandbyModeSetting.javaplugins.security.standby_mode, shared by standby enforcement pathsOpenSearchSecurityPlugin.javaAbstractApiAction.javaSecurityApiDependencies.java/SecurityRestApiActions.javaConfigurationRepository.javaSecurityInterceptor.javaSecurityRequestHandler.javaSecurityFilter.javaSystemIndexAccessEvaluator.javaPrivilegesEvaluatorImpl.javaThreadContext; next-gen evaluator preserves system-index protections except for marked standby CCR access; both use the current standby mode valueStandbyModeSettingTest.javaConfigurationRepositoryTest.javaStandbyModeTests.javaStandbyModeCcrSimulationTests.javaTesting
StandbyModeTests— single cluster with standby mode enabled, verifies API behaviorStandbyModeCcrSimulationTests— two clusters (leader + standby), simulates CCR by copying security config documents from leader to standby's security index, verifies standby detects and loads the replicated configStandbyModeSettingTest— verifiesplugins.security.standby_modeupdates are tracked dynamicallyConfigurationRepositoryTest— verifies security-index initialization behavior follows the current standby mode valueLocal validation with the companion CCR branch also passed:
The CCR integration test verifies actual
.opendistro_securityreplication into a standby follower cluster and confirms Security initializes from the replicated config.Additional focused validation for dynamic standby mode:
Future Work
standby_modeto a core cluster-level setting (cluster.standby_mode) that all plugins can respectCheck 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.