Skip to content

Commit 27dbec6

Browse files
committed
Allow built-in monitoring_user role to call GET _xpack API (elastic#38060)
This PR adds the `monitor/xpack/info` cluster-level privilege to the built-in `monitoring_user` role. This privilege is required for the Monitoring UI to call the `GET _xpack API` on the Monitoring Cluster. It needs to do this in order to determine the license of the Monitoring Cluster, which further determines whether Cluster Alerts are shown to the user or not. Resolves elastic#37970.
1 parent cf6c40a commit 27dbec6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private static Map<String, RoleDescriptor> initializeReservedRoles() {
5858
null, null,
5959
MetadataUtils.DEFAULT_RESERVED_METADATA, null))
6060
.put("monitoring_user", new RoleDescriptor("monitoring_user",
61-
new String[] { "cluster:monitor/main" },
61+
new String[] { "cluster:monitor/main", "cluster:monitor/xpack/info" },
6262
new RoleDescriptor.IndicesPrivileges[] {
6363
RoleDescriptor.IndicesPrivileges.builder()
6464
.indices(".monitoring-*").privileges("read", "read_cross_cluster").build()

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.elasticsearch.common.util.set.Sets;
3838
import org.elasticsearch.test.ESTestCase;
3939
import org.elasticsearch.transport.TransportRequest;
40+
import org.elasticsearch.xpack.core.action.XPackInfoAction;
4041
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
4142
import org.elasticsearch.xpack.core.ml.action.CloseJobAction;
4243
import org.elasticsearch.xpack.core.ml.action.DeleteDatafeedAction;
@@ -337,6 +338,7 @@ public void testMonitoringUserRole() {
337338

338339
Role monitoringUserRole = Role.builder(roleDescriptor, null).build();
339340
assertThat(monitoringUserRole.cluster().check(MainAction.NAME, request), is(true));
341+
assertThat(monitoringUserRole.cluster().check(XPackInfoAction.NAME, request), is(true));
340342
assertThat(monitoringUserRole.cluster().check(ClusterHealthAction.NAME, request), is(false));
341343
assertThat(monitoringUserRole.cluster().check(ClusterStateAction.NAME, request), is(false));
342344
assertThat(monitoringUserRole.cluster().check(ClusterStatsAction.NAME, request), is(false));

0 commit comments

Comments
 (0)