Skip to content

Commit d34479e

Browse files
authored
[ExtraHop][Qualys GAV] - Fix Cannot execute ILM policy delete step (#132387) (#132571)
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 d06fc0a commit d34479e

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
@@ -519,6 +519,23 @@ static RoleDescriptor kibanaSystem(String name) {
519519
)
520520
.privileges("read", "view_index_metadata")
521521
.build(),
522+
// For ExtraHop and QualysGAV specific actions. Kibana reads, writes and manages this index
523+
// for configured ILM policies.
524+
RoleDescriptor.IndicesPrivileges.builder()
525+
.indices("logs-extrahop.investigation-*", "logs-qualys_gav.asset-*")
526+
.privileges(
527+
"manage",
528+
"create_index",
529+
"read",
530+
"index",
531+
"write",
532+
"delete",
533+
// Require "delete_index" to perform ILM policy actions
534+
TransportDeleteIndexAction.TYPE.name(),
535+
TransportIndicesAliasesAction.NAME,
536+
TransportAutoPutMappingAction.TYPE.name()
537+
)
538+
.build(),
522539
// For alias indices of the Cloud Detection & Response (CDR) packages that ships a
523540
// transform
524541
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
@@ -1877,6 +1877,47 @@ public void testKibanaSystemRole() {
18771877
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
18781878
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
18791879
});
1880+
1881+
// Tests for third-party agent indices (ExtraHop, QualysGAV) that `kibana_system` has full management access to
1882+
// This includes read, write, create, delete, and all ILM-related management actions.
1883+
Arrays.asList(
1884+
"logs-extrahop.investigation-" + randomAlphaOfLength(randomIntBetween(1, 10)),
1885+
"logs-qualys_gav.asset-" + randomAlphaOfLength(randomIntBetween(1, 10))
1886+
).forEach((index_qualys_extra_hop) -> {
1887+
final IndexAbstraction indexAbstraction = mockIndexAbstraction(index_qualys_extra_hop);
1888+
1889+
// Assert Read Actions (Allowed by "read")
1890+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(indexAbstraction), is(true));
1891+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(indexAbstraction), is(true));
1892+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(indexAbstraction), is(true));
1893+
1894+
// Assert Write & Delete Document Actions (Allowed by "write", "index", "delete")
1895+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(indexAbstraction), is(true));
1896+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(indexAbstraction), is(true));
1897+
// The "update" action is also implicitly part of "write"
1898+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportUpdateAction.NAME).test(indexAbstraction), is(true));
1899+
1900+
// Assert Index Management Actions (Allowed by "create_index", "delete_index", and "manage")
1901+
// Allowed by the explicit "create_index" privilege
1902+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1903+
// Allowed by the explicit TransportDeleteIndexAction
1904+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(indexAbstraction), is(true));
1905+
1906+
// Allowed due to the "manage" privilege and explicit TransportAutoPutMappingAction
1907+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportPutMappingAction.TYPE.name()).test(indexAbstraction), is(true));
1908+
// Allowed due to the explicit TransportIndicesAliasesAction
1909+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportIndicesAliasesAction.NAME).test(indexAbstraction), is(true));
1910+
// Rollover requires 'manage' on the alias and 'create_index', both of which are granted.
1911+
assertThat(kibanaRole.indices().allowedIndicesMatcher(RolloverAction.NAME).test(indexAbstraction), is(true));
1912+
1913+
// Assert Denied Actions
1914+
// This role should not have cross-cluster permissions on these indices
1915+
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(indexAbstraction), is(false));
1916+
1917+
// A check against a completely different index should fail
1918+
final IndexAbstraction otherIndex = mockIndexAbstraction("some-unrelated-index");
1919+
assertThat(kibanaRole.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(otherIndex), is(false));
1920+
});
18801921
}
18811922

18821923
public void testKibanaAdminRole() {

0 commit comments

Comments
 (0)