Skip to content

Commit

Permalink
Adding "read ingest pipeline" cluster privilege
Browse files Browse the repository at this point in the history
The new privilege will allow to run ingest tools with minimal
privilege to check whether a
pipeline exists, without being able to modify it.
This privilege also support simulate pipeline too since it is a readonly
 operation.

 Resolve elastic#48028
  • Loading branch information
BigPandaToo committed Dec 9, 2020
1 parent c76058d commit 1d38ed9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ public static class ClusterPrivilegeName {
public static final String MANAGE_ROLLUP = "manage_rollup";
public static final String MANAGE_INDEX_TEMPLATES = "manage_index_templates";
public static final String MANAGE_INGEST_PIPELINES = "manage_ingest_pipelines";
public static final String READ_INGEST_PIPELINES = "read_ingest_pipelines";
public static final String TRANSPORT_CLIENT = "transport_client";
public static final String MANAGE_SECURITY = "manage_security";
public static final String MANAGE_SAML = "manage_saml";
Expand All @@ -326,9 +327,9 @@ public static class ClusterPrivilegeName {
public static final String MANAGE_ENRICH = "manage_enrich";
public static final String[] ALL_ARRAY = new String[] { NONE, ALL, MONITOR, MONITOR_TRANSFORM_DEPRECATED, MONITOR_TRANSFORM,
MONITOR_ML, MONITOR_WATCHER, MONITOR_ROLLUP, MANAGE, MANAGE_TRANSFORM_DEPRECATED, MANAGE_TRANSFORM,
MANAGE_ML, MANAGE_WATCHER, MANAGE_ROLLUP, MANAGE_INDEX_TEMPLATES, MANAGE_INGEST_PIPELINES, TRANSPORT_CLIENT,
MANAGE_SECURITY, MANAGE_SAML, MANAGE_OIDC, MANAGE_TOKEN, MANAGE_PIPELINE, MANAGE_AUTOSCALING, MANAGE_CCR, READ_CCR,
MANAGE_ILM, READ_ILM, MANAGE_ENRICH };
MANAGE_ML, MANAGE_WATCHER, MANAGE_ROLLUP, MANAGE_INDEX_TEMPLATES, MANAGE_INGEST_PIPELINES, READ_INGEST_PIPELINES,
TRANSPORT_CLIENT, MANAGE_SECURITY, MANAGE_SAML, MANAGE_OIDC, MANAGE_TOKEN, MANAGE_PIPELINE, MANAGE_AUTOSCALING, MANAGE_CCR,
READ_CCR, MANAGE_ILM, READ_ILM, MANAGE_ENRICH };
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class GetPipelineAction extends ActionType<GetPipelineResponse> {

public static final GetPipelineAction INSTANCE = new GetPipelineAction();
public static final String NAME = "cluster:admin/ingest/pipeline/get";
public static final String NAME = "cluster:monitor/ingest/pipeline/get";

public GetPipelineAction() {
super(NAME, GetPipelineResponse::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class SimulatePipelineAction extends ActionType<SimulatePipelineResponse> {

public static final SimulatePipelineAction INSTANCE = new SimulatePipelineAction();
public static final String NAME = "cluster:admin/ingest/pipeline/simulate";
public static final String NAME = "cluster:monitor/ingest/pipeline/simulate";

public SimulatePipelineAction() {
super(NAME, SimulatePipelineResponse::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ A successful call returns an object with "cluster" and "index" fields.
"none",
"read",
"read_cross_cluster",
"read_ingest_pipelines",
"view_index_metadata",
"write"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public class ClusterPrivilegeResolver {
private static final Set<String> TRANSPORT_CLIENT_PATTERN = Set.of("cluster:monitor/nodes/liveness", "cluster:monitor/state");
private static final Set<String> MANAGE_IDX_TEMPLATE_PATTERN = Set.of("indices:admin/template/*", "indices:admin/index_template/*",
"cluster:admin/component_template/*");
private static final Set<String> MANAGE_INGEST_PIPELINE_PATTERN = Set.of("cluster:admin/ingest/pipeline/*");
private static final Set<String> MANAGE_INGEST_PIPELINE_PATTERN = Set.of("cluster:admin/ingest/pipeline/*",
"cluster:monitor/ingest/pipeline/*");
private static final Set<String> READ_INGEST_PIPELINE_PATTERN = Set.of("cluster:monitor/ingest/pipeline/*");
private static final Set<String> MANAGE_ROLLUP_PATTERN = Set.of("cluster:admin/xpack/rollup/*", "cluster:monitor/xpack/rollup/*");
private static final Set<String> MANAGE_CCR_PATTERN =
Set.of("cluster:admin/xpack/ccr/*", ClusterStateAction.NAME, HasPrivilegesAction.NAME);
Expand Down Expand Up @@ -104,6 +106,8 @@ public class ClusterPrivilegeResolver {
new ActionClusterPrivilege("manage_index_templates", MANAGE_IDX_TEMPLATE_PATTERN);
public static final NamedClusterPrivilege MANAGE_INGEST_PIPELINES =
new ActionClusterPrivilege("manage_ingest_pipelines", MANAGE_INGEST_PIPELINE_PATTERN);
public static final NamedClusterPrivilege READ_INGEST_PIPELINES =
new ActionClusterPrivilege("read_ingest_pipelines", READ_INGEST_PIPELINE_PATTERN);
public static final NamedClusterPrivilege TRANSPORT_CLIENT = new ActionClusterPrivilege("transport_client",
TRANSPORT_CLIENT_PATTERN);
public static final NamedClusterPrivilege MANAGE_SECURITY = new ActionClusterPrivilege("manage_security", ALL_SECURITY_PATTERN,
Expand All @@ -113,7 +117,7 @@ public class ClusterPrivilegeResolver {
public static final NamedClusterPrivilege MANAGE_API_KEY = new ActionClusterPrivilege("manage_api_key", MANAGE_API_KEY_PATTERN);
public static final NamedClusterPrivilege GRANT_API_KEY = new ActionClusterPrivilege("grant_api_key", GRANT_API_KEY_PATTERN);
public static final NamedClusterPrivilege MANAGE_PIPELINE = new ActionClusterPrivilege("manage_pipeline", Set.of("cluster:admin" +
"/ingest/pipeline/*"));
"/ingest/pipeline/*", "cluster:monitor/ingest/pipeline/*"));
public static final NamedClusterPrivilege MANAGE_AUTOSCALING = new ActionClusterPrivilege(
"manage_autoscaling",
Set.of("cluster:admin/autoscaling/*")
Expand Down Expand Up @@ -152,6 +156,7 @@ public class ClusterPrivilegeResolver {
MANAGE_WATCHER,
MANAGE_IDX_TEMPLATES,
MANAGE_INGEST_PIPELINES,
READ_INGEST_PIPELINES,
TRANSPORT_CLIENT,
MANAGE_SECURITY,
MANAGE_SAML,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public class Constants {
"cluster:admin/indices/dangling/import",
"cluster:admin/indices/dangling/list",
"cluster:admin/ingest/pipeline/delete",
"cluster:admin/ingest/pipeline/get",
"cluster:admin/ingest/pipeline/put",
"cluster:admin/ingest/pipeline/simulate",
"cluster:admin/ingest/processor/grok/get",
"cluster:admin/logstash/pipeline/delete",
"cluster:admin/logstash/pipeline/get",
Expand Down Expand Up @@ -213,6 +211,8 @@ public class Constants {
"cluster:monitor/data_frame/get",
"cluster:monitor/data_frame/stats/get",
"cluster:monitor/health",
"cluster:monitor/ingest/pipeline/get",
"cluster:monitor/ingest/pipeline/simulate",
"cluster:monitor/main",
"cluster:monitor/nodes/hot_threads",
"cluster:monitor/nodes/info",
Expand Down

0 comments on commit 1d38ed9

Please sign in to comment.