Skip to content

Commit abb1c56

Browse files
authored
Allow built-in monitoring_user role to call GET _xpack API (#38220)
Backport of #38060 to `6.6`. Original description: 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 #37970. <!-- Thank you for your interest in and contributing to Elasticsearch! There are a few simple things to check before submitting your pull request that can help with the review process. You should delete these items from your submission, but they are here to help bring them to your attention. --> - Have you signed the [contributor license agreement](https://www.elastic.co/contributor-agreement)? - Have you followed the [contributor guidelines](https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md)? - If submitting code, have you built your formula locally prior to submission with `gradle check`? - If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed. - If submitting code, have you checked that your submission is for an [OS that we support](https://www.elastic.co/support/matrix#show_os)? - If you are submitting this code for a class then read our [policy](https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md#contributing-as-part-of-a-class) for that.
1 parent cf6c40a commit abb1c56

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

+1-1
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

+2
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)