Skip to content

Commit 1e741e8

Browse files
Update logstash_admin role for system indices (#63368)
This PR updates the `logstash_admin` role to include the recently-added Logstash Pipeline Management APIs, as well as access to the `.logstash*` index pattern.
1 parent 0ad2d6c commit 1e741e8

File tree

7 files changed

+32
-18
lines changed

7 files changed

+32
-18
lines changed

x-pack/docs/en/rest-api/security/get-builtin-privileges.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ A successful call returns an object with "cluster" and "index" fields.
7474
"manage_ilm",
7575
"manage_index_templates",
7676
"manage_ingest_pipelines",
77+
"manage_logstash_pipelines",
7778
"manage_ml",
7879
"manage_oidc",
7980
"manage_own_api_key",

x-pack/docs/en/security/authorization/built-in-roles.asciidoc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Grants access necessary for the APM system user to send system-level data
1515
(such as monitoring) to {es}.
1616

1717
[[built-in-roles-apm-user]] `apm_user` ::
18-
Grants the privileges required for APM users (such as `read` and
18+
Grants the privileges required for APM users (such as `read` and
1919
`view_index_metadata` privileges on the `apm-*` and `.ml-anomalies*` indices).
2020

2121
[[built-in-roles-beats-admin]] `beats_admin` ::
@@ -27,7 +27,7 @@ Grants access necessary for the Beats system user to send system-level data
2727
(such as monitoring) to {es}.
2828
+
2929
--
30-
[NOTE]
30+
[NOTE]
3131
===============================
3232
* This role should not be assigned to users as the granted permissions may
3333
change between releases.
@@ -60,12 +60,12 @@ NOTE: This role does *not* provide the ability to create indices; those privileg
6060
must be defined in a separate role.
6161

6262
[[built-in-roles-kibana-dashboard]] `kibana_dashboard_only_user` ::
63-
(This role is deprecated, please use
63+
(This role is deprecated, please use
6464
{kibana-ref}/kibana-privileges.html#kibana-feature-privileges[{kib} feature privileges]
6565
instead).
66-
Grants read-only access to the {kib} Dashboard in every
66+
Grants read-only access to the {kib} Dashboard in every
6767
{kibana-ref}/xpack-spaces.html[space in {kib}].
68-
This role does not have access to editing tools in {kib}.
68+
This role does not have access to editing tools in {kib}.
6969

7070
[[built-in-roles-kibana-system]] `kibana_system` ::
7171
Grants access necessary for the {kib} system user to read from and write to the
@@ -88,15 +88,16 @@ Grants access to all features in {kib}. For more information on {kib} authorizat
8888
see {kibana-ref}/xpack-security-authorization.html[Kibana authorization].
8989

9090
[[built-in-roles-logstash-admin]] `logstash_admin` ::
91-
Grants access to the `.logstash*` indices for managing configurations.
91+
Grants access to the `.logstash*` indices for managing configurations, and grants
92+
necessary access for logstash-specific APIs exposed by the logstash x-pack plugin.
9293

9394
[[built-in-roles-logstash-system]] `logstash_system` ::
9495
Grants access necessary for the Logstash system user to send system-level data
9596
(such as monitoring) to {es}. For more information, see
9697
{logstash-ref}/ls-security.html[Configuring Security in Logstash].
9798
+
9899
--
99-
[NOTE]
100+
[NOTE]
100101
===============================
101102
* This role should not be assigned to users as the granted permissions may
102103
change between releases.
@@ -131,17 +132,17 @@ with {kibana-ref}/xpack-security-authorization.html[access to the {kib} instance
131132

132133
[[built-in-roles-remote-monitoring-agent]] `remote_monitoring_agent`::
133134
Grants the minimum privileges required to write data into the monitoring indices
134-
(`.monitoring-*`). This role also has the privileges necessary to create
135-
{metricbeat} indices (`metricbeat-*`) and write data into them.
135+
(`.monitoring-*`). This role also has the privileges necessary to create
136+
{metricbeat} indices (`metricbeat-*`) and write data into them.
136137

137138
[[built-in-roles-remote-monitoring-collector]] `remote_monitoring_collector`::
138139
Grants the minimum privileges required to collect monitoring data for the {stack}.
139140

140141
[[built-in-roles-reporting-user]] `reporting_user`::
141142
Grants the specific privileges required for users of {reporting} other than those
142-
required to use {kib}. This role grants access to the reporting indices; each
143+
required to use {kib}. This role grants access to the reporting indices; each
143144
user has access to only their own reports.
144-
Reporting users should also be assigned additional roles that grant
145+
Reporting users should also be assigned additional roles that grant
145146
{kibana-ref}/xpack-security-authorization.html[access to {kib}] as well as read
146147
access to the <<roles-indices-priv,indices>> that will be used to generate reports.
147148

@@ -158,13 +159,13 @@ the `superuser` role can also manage users and roles and
158159
<<run-as-privilege, impersonate>> any other user in the system. Due to the
159160
permissive nature of this role, take extra care when assigning it to a user.
160161

161-
[[built-in-roles-transform-admin]] `transform_admin`::
162-
Grants `manage_transform` cluster privileges, which enable you to manage
163-
{transforms}. This role also includes all
162+
[[built-in-roles-transform-admin]] `transform_admin`::
163+
Grants `manage_transform` cluster privileges, which enable you to manage
164+
{transforms}. This role also includes all
164165
{kibana-ref}/kibana-privileges.html[Kibana privileges] for the {ml-features}.
165166

166167
[[built-in-roles-transform-user]] `transform_user`::
167-
Grants `monitor_transform` cluster privileges, which enable you to use
168+
Grants `monitor_transform` cluster privileges, which enable you to use
168169
{transforms}. This role also includes all
169170
{kibana-ref}/kibana-privileges.html[Kibana privileges] for the {ml-features}.
170171

x-pack/docs/en/security/authorization/privileges.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ All operations on index templates.
5959
`manage_ingest_pipelines`::
6060
All operations on ingest node pipelines.
6161

62+
`manage_logstash_pipelines`::
63+
All operations on logstash pipelines.
64+
6265
`manage_ml`::
6366
All {ml} operations, such as creating and deleting {dfeeds}, jobs, and model
6467
snapshots.

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/ClusterPrivilegeResolver.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ public class ClusterPrivilegeResolver {
131131
public static final NamedClusterPrivilege MANAGE_OWN_API_KEY = ManageOwnApiKeyClusterPrivilege.INSTANCE;
132132
public static final NamedClusterPrivilege MANAGE_ENRICH = new ActionClusterPrivilege("manage_enrich", MANAGE_ENRICH_AUTOMATON);
133133

134+
public static final NamedClusterPrivilege MANAGE_LOGSTASH_PIPELINES = new ActionClusterPrivilege("manage_logstash_pipelines",
135+
Set.of("cluster:admin/logstash/pipeline/*"));
136+
134137
private static final Map<String, NamedClusterPrivilege> VALUES = Stream.of(
135138
NONE,
136139
ALL,
@@ -167,7 +170,8 @@ public class ClusterPrivilegeResolver {
167170
READ_SLM,
168171
DELEGATE_PKI,
169172
MANAGE_OWN_API_KEY,
170-
MANAGE_ENRICH).collect(Collectors.toUnmodifiableMap(NamedClusterPrivilege::name, Function.identity()));
173+
MANAGE_ENRICH,
174+
MANAGE_LOGSTASH_PIPELINES).collect(Collectors.toUnmodifiableMap(NamedClusterPrivilege::name, Function.identity()));
171175

172176
/**
173177
* Resolves a {@link NamedClusterPrivilege} from a given name if it exists.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ private static Map<String, RoleDescriptor> initializeReservedRoles() {
273273
RoleDescriptor.IndicesPrivileges.builder().indices(HistoryStoreField.INDEX_PREFIX + "*")
274274
.privileges("read")
275275
.build() }, null, MetadataUtils.DEFAULT_RESERVED_METADATA))
276-
.put("logstash_admin", new RoleDescriptor("logstash_admin", null, new RoleDescriptor.IndicesPrivileges[] {
276+
.put("logstash_admin", new RoleDescriptor("logstash_admin", new String[] {"manage_logstash_pipelines"},
277+
new RoleDescriptor.IndicesPrivileges[] {
277278
RoleDescriptor.IndicesPrivileges.builder().indices(".logstash*")
278279
.privileges("create", "delete", "index", "manage", "read").build() },
279280
null, MetadataUtils.DEFAULT_RESERVED_METADATA))

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,10 @@ public void testLogstashAdminRole() {
16561656
assertThat(logstashAdminRole.cluster().check(ClusterUpdateSettingsAction.NAME, request, authentication), is(false));
16571657
assertThat(logstashAdminRole.cluster().check(DelegatePkiAuthenticationAction.NAME, request, authentication), is(false));
16581658

1659+
assertThat(logstashAdminRole.cluster().check("cluster:admin/logstash/pipeline/delete", request, authentication), is(true));
1660+
assertThat(logstashAdminRole.cluster().check("cluster:admin/logstash/pipeline/get", request, authentication), is(true));
1661+
assertThat(logstashAdminRole.cluster().check("cluster:admin/logstash/pipeline/put", request, authentication), is(true));
1662+
16591663
assertThat(logstashAdminRole.runAs().check(randomAlphaOfLengthBetween(1, 30)), is(false));
16601664

16611665
assertThat(logstashAdminRole.indices().allowedIndicesMatcher(IndexAction.NAME).test(mockIndexAbstraction("foo")), is(false));

x-pack/plugin/src/test/resources/rest-api-spec/test/privileges/11_builtin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ setup:
1515
# This is fragile - it needs to be updated every time we add a new cluster/index privilege
1616
# I would much prefer we could just check that specific entries are in the array, but we don't have
1717
# an assertion for that
18-
- length: { "cluster" : 36 }
18+
- length: { "cluster" : 37 }
1919
- length: { "index" : 19 }

0 commit comments

Comments
 (0)