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. Co-authored-by: William Brafford <williamrandolphbrafford@gmail.com>
This commit is contained in:
parent
64bbbaeef1
commit
15edc39d9b
|
@ -74,6 +74,7 @@ A successful call returns an object with "cluster" and "index" fields.
|
||||||
"manage_ilm",
|
"manage_ilm",
|
||||||
"manage_index_templates",
|
"manage_index_templates",
|
||||||
"manage_ingest_pipelines",
|
"manage_ingest_pipelines",
|
||||||
|
"manage_logstash_pipelines",
|
||||||
"manage_ml",
|
"manage_ml",
|
||||||
"manage_oidc",
|
"manage_oidc",
|
||||||
"manage_own_api_key",
|
"manage_own_api_key",
|
||||||
|
|
|
@ -88,7 +88,8 @@ Grants access to all features in {kib}. For more information on {kib} authorizat
|
||||||
see {kibana-ref}/xpack-security-authorization.html[Kibana authorization].
|
see {kibana-ref}/xpack-security-authorization.html[Kibana authorization].
|
||||||
|
|
||||||
[[built-in-roles-logstash-admin]] `logstash_admin` ::
|
[[built-in-roles-logstash-admin]] `logstash_admin` ::
|
||||||
Grants access to the `.logstash*` indices for managing configurations.
|
Grants access to the `.logstash*` indices for managing configurations, and grants
|
||||||
|
necessary access for logstash-specific APIs exposed by the logstash x-pack plugin.
|
||||||
|
|
||||||
[[built-in-roles-logstash-system]] `logstash_system` ::
|
[[built-in-roles-logstash-system]] `logstash_system` ::
|
||||||
Grants access necessary for the Logstash system user to send system-level data
|
Grants access necessary for the Logstash system user to send system-level data
|
||||||
|
|
|
@ -59,6 +59,9 @@ All operations on index templates.
|
||||||
`manage_ingest_pipelines`::
|
`manage_ingest_pipelines`::
|
||||||
All operations on ingest node pipelines.
|
All operations on ingest node pipelines.
|
||||||
|
|
||||||
|
`manage_logstash_pipelines`::
|
||||||
|
All operations on logstash pipelines.
|
||||||
|
|
||||||
`manage_ml`::
|
`manage_ml`::
|
||||||
All {ml} operations, such as creating and deleting {dfeeds}, jobs, and model
|
All {ml} operations, such as creating and deleting {dfeeds}, jobs, and model
|
||||||
snapshots.
|
snapshots.
|
||||||
|
|
|
@ -141,6 +141,9 @@ public class ClusterPrivilegeResolver {
|
||||||
public static final NamedClusterPrivilege MANAGE_OWN_API_KEY = ManageOwnApiKeyClusterPrivilege.INSTANCE;
|
public static final NamedClusterPrivilege MANAGE_OWN_API_KEY = ManageOwnApiKeyClusterPrivilege.INSTANCE;
|
||||||
public static final NamedClusterPrivilege MANAGE_ENRICH = new ActionClusterPrivilege("manage_enrich", MANAGE_ENRICH_AUTOMATON);
|
public static final NamedClusterPrivilege MANAGE_ENRICH = new ActionClusterPrivilege("manage_enrich", MANAGE_ENRICH_AUTOMATON);
|
||||||
|
|
||||||
|
public static final NamedClusterPrivilege MANAGE_LOGSTASH_PIPELINES = new ActionClusterPrivilege("manage_logstash_pipelines",
|
||||||
|
Collections.unmodifiableSet(Sets.newHashSet("cluster:admin/logstash/pipeline/*")));
|
||||||
|
|
||||||
private static final Map<String, NamedClusterPrivilege> VALUES = Collections.unmodifiableMap(
|
private static final Map<String, NamedClusterPrivilege> VALUES = Collections.unmodifiableMap(
|
||||||
Stream.of(
|
Stream.of(
|
||||||
NONE,
|
NONE,
|
||||||
|
@ -178,7 +181,8 @@ public class ClusterPrivilegeResolver {
|
||||||
READ_SLM,
|
READ_SLM,
|
||||||
DELEGATE_PKI,
|
DELEGATE_PKI,
|
||||||
MANAGE_OWN_API_KEY,
|
MANAGE_OWN_API_KEY,
|
||||||
MANAGE_ENRICH).collect(Collectors.toMap(cp -> cp.name(), cp -> cp)));
|
MANAGE_ENRICH,
|
||||||
|
MANAGE_LOGSTASH_PIPELINES).collect(Collectors.toMap(cp -> cp.name(), cp -> cp)));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves a {@link NamedClusterPrivilege} from a given name if it exists.
|
* Resolves a {@link NamedClusterPrivilege} from a given name if it exists.
|
||||||
|
|
|
@ -273,7 +273,8 @@ public class ReservedRolesStore implements BiConsumer<Set<String>, ActionListene
|
||||||
RoleDescriptor.IndicesPrivileges.builder().indices(HistoryStoreField.INDEX_PREFIX + "*")
|
RoleDescriptor.IndicesPrivileges.builder().indices(HistoryStoreField.INDEX_PREFIX + "*")
|
||||||
.privileges("read")
|
.privileges("read")
|
||||||
.build() }, null, MetadataUtils.DEFAULT_RESERVED_METADATA))
|
.build() }, null, MetadataUtils.DEFAULT_RESERVED_METADATA))
|
||||||
.put("logstash_admin", new RoleDescriptor("logstash_admin", null, new RoleDescriptor.IndicesPrivileges[] {
|
.put("logstash_admin", new RoleDescriptor("logstash_admin", new String[] {"manage_logstash_pipelines"},
|
||||||
|
new RoleDescriptor.IndicesPrivileges[] {
|
||||||
RoleDescriptor.IndicesPrivileges.builder().indices(".logstash*")
|
RoleDescriptor.IndicesPrivileges.builder().indices(".logstash*")
|
||||||
.privileges("create", "delete", "index", "manage", "read").build() },
|
.privileges("create", "delete", "index", "manage", "read").build() },
|
||||||
null, MetadataUtils.DEFAULT_RESERVED_METADATA))
|
null, MetadataUtils.DEFAULT_RESERVED_METADATA))
|
||||||
|
|
|
@ -1656,6 +1656,10 @@ public class ReservedRolesStoreTests extends ESTestCase {
|
||||||
assertThat(logstashAdminRole.cluster().check(ClusterUpdateSettingsAction.NAME, request, authentication), is(false));
|
assertThat(logstashAdminRole.cluster().check(ClusterUpdateSettingsAction.NAME, request, authentication), is(false));
|
||||||
assertThat(logstashAdminRole.cluster().check(DelegatePkiAuthenticationAction.NAME, request, authentication), is(false));
|
assertThat(logstashAdminRole.cluster().check(DelegatePkiAuthenticationAction.NAME, request, authentication), is(false));
|
||||||
|
|
||||||
|
assertThat(logstashAdminRole.cluster().check("cluster:admin/logstash/pipeline/delete", request, authentication), is(true));
|
||||||
|
assertThat(logstashAdminRole.cluster().check("cluster:admin/logstash/pipeline/get", request, authentication), is(true));
|
||||||
|
assertThat(logstashAdminRole.cluster().check("cluster:admin/logstash/pipeline/put", request, authentication), is(true));
|
||||||
|
|
||||||
assertThat(logstashAdminRole.runAs().check(randomAlphaOfLengthBetween(1, 30)), is(false));
|
assertThat(logstashAdminRole.runAs().check(randomAlphaOfLengthBetween(1, 30)), is(false));
|
||||||
|
|
||||||
assertThat(logstashAdminRole.indices().allowedIndicesMatcher(IndexAction.NAME).test(mockIndexAbstraction("foo")), is(false));
|
assertThat(logstashAdminRole.indices().allowedIndicesMatcher(IndexAction.NAME).test(mockIndexAbstraction("foo")), is(false));
|
||||||
|
|
|
@ -15,5 +15,5 @@ setup:
|
||||||
# This is fragile - it needs to be updated every time we add a new cluster/index privilege
|
# This is fragile - it needs to be updated every time we add a new cluster/index privilege
|
||||||
# I would much prefer we could just check that specific entries are in the array, but we don't have
|
# I would much prefer we could just check that specific entries are in the array, but we don't have
|
||||||
# an assertion for that
|
# an assertion for that
|
||||||
- length: { "cluster" : 36 }
|
- length: { "cluster" : 37 }
|
||||||
- length: { "index" : 19 }
|
- length: { "index" : 19 }
|
||||||
|
|
Loading…
Reference in New Issue