Skip to content

Commit 1e60b28

Browse files
tvernumjaymode
authored andcommitted
Grant .tasks access to kibana_system role (#35573)
Kibana now uses the tasks API to manage automatic reindexing of the .kibana index during upgrades. The implementation of the tasks API requires that 1. the user executing the task can create & write to the ".tasks" index 2. the user checking on the status of the task can read (Get) the relevant document from the ".tasks" index
1 parent 2d948a0 commit 1e60b28

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ private static Map<String, RoleDescriptor> initializeReservedRoles() {
118118
RoleDescriptor.IndicesPrivileges.builder()
119119
.indices(".monitoring-*").privileges("read", "read_cross_cluster").build(),
120120
RoleDescriptor.IndicesPrivileges.builder()
121-
.indices(".management-beats").privileges("create_index", "read", "write").build()
121+
.indices(".management-beats").privileges("create_index", "read", "write").build(),
122+
RoleDescriptor.IndicesPrivileges.builder()
123+
.indices(".tasks").privileges("create_index", "read", "create").build()
122124
},
123125
null,
124126
new ConditionalClusterPrivilege[] { new ManageApplicationPrivileges(Collections.singleton("kibana-*")) },

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsAction;
1212
import org.elasticsearch.action.admin.cluster.state.ClusterStateAction;
1313
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsAction;
14+
import org.elasticsearch.action.admin.indices.close.CloseIndexAction;
1415
import org.elasticsearch.action.admin.indices.create.CreateIndexAction;
1516
import org.elasticsearch.action.admin.indices.delete.DeleteIndexAction;
1617
import org.elasticsearch.action.admin.indices.get.GetIndexAction;
18+
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction;
1719
import org.elasticsearch.action.admin.indices.recovery.RecoveryAction;
1820
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsAction;
1921
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateAction;
@@ -277,6 +279,18 @@ public void testKibanaSystemRole() {
277279
assertThat(kibanaRole.indices().allowedIndicesMatcher(MultiSearchAction.NAME).test(index), is(true));
278280
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetAction.NAME).test(index), is(true));
279281
assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(index), is(false));
282+
283+
// Tasks index
284+
final String taskIndex = org.elasticsearch.tasks.TaskResultsService.TASK_INDEX;
285+
// Things that kibana_system *should* be able to do
286+
assertThat(kibanaRole.indices().allowedIndicesMatcher(CreateIndexAction.NAME).test(taskIndex), is(true));
287+
assertThat(kibanaRole.indices().allowedIndicesMatcher(PutMappingAction.NAME).test(taskIndex), is(true));
288+
assertThat(kibanaRole.indices().allowedIndicesMatcher(IndexAction.NAME).test(taskIndex), is(true));
289+
assertThat(kibanaRole.indices().allowedIndicesMatcher(GetAction.NAME).test(taskIndex), is(true));
290+
// Things that kibana_system *should not* be able to do
291+
assertThat(kibanaRole.indices().allowedIndicesMatcher(DeleteIndexAction.NAME).test(taskIndex), is(false));
292+
assertThat(kibanaRole.indices().allowedIndicesMatcher(DeleteAction.NAME).test(taskIndex), is(false));
293+
assertThat(kibanaRole.indices().allowedIndicesMatcher(CloseIndexAction.NAME).test(taskIndex), is(false));
280294
}
281295

282296
public void testKibanaUserRole() {

0 commit comments

Comments
 (0)