Skip to content

Commit 3452656

Browse files
authored
[ExtraHop][Qualys GAV] - Fix Cannot execute ILM policy delete step (#132387) (#132573)
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)
1 parent e24d9e2 commit 3452656

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,23 @@ static RoleDescriptor kibanaSystem(String name) {
483483
)
484484
.privileges("read", "view_index_metadata")
485485
.build(),
486+
// For ExtraHop and QualysGAV specific actions. Kibana reads, writes and manages this index
487+
// for configured ILM policies.
488+
RoleDescriptor.IndicesPrivileges.builder()
489+
.indices("logs-extrahop.investigation-*", "logs-qualys_gav.asset-*")
490+
.privileges(
491+
"manage",
492+
"create_index",
493+
"read",
494+
"index",
495+
"write",
496+
"delete",
497+
// Require "delete_index" to perform ILM policy actions
498+
TransportDeleteIndexAction.TYPE.name(),
499+
TransportIndicesAliasesAction.NAME,
500+
TransportAutoPutMappingAction.TYPE.name()
501+
)
502+
.build(),
486503
// For alias indices of the Cloud Detection & Response (CDR) packages that ships a
487504
// transform
488505
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
@@ -1856,6 +1856,47 @@ public void testKibanaSystemRole() {
18561856
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
18571857
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
18581858
});
1859+
1860+
// Tests for third-party agent indices (ExtraHop, QualysGAV) that `kibana_system` has full management access to
1861+
// This includes read, write, create, delete, and all ILM-related management actions.
1862+
Arrays.asList(
1863+
"logs-extrahop.investigation-" + randomAlphaOfLength(randomIntBetween(1, 10)),
1864+
"logs-qualys_gav.asset-" + randomAlphaOfLength(randomIntBetween(1, 10))
1865+
).forEach((index_qualys_extra_hop) -> {
1866+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(index_qualys_extra_hop);
1867+
1868+
// Assert Read Actions (Allowed by "read")
1869+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
1870+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1871+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
1872+
1873+
// Assert Write & Delete Document Actions (Allowed by "write", "index", "delete")
1874+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(true));
1875+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(true));
1876+
// The "update" action is also implicitly part of "write"
1877+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportUpdateAction.NAME).test(indexAbstraction), is(true));
1878+
1879+
// Assert Index Management Actions (Allowed by "create_index", "delete_index", and "manage")
1880+
// Allowed by the explicit "create_index" privilege
1881+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1882+
// Allowed by the explicit TransportDeleteIndexAction
1883+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1884+
1885+
// Allowed due to the "manage" privilege and explicit TransportAutoPutMappingAction
1886+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
1887+
// Allowed due to the explicit TransportIndicesAliasesAction
1888+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndicesAliasesAction.NAME).test(indexAbstraction), is(true));
1889+
// Rollover requires 'manage' on the alias and 'create_index', both of which are granted.
1890+
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1891+
1892+
// Assert Denied Actions
1893+
// This role should not have cross-cluster permissions on these indices
1894+
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
1895+
1896+
// A check against a completely different index should fail
1897+
final IndexAbstraction otherIndex = mockIndexAbstraction("some-unrelated-index");
1898+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(otherIndex), is(false));
1899+
});
18591900
}
18601901

18611902
public void testKibanaAdminRole() {

0 commit comments

Comments
 (0)