Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Granting kibana_system reserved role access to read from .logs-endpoint.diagnostic.collection-* #66135

Merged

Conversation

kobelb
Copy link
Contributor

@kobelb kobelb commented Dec 9, 2020

The endpoint protections team is storing diagnostic information in the .logs-endpoint.diagnostic.collection-* indices, which Kibana will read from to send the data to the remote telemetry service.

Resolves elastic/kibana#85391

@kobelb
Copy link
Contributor Author

kobelb commented Dec 9, 2020

/cc @tsg

@kobelb kobelb changed the title Granting kibana_system reserved role access to read from logs-endpoint.diagnostic.collection-* Granting kibana_system reserved role access to read from .logs-endpoint.diagnostic.collection-* Dec 14, 2020
@kobelb kobelb marked this pull request as ready for review December 14, 2020 16:38
@kobelb kobelb requested a review from a team December 14, 2020 16:38
@albertzaharovits
Copy link
Contributor

LGTM, but can you also please add a simple unit test?:

diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java
index 8d26c8c25d6..e0da06d1de7 100644
--- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java
+++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java
@@ -34,6 +34,7 @@ import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateActio
 import org.elasticsearch.action.bulk.BulkAction;
 import org.elasticsearch.action.delete.DeleteAction;
 import org.elasticsearch.action.get.GetAction;
+import org.elasticsearch.action.get.MultiGetAction;
 import org.elasticsearch.action.index.IndexAction;
 import org.elasticsearch.action.ingest.DeletePipelineAction;
 import org.elasticsearch.action.ingest.GetPipelineAction;
@@ -462,6 +463,23 @@ public class ReservedRolesStoreTests extends ESTestCase {
             assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(mockIndexAbstraction(index)), is(true));
         });

+        // read-only indices for APM telemetry
+        Arrays.asList(".logs-endpoint.diagnostic.collection-" + randomAlphaOfLengthBetween(0, 4)).forEach((index) -> {
+            assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:foo").test(mockIndexAbstraction(index)), is(false));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher("indices:bar").test(mockIndexAbstraction(index)), is(false));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(DeleteIndexAction.NAME).test(mockIndexAbstraction(index)), is(false));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(GetIndexAction.NAME).test(mockIndexAbstraction(index)), is(true));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(CreateIndexAction.NAME).test(mockIndexAbstraction(index)), is(false));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(IndexAction.NAME).test(mockIndexAbstraction(index)), is(false));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(DeleteAction.NAME).test(mockIndexAbstraction(index)), is(false));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(UpdateSettingsAction.NAME).test(mockIndexAbstraction(index)), is(false));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(SearchAction.NAME).test(mockIndexAbstraction(index)), is(true));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(MultiSearchAction.NAME).test(mockIndexAbstraction(index)), is(true));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(GetAction.NAME).test(mockIndexAbstraction(index)), is(true));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(MultiGetAction.NAME).test(mockIndexAbstraction(index)), is(true));
+            assertThat(kibanaRole.indices().allowedIndicesMatcher(READ_CROSS_CLUSTER_NAME).test(mockIndexAbstraction(index)), is(false));
+        });
+
         // Data telemetry reads mappings, metadata and stats of indices
         Arrays.asList(randomAlphaOfLengthBetween(8, 24), "packetbeat-*", "logs-*").forEach((index) -> {
             logger.info("index name [{}]", index);

@kobelb
Copy link
Contributor Author

kobelb commented Dec 14, 2020

LGTM, but can you also please add a simple unit test?:

Absolutely, test coming shortly!

@elasticmachine elasticmachine added the Team:Security Meta label for security team label Dec 16, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@albertzaharovits albertzaharovits merged commit c88a2b2 into elastic:master Dec 16, 2020
albertzaharovits pushed a commit to albertzaharovits/elasticsearch that referenced this pull request Dec 16, 2020
…int.diagnostic.collection-*` (elastic#66135)

The endpoint protections team is storing diagnostic information
in the .logs-endpoint.diagnostic.collection-* indices, which Kibana
will read from to send the data to the remote telemetry service.

Resolves elastic/kibana#85391
albertzaharovits added a commit that referenced this pull request Dec 16, 2020
…nt.diagnostic.collection-*` (#66135)

The endpoint protections team is storing diagnostic information
in the .logs-endpoint.diagnostic.collection-* indices, which Kibana
will read from to send the data to the remote telemetry service.

Resolves elastic/kibana#85391

Co-authored-by: Brandon Kobel <brandon.kobel@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Security Meta label for security team v7.11.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add read permissions to the Kibana system user for the diagnostic telemetry
4 participants