Skip to content
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

[Enhancement] Use System index registry from the core to determine if a request matches system indices #4535

Closed
cwperks opened this issue Jul 9, 2024 · 8 comments
Assignees
Labels
enhancement New feature or request roadmap triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable. v2.17.0 Issues targeting release v2.17.0

Comments

@cwperks
Copy link
Member

cwperks commented Jul 9, 2024

Currently, the security plugin uses an opensearch setting to track the list of system index patterns in the cluster. To enable system index protection requires a cluster admin to configure the following settings:

plugins.security.system_indices.enabled: true
plugins.security.system_indices.indices: [".apm-custom-link", ".opensearch_dashboards", ".apm-agent-configuration", ".opensearch_dashboards_*", ".reporting-*", ".plugins-ml-config", ".plugins-ml-connector", ".plugins-ml-model-group", ".plugins-ml-model", ".plugins-ml-task", ".plugins-ml-conversation-meta", ".plugins-ml-conversation-interactions", ".opendistro-alerting-config", ".opendistro-alerting-alert*", ".opendistro-anomaly-results*", ".opendistro-anomaly-detector*", ".opendistro-anomaly-checkpoints", ".opendistro-anomaly-detection-state", ".opendistro-reports-*", ".opensearch-notifications-*", ".opensearch-notebooks", ".opensearch-observability", ".ql-datasources", ".opendistro-asynchronous-search-response*", ".replication-metadata-store", ".opensearch-knn-models", ".geospatial-ip2geo-data*"]

For concrete indices matching these patterns, the security plugin gives special protections that forbid regular users (including admin) from performing operations on these indices like writing to the index or deleting the index. The integrity of system indices is important for cluster operations and these indices are not meant to be meddled with by regular users.

OpenSearch core provides an extension point called SystemIndexPlugin that is intended for plugins that define system index patterns. In effect, this extension point creates a registry of system indices that is known to the core. Only a subset of default plugins that create system indices currently use the extension point.

Currently, the security plugin does not utilize this registry to determine if an incoming request contains indices that match system indices and instead relies on the configured setting.

The security plugin should take advantage of the system index registry in core to determine if a request matches system indices. This will have an advantage of plugin teams not needing to create an additional PR to the security plugin, but will also have a formal mapping from <plugin> -> Set<String> systemIndexPatterns which will help towards #4439 which is seeking to provide better system index protection in the plugin ecosystem.

@cwperks cwperks added enhancement New feature or request untriaged Require the attention of the repository maintainers and may need to be prioritized labels Jul 9, 2024
@cwperks
Copy link
Member Author

cwperks commented Jul 9, 2024

A couple of questions to look into further:

  • Do all nodes of the cluster need to have the same set of plugins installed?
  • If some nodes only have a subset of plugins installed, then how can all nodes be aware of all system index patterns that have been registered?

@DarshitChanpura
Copy link
Member

  • Do all nodes of the cluster need to have the same set of plugins installed?
  • If some nodes only have a subset of plugins installed, then how can all nodes be aware of all system index patterns that have been registered?

Is there an efficient way to form a "union" set of plugin's system indices across all nodes?

@shikharj05
Copy link
Contributor

Do all nodes of the cluster need to have the same set of plugins installed?

I don't think this is a requirement today.

If some nodes only have a subset of plugins installed, then how can all nodes be aware of all system index patterns that have been registered?

If a plugin registering a system index is not present on one of the nodes, the index won't be treated as system index on that node and hence this could lead to bad/unexpected behavior. For now, it might be okay to document this behavior and such plugins would still need to leverage plugins.security.system_indices.indices: setting, wdyt?

@cwperks
Copy link
Member Author

cwperks commented Jul 10, 2024

For now, it might be okay to document this behavior and such plugins would still need to leverage plugins.security.system_indices.indices: setting, wdyt?

That's what I was thinking as well. I will update our developer documentation and corresponding pages on the documentation website to accurately reflect what this setting does to provide protection to system indices for plugins in the cluster.

@cwperks
Copy link
Member Author

cwperks commented Jul 10, 2024

Is there an efficient way to form a "union" set of plugin's system indices across all nodes?

We could potentially use the cluster state to keep track of the primary list

@cwperks cwperks self-assigned this Jul 11, 2024
@shikharj05
Copy link
Contributor

We could potentially use the cluster state to keep track of the primary list

This could potentially explode the cluster state by a lot. For e.g. consider a 100/500 node cluster with 30 plugins running.

@cwperks cwperks added v2.16.0 Issues targeting release v2.16.0 triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable. and removed untriaged Require the attention of the repository maintainers and may need to be prioritized labels Jul 15, 2024
@cwperks
Copy link
Member Author

cwperks commented Jul 18, 2024

All PRs associated with this issue have now been merged. Closing the issue.

@cwperks cwperks closed this as completed Jul 18, 2024
@cwperks cwperks added v2.17.0 Issues targeting release v2.17.0 and removed v2.16.0 Issues targeting release v2.16.0 labels Aug 2, 2024
@cwperks
Copy link
Member Author

cwperks commented Aug 2, 2024

Removing 2.16 label and adding 2.17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request roadmap triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable. v2.17.0 Issues targeting release v2.17.0
Projects
None yet
Development

No branches or pull requests

4 participants