Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions x-pack/docs/en/rest-api/security/get-service-accounts.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ GET /_security/service/elastic/fleet-server
],
"allow_restricted_indices": false
},
{
"names" : [
"traces-apm.sampled-*"
],
"privileges" : [
"read",
"write",
"monitor",
"create_index",
"auto_configure",
"maintenance"
],
"allow_restricted_indices": false
},
{
"names": [
".fleet-*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ public class ServiceAccountIT extends ESRestTestCase {
],
"allow_restricted_indices": false
},
{
"names": [
"traces-apm.sampled-*"
],
"privileges": [
"read",
"write",
"monitor",
"create_index",
"auto_configure",
"maintenance"
],
"allow_restricted_indices": false
},
{
"names": [
".fleet-*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ final class ElasticServiceAccounts {
)
.privileges("write", "create_index", "auto_configure")
.build(),
RoleDescriptor.IndicesPrivileges.builder()
// APM Server (and hence Fleet Server, which issues its API Keys) needs additional privileges
// for the non-sensitive "sampled traces" data stream:
// - "maintenance" privilege to refresh indices
// - "monitor" privilege to be able to query index stats for the global checkpoint
// - "read" privilege to search the documents
.indices("traces-apm.sampled-*")
.privileges("read", "monitor", "maintenance")
.build(),
RoleDescriptor.IndicesPrivileges.builder()
.indices(".fleet-*")
// Fleet Server needs "maintenance" privilege to be able to perform operations with "refresh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@ public void testElasticFleetServerPrivileges() {
assertThat(role.indices().allowedIndicesMatcher("indices:foo").test(dotFleetIndex), is(false));
});

final IndexAbstraction apmSampledTracesIndex = mockIndexAbstraction("traces-apm.sampled-" + randomAlphaOfLengthBetween(1, 20));
assertThat(role.indices().allowedIndicesMatcher(DeleteAction.NAME).test(apmSampledTracesIndex), is(true));
assertThat(role.indices().allowedIndicesMatcher(CreateIndexAction.NAME).test(apmSampledTracesIndex), is(true));
assertThat(role.indices().allowedIndicesMatcher(IndexAction.NAME).test(apmSampledTracesIndex), is(true));
assertThat(role.indices().allowedIndicesMatcher(BulkAction.NAME).test(apmSampledTracesIndex), is(true));
assertThat(role.indices().allowedIndicesMatcher(GetAction.NAME).test(apmSampledTracesIndex), is(true));
assertThat(role.indices().allowedIndicesMatcher(MultiGetAction.NAME).test(apmSampledTracesIndex), is(true));
assertThat(role.indices().allowedIndicesMatcher(SearchAction.NAME).test(apmSampledTracesIndex), is(true));
assertThat(role.indices().allowedIndicesMatcher(MultiSearchAction.NAME).test(apmSampledTracesIndex), is(true));
assertThat(role.indices().allowedIndicesMatcher(IndicesStatsAction.NAME).test(apmSampledTracesIndex), is(true));
assertThat(role.indices().allowedIndicesMatcher(DeleteIndexAction.NAME).test(apmSampledTracesIndex), is(false));
assertThat(role.indices().allowedIndicesMatcher(UpdateSettingsAction.NAME).test(apmSampledTracesIndex), is(false));

final String kibanaApplication = "kibana-" + randomFrom(randomAlphaOfLengthBetween(8, 24), ".kibana");
final String privilegeName = randomAlphaOfLengthBetween(3, 16);
assertThat(
Expand Down