Skip to content

Commit 431aac1

Browse files
authored
[ExtraHop][Qualys GAV] - Fix Cannot execute ILM policy delete step (#132387) (#132572)
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 081c8a4 commit 431aac1

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
@@ -481,6 +481,23 @@ static RoleDescriptor kibanaSystem(String name) {
481481
)
482482
.privileges("read", "view_index_metadata")
483483
.build(),
484+
// For ExtraHop and QualysGAV specific actions. Kibana reads, writes and manages this index
485+
// for configured ILM policies.
486+
RoleDescriptor.IndicesPrivileges.builder()
487+
.indices("logs-extrahop.investigation-*", "logs-qualys_gav.asset-*")
488+
.privileges(
489+
"manage",
490+
"create_index",
491+
"read",
492+
"index",
493+
"write",
494+
"delete",
495+
// Require "delete_index" to perform ILM policy actions
496+
TransportDeleteIndexAction.TYPE.name(),
497+
TransportIndicesAliasesAction.NAME,
498+
TransportAutoPutMappingAction.TYPE.name()
499+
)
500+
.build(),
484501
// For alias indices of the Cloud Detection & Response (CDR) packages that ships a
485502
// transform
486503
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
@@ -1843,6 +1843,47 @@ public void testKibanaSystemRole() {
18431843
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
18441844
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
18451845
});
1846+
1847+
// Tests for third-party agent indices (ExtraHop, QualysGAV) that `kibana_system` has full management access to
1848+
// This includes read, write, create, delete, and all ILM-related management actions.
1849+
Arrays.asList(
1850+
"logs-extrahop.investigation-" + randomAlphaOfLength(randomIntBetween(1, 10)),
1851+
"logs-qualys_gav.asset-" + randomAlphaOfLength(randomIntBetween(1, 10))
1852+
).forEach((index_qualys_extra_hop) -> {
1853+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(index_qualys_extra_hop);
1854+
1855+
// Assert Read Actions (Allowed by "read")
1856+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
1857+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1858+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
1859+
1860+
// Assert Write & Delete Document Actions (Allowed by "write", "index", "delete")
1861+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(true));
1862+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(true));
1863+
// The "update" action is also implicitly part of "write"
1864+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportUpdateAction.NAME).test(indexAbstraction), is(true));
1865+
1866+
// Assert Index Management Actions (Allowed by "create_index", "delete_index", and "manage")
1867+
// Allowed by the explicit "create_index" privilege
1868+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1869+
// Allowed by the explicit TransportDeleteIndexAction
1870+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1871+
1872+
// Allowed due to the "manage" privilege and explicit TransportAutoPutMappingAction
1873+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
1874+
// Allowed due to the explicit TransportIndicesAliasesAction
1875+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndicesAliasesAction.NAME).test(indexAbstraction), is(true));
1876+
// Rollover requires 'manage' on the alias and 'create_index', both of which are granted.
1877+
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1878+
1879+
// Assert Denied Actions
1880+
// This role should not have cross-cluster permissions on these indices
1881+
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
1882+
1883+
// A check against a completely different index should fail
1884+
final IndexAbstraction otherIndex = mockIndexAbstraction("some-unrelated-index");
1885+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(otherIndex), is(false));
1886+
});
18461887
}
18471888

18481889
public void testKibanaAdminRole() {

0 commit comments

Comments
 (0)