Skip to content

Commit 988748f

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 51791f9 commit 988748f

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
@@ -55,7 +55,7 @@ private static Map<String, RoleDescriptor> initializeReservedRoles() {
5555
null, null,
5656
MetadataUtils.DEFAULT_RESERVED_METADATA, null))
5757
.put("monitoring_user", new RoleDescriptor("monitoring_user",
58-
new String[] { "cluster:monitor/main" },
58+
new String[] { "cluster:monitor/main", "cluster:monitor/xpack/info" },
5959
new RoleDescriptor.IndicesPrivileges[] {
6060
RoleDescriptor.IndicesPrivileges.builder()
6161
.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
@@ -47,6 +47,7 @@
4747
import org.elasticsearch.common.util.set.Sets;
4848
import org.elasticsearch.test.ESTestCase;
4949
import org.elasticsearch.transport.TransportRequest;
50+
import org.elasticsearch.xpack.core.action.XPackInfoAction;
5051
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
5152
import org.elasticsearch.xpack.core.ml.action.CloseJobAction;
5253
import org.elasticsearch.xpack.core.ml.action.DeleteCalendarAction;
@@ -416,6 +417,7 @@ public void testMonitoringUserRole() {
416417

417418
Role monitoringUserRole = Role.builder(roleDescriptor, null).build();
418419
assertThat(monitoringUserRole.cluster().check(MainAction.NAME, request), is(true));
420+
assertThat(monitoringUserRole.cluster().check(XPackInfoAction.NAME, request), is(true));
419421
assertThat(monitoringUserRole.cluster().check(ClusterHealthAction.NAME, request), is(false));
420422
assertThat(monitoringUserRole.cluster().check(ClusterStateAction.NAME, request), is(false));
421423
assertThat(monitoringUserRole.cluster().check(ClusterStatsAction.NAME, request), is(false));

0 commit comments

Comments
 (0)