Skip to content

Commit f956168

Browse files
ShourieGelasticsearchmachine
andauthored
[8.18] [ExtraHop][Qualys GAV] - Fix Cannot execute ILM policy delete step (#132387) (#132574)
* [ExtraHop][Qualys GAV] - Fix Cannot execute ILM policy delete step (#132387) This PR focuses on the short term solution which add the logs-extrahop.investigation-* and logs-qualys_gav.asset-* indices under the kibana_system role with deletion privileges to prevent a failed deletion error when the index enters the deletion phase for the ILM lifecycle, in upcoming PRs. (cherry picked from commit 0d7a2cc) * Update KibanaOwnedReservedRoleDescriptors.java added missing imports in KibanaOwnedReservedRoleDescriptors * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]>
1 parent 51622f8 commit f956168

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

docs/changelog/132387.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 132387
2+
summary: "[ExtraHop & QualysGAV] Add `manage`, `create_index`, `read`, `index`, `write`, `delete`, permission for third party agent indices `kibana_system`"
3+
area: Authorization
4+
type: enhancement
5+
issues:
6+
- 131825

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

Lines changed: 18 additions & 0 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;
@@ -460,6 +461,23 @@ static RoleDescriptor kibanaSystem(String name) {
460461
)
461462
.privileges("read", "view_index_metadata")
462463
.build(),
464+
// For ExtraHop and QualysGAV specific actions. Kibana reads, writes and manages this index
465+
// for configured ILM policies.
466+
RoleDescriptor.IndicesPrivileges.builder()
467+
.indices("logs-extrahop.investigation-*", "logs-qualys_gav.asset-*")
468+
.privileges(
469+
"manage",
470+
"create_index",
471+
"read",
472+
"index",
473+
"write",
474+
"delete",
475+
// Require "delete_index" to perform ILM policy actions
476+
TransportDeleteIndexAction.TYPE.name(),
477+
TransportIndicesAliasesAction.NAME,
478+
TransportAutoPutMappingAction.TYPE.name()
479+
)
480+
.build(),
463481
// For alias indices of the Cloud Detection & Response (CDR) packages that ships a
464482
// transform
465483
RoleDescriptor.IndicesPrivileges.builder()

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,47 @@ public void testKibanaSystemRole() {
18251825
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
18261826
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
18271827
});
1828+
1829+
// Tests for third-party agent indices (ExtraHop, QualysGAV) that `kibana_system` has full management access to
1830+
// This includes read, write, create, delete, and all ILM-related management actions.
1831+
Arrays.asList(
1832+
"logs-extrahop.investigation-" + randomAlphaOfLength(randomIntBetween(1, 10)),
1833+
"logs-qualys_gav.asset-" + randomAlphaOfLength(randomIntBetween(1, 10))
1834+
).forEach((index_qualys_extra_hop) -> {
1835+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(index_qualys_extra_hop);
1836+
1837+
// Assert Read Actions (Allowed by "read")
1838+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
1839+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1840+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
1841+
1842+
// Assert Write & Delete Document Actions (Allowed by "write", "index", "delete")
1843+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(true));
1844+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(true));
1845+
// The "update" action is also implicitly part of "write"
1846+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportUpdateAction.NAME).test(indexAbstraction), is(true));
1847+
1848+
// Assert Index Management Actions (Allowed by "create_index", "delete_index", and "manage")
1849+
// Allowed by the explicit "create_index" privilege
1850+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1851+
// Allowed by the explicit TransportDeleteIndexAction
1852+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1853+
1854+
// Allowed due to the "manage" privilege and explicit TransportAutoPutMappingAction
1855+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
1856+
// Allowed due to the explicit TransportIndicesAliasesAction
1857+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndicesAliasesAction.NAME).test(indexAbstraction), is(true));
1858+
// Rollover requires 'manage' on the alias and 'create_index', both of which are granted.
1859+
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1860+
1861+
// Assert Denied Actions
1862+
// This role should not have cross-cluster permissions on these indices
1863+
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
1864+
1865+
// A check against a completely different index should fail
1866+
final IndexAbstraction otherIndex = mockIndexAbstraction("some-unrelated-index");
1867+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(otherIndex), is(false));
1868+
});
18281869
}
18291870

18301871
public void testKibanaAdminRole() {

0 commit comments

Comments
 (0)