Skip to content

Commit 9e5b51b

Browse files
committed
Add {m365_defender,microsoft_defender_endpoint}.vulnerability indices to kibana_system role permissions (elastic#132445)
Add logs-m365_defender.vulnerability-* and logs-microsoft_defender_endpoint.vulnerability-* data stream indices to the kibana_system's read privileges. This is required for the latest transform for 3rd party integrations CDR workflows (vulnerability findings) to work. Also add delete_index on logs-m365_defender.vulnerability-* and logs-microsoft_defender_endpoint.vulnerability-* to facilitate index removal through ILM policies. (cherry picked from commit 716bff8) # Conflicts: # x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/KibanaOwnedReservedRoleDescriptors.java
1 parent 51622f8 commit 9e5b51b

File tree

2 files changed

+150
-12
lines changed

2 files changed

+150
-12
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/KibanaOwnedReservedRoleDescriptors.java

Lines changed: 116 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
1111
import org.elasticsearch.action.admin.indices.delete.TransportDeleteIndexAction;
12+
import org.elasticsearch.action.admin.indices.mapping.put.TransportAutoPutMappingAction;
1213
import org.elasticsearch.action.admin.indices.mapping.put.TransportPutMappingAction;
1314
import org.elasticsearch.action.admin.indices.rollover.RolloverAction;
1415
import org.elasticsearch.action.admin.indices.settings.put.TransportUpdateSettingsAction;
@@ -99,14 +100,16 @@ static RoleDescriptor kibanaSystem(String name) {
99100
// The symbolic constant for this one is in SecurityActionMapper, so not
100101
// accessible from X-Pack core
101102
"cluster:admin/analyze",
103+
"cluster:admin/script/put",
104+
"cluster:admin/script/get",
102105
// To facilitate using the file uploader functionality
103106
"monitor_text_structure",
104107
// To cancel tasks and delete async searches
105108
"cancel_task" },
106109
new RoleDescriptor.IndicesPrivileges[] {
107110
// System indices defined in KibanaPlugin
108111
RoleDescriptor.IndicesPrivileges.builder()
109-
.indices(".kibana*", ".reporting-*")
112+
.indices(".kibana*", ".reporting-*", ".chat-*")
110113
.privileges("all")
111114
.allowRestrictedIndices(true)
112115
.build(),
@@ -160,8 +163,11 @@ static RoleDescriptor kibanaSystem(String name) {
160163
// Data telemetry reads mappings, metadata and stats of indices
161164
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges("view_index_metadata", "monitor").build(),
162165
// Endpoint diagnostic information. Kibana reads from these indices to send
163-
// telemetry
164-
RoleDescriptor.IndicesPrivileges.builder().indices(".logs-endpoint.diagnostic.collection-*").privileges("read").build(),
166+
// telemetry and also creates the index when policies are first created
167+
RoleDescriptor.IndicesPrivileges.builder()
168+
.indices(".logs-endpoint.diagnostic.collection-*")
169+
.privileges("read", "create_index")
170+
.build(),
165171
// Fleet secrets. Kibana can only write to this index.
166172
RoleDescriptor.IndicesPrivileges.builder()
167173
.indices(".fleet-secrets*")
@@ -219,12 +225,19 @@ static RoleDescriptor kibanaSystem(String name) {
219225
.privileges("all")
220226
.allowRestrictedIndices(true)
221227
.build(),
228+
// Fleet writes to this datastream for Agent status alerting feature
229+
RoleDescriptor.IndicesPrivileges.builder().indices("logs-elastic_agent.status_change-*").privileges("all").build(),
222230
// Fleet telemetry queries Agent Logs indices in kibana task runner
223231
RoleDescriptor.IndicesPrivileges.builder().indices("logs-elastic_agent*").privileges("read").build(),
224232
// Fleet publishes Agent metrics in kibana task runner
225233
RoleDescriptor.IndicesPrivileges.builder().indices("metrics-fleet_server*").privileges("all").build(),
226234
// Fleet reads output health from this index pattern
227235
RoleDescriptor.IndicesPrivileges.builder().indices("logs-fleet_server*").privileges("read", "delete_index").build(),
236+
// Fleet creates and writes this index for sync integrations feature
237+
RoleDescriptor.IndicesPrivileges.builder()
238+
.indices("fleet-synced-integrations", "fleet-synced-integrations-ccr*")
239+
.privileges("create_index", "manage", "read", "write")
240+
.build(),
228241
// Legacy "Alerts as data" used in Security Solution.
229242
// Kibana user creates these indices; reads / writes to them.
230243
RoleDescriptor.IndicesPrivileges.builder()
@@ -254,6 +267,26 @@ static RoleDescriptor kibanaSystem(String name) {
254267
// Observability, etc.
255268
// Kibana system user uses them to read / write alerts.
256269
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.ALERTS_INDEX_ALIAS).privileges("all").build(),
270+
// "Cases as data" analytics indexes and aliases
271+
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.CASES_ANALYTICS_INDEXES).privileges("all").build(),
272+
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.CASES_ANALYTICS_ALIASES).privileges("all").build(),
273+
// "Alerts as data" public index alias used in Security Solution
274+
// Kibana system user uses them to read / write alerts.
275+
RoleDescriptor.IndicesPrivileges.builder()
276+
.indices(ReservedRolesStore.ADHOC_ALERTS_BACKING_INDEX, ReservedRolesStore.ADHOC_ALERTS_INDEX_ALIAS)
277+
.privileges(
278+
"create_index",
279+
"read",
280+
"write",
281+
"view_index_metadata",
282+
"maintenance",
283+
RolloverAction.NAME,
284+
TransportIndicesAliasesAction.NAME,
285+
TransportPutMappingAction.TYPE.name(),
286+
TransportAutoPutMappingAction.TYPE.name(),
287+
TransportUpdateSettingsAction.TYPE.name()
288+
)
289+
.build(),
257290
// "Alerts as data" public index alias used in Security Solution
258291
// Kibana system user uses them to read / write alerts.
259292
RoleDescriptor.IndicesPrivileges.builder().indices(ReservedRolesStore.PREVIEW_ALERTS_INDEX_ALIAS).privileges("all").build(),
@@ -296,17 +329,19 @@ static RoleDescriptor kibanaSystem(String name) {
296329
)
297330
.build(),
298331
// Endpoint specific action responses. Kibana reads and writes (for third party
299-
// agents) to the index
300-
// to display action responses to the user.
332+
// agents) to the index to display action responses to the user.
333+
// `create_index`: is necessary in order to ensure that the DOT datastream index is
334+
// created by Kibana in order to avoid errors on the Elastic Defend side when streaming
335+
// documents to it.
301336
RoleDescriptor.IndicesPrivileges.builder()
302337
.indices(".logs-endpoint.action.responses-*")
303-
.privileges("auto_configure", "read", "write")
338+
.privileges("auto_configure", "read", "write", "create_index")
304339
.build(),
305340
// Endpoint specific actions. Kibana reads and writes to this index to track new
306341
// actions and display them.
307342
RoleDescriptor.IndicesPrivileges.builder()
308343
.indices(".logs-endpoint.actions-*")
309-
.privileges("auto_configure", "read", "write")
344+
.privileges("auto_configure", "read", "write", "create_index")
310345
.build(),
311346
// Legacy Osquery manager specific action responses. Kibana reads from these to
312347
// display responses to the user.
@@ -334,14 +369,19 @@ static RoleDescriptor kibanaSystem(String name) {
334369
// ingested by Fleet integrations
335370
// in order to provide support for response actions related to malicious events
336371
// for such agents.
337-
RoleDescriptor.IndicesPrivileges.builder().indices("logs-sentinel_one.*", "logs-crowdstrike.*").privileges("read").build(),
372+
RoleDescriptor.IndicesPrivileges.builder()
373+
.indices("logs-sentinel_one.*", "logs-crowdstrike.*", "logs-microsoft_defender_endpoint.*", "logs-m365_defender.*")
374+
.privileges("read")
375+
.build(),
338376
// For ILM policy for APM, Endpoint, & Synthetics packages that have delete
339377
// action
340378
RoleDescriptor.IndicesPrivileges.builder()
341379
.indices(
342380
".logs-endpoint.diagnostic.collection-*",
343381
"logs-apm-*",
344382
"logs-apm.*-*",
383+
"logs-cloud_security_posture.findings-*",
384+
"logs-cloud_security_posture.vulnerabilities-*",
345385
"metrics-apm-*",
346386
"metrics-apm.*-*",
347387
"traces-apm-*",
@@ -426,18 +466,37 @@ static RoleDescriptor kibanaSystem(String name) {
426466
RoleDescriptor.IndicesPrivileges.builder()
427467
.indices(
428468
"logs-cloud_security_posture.findings_latest-default*",
429-
"logs-cloud_security_posture.scores-default*",
430469
"logs-cloud_security_posture.vulnerabilities_latest-default*"
431470
)
432471
.privileges(
433472
"create_index",
434473
"read",
435474
"index",
436475
"delete",
476+
477+
// Require "delete_index" to perform ILM policy actions
478+
TransportDeleteIndexAction.TYPE.name(),
479+
"manage",
437480
TransportIndicesAliasesAction.NAME,
438481
TransportUpdateSettingsAction.TYPE.name()
439482
)
440483
.build(),
484+
// For destination indices of the Cloud Security Posture packages that ships a
485+
// transform (specific for scores indexes, as of 9.0.0 score indices will need to have auto_put priviliges)
486+
RoleDescriptor.IndicesPrivileges.builder()
487+
.indices("logs-cloud_security_posture.scores-default*")
488+
.privileges(
489+
"create_index",
490+
"read",
491+
"index",
492+
"delete",
493+
// Require "delete_index" to perform ILM policy actions
494+
TransportDeleteIndexAction.TYPE.name(),
495+
TransportIndicesAliasesAction.NAME,
496+
TransportUpdateSettingsAction.TYPE.name(),
497+
TransportAutoPutMappingAction.TYPE.name()
498+
)
499+
.build(),
441500
// For source indices of the Cloud Detection & Response (CDR) packages that ships a
442501
// transform
443502
RoleDescriptor.IndicesPrivileges.builder()
@@ -460,12 +519,40 @@ static RoleDescriptor kibanaSystem(String name) {
460519
)
461520
.privileges("read", "view_index_metadata")
462521
.build(),
522+
// For source indices of the Cloud Detection & Response (CDR) packages
523+
// that ships a transform and has ILM policy
524+
RoleDescriptor.IndicesPrivileges.builder()
525+
.indices("logs-m365_defender.vulnerability-*", "logs-microsoft_defender_endpoint.vulnerability-*")
526+
.privileges(
527+
"read",
528+
"view_index_metadata",
529+
// Require "delete_index" to perform ILM policy actions
530+
TransportDeleteIndexAction.TYPE.name()
531+
)
532+
.build(),
533+
// For ExtraHop and QualysGAV specific actions. Kibana reads, writes and manages this index
534+
// for configured ILM policies.
535+
RoleDescriptor.IndicesPrivileges.builder()
536+
.indices("logs-extrahop.investigation-*", "logs-qualys_gav.asset-*")
537+
.privileges(
538+
"manage",
539+
"create_index",
540+
"read",
541+
"index",
542+
"write",
543+
"delete",
544+
// Require "delete_index" to perform ILM policy actions
545+
TransportDeleteIndexAction.TYPE.name(),
546+
TransportIndicesAliasesAction.NAME,
547+
TransportAutoPutMappingAction.TYPE.name()
548+
)
549+
.build(),
463550
// For alias indices of the Cloud Detection & Response (CDR) packages that ships a
464551
// transform
465552
RoleDescriptor.IndicesPrivileges.builder()
466553
// manage privilege required by the index alias
467554
.indices("security_solution-*.vulnerability_latest", "security_solution-*.misconfiguration_latest")
468-
.privileges("manage", TransportIndicesAliasesAction.NAME, TransportUpdateSettingsAction.TYPE.name())
555+
.privileges("manage", "read", TransportIndicesAliasesAction.NAME, TransportUpdateSettingsAction.TYPE.name())
469556
.build(),
470557
// For destination indices of the Cloud Detection & Response (CDR) packages that ships a
471558
// transform
@@ -483,11 +570,12 @@ static RoleDescriptor kibanaSystem(String name) {
483570
.build(),
484571
// security entity analytics indices
485572
RoleDescriptor.IndicesPrivileges.builder().indices("risk-score.risk-*").privileges("all").build(),
573+
RoleDescriptor.IndicesPrivileges.builder().indices(".entity_analytics.*").privileges("all").build(),
486574
RoleDescriptor.IndicesPrivileges.builder()
487575
.indices(".asset-criticality.asset-criticality-*")
488576
.privileges("create_index", "manage", "read", "write")
489577
.build(),
490-
RoleDescriptor.IndicesPrivileges.builder().indices(".entities.v1.latest.security*").privileges("read").build(),
578+
RoleDescriptor.IndicesPrivileges.builder().indices(".entities.v1.latest.security*").privileges("read", "write").build(),
491579
// For cloud_defend usageCollection
492580
RoleDescriptor.IndicesPrivileges.builder()
493581
.indices("logs-cloud_defend.*", "metrics-cloud_defend.*")
@@ -498,7 +586,23 @@ static RoleDescriptor kibanaSystem(String name) {
498586
RoleDescriptor.IndicesPrivileges.builder().indices(".slo-observability.*").privileges("all").build(),
499587
// Endpoint heartbeat. Kibana reads from these to determine metering/billing for
500588
// endpoints.
501-
RoleDescriptor.IndicesPrivileges.builder().indices(".logs-endpoint.heartbeat-*").privileges("read").build(),
589+
RoleDescriptor.IndicesPrivileges.builder().indices(".logs-endpoint.heartbeat-*").privileges("read", "create_index").build(),
590+
// Security Solution workflows insights. Kibana creates, manages, and uses these
591+
// to provide users with insights on potential configuration improvements
592+
RoleDescriptor.IndicesPrivileges.builder()
593+
.indices(".edr-workflow-insights-*")
594+
.privileges(
595+
"create_index",
596+
"auto_configure",
597+
"manage",
598+
"read",
599+
"write",
600+
"delete",
601+
TransportUpdateSettingsAction.TYPE.name(),
602+
TransportPutMappingAction.TYPE.name(),
603+
RolloverAction.NAME
604+
)
605+
.build(),
502606
// For connectors telemetry. Will be removed once we switched to connectors API
503607
RoleDescriptor.IndicesPrivileges.builder().indices(".elastic-connectors*").privileges("read").build() },
504608
null,

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,40 @@ public void testKibanaSystemRole() {
16601660
);
16611661
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
16621662
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1663+
// Implied by the overall view_index_metadata and monitor privilege
1664+
assertViewIndexMetadata(kibanaRole, indexName);
1665+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:monitor/").test(indexAbstraction), is(true));
1666+
});
1667+
1668+
Arrays.asList(
1669+
"logs-m365_defender.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13)),
1670+
"logs-microsoft_defender_endpoint.vulnerability-" + randomAlphaOfLength(randomIntBetween(0, 13))
1671+
).forEach(indexName -> {
1672+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(indexName);
1673+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(indexAbstraction), is(false));
1674+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(indexAbstraction), is(false));
1675+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1676+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
1677+
assertThat(
1678+
kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction),
1679+
is(false)
1680+
);
1681+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(false));
1682+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(false));
1683+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1684+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportMultiSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1685+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
1686+
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
1687+
assertThat(
1688+
kibanaRole.indices().allowedIndicesMatcher(TransportUpdateSettingsAction.TYPE.name()).test(indexAbstraction),
1689+
is(true)
1690+
);
1691+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
1692+
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1693+
// Implied by the overall view_index_metadata and monitor privilege
1694+
assertViewIndexMetadata(kibanaRole, indexName);
1695+
assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:monitor/").test(indexAbstraction), is(true));
1696+
16631697
});
16641698

16651699
Arrays.asList(

0 commit comments

Comments
 (0)