Skip to content

Commit

Permalink
[Entitlements] Add missing file entitlements for server (#122728)
Browse files Browse the repository at this point in the history
Add missing file entitlements for server.

closes #122569, closes
#122568, closes
#122567, closes
#122566 

(Note, some failures are due to a `NoSuchAlgorithmException` when fips
is enabled. This issue is unrelated to entitlements)
  • Loading branch information
mosche authored Feb 17, 2025
1 parent 24afbe3 commit cc96791
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Mode.READ;
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Mode.READ_WRITE;

/**
Expand Down Expand Up @@ -149,8 +150,25 @@ private static PolicyManager createPolicyManager() {
new ManageThreadsEntitlement(),
new FilesEntitlement(
List.of(
FilesEntitlement.FileData.ofPath(EntitlementBootstrap.bootstrapArgs().tempDir(), READ_WRITE),
FilesEntitlement.FileData.ofPath(EntitlementBootstrap.bootstrapArgs().logsDir(), READ_WRITE)
FileData.ofPath(bootstrapArgs.tempDir(), READ_WRITE),
FileData.ofPath(bootstrapArgs.logsDir(), READ_WRITE),
// OS release on Linux
FileData.ofPath(Path.of("/etc/os-release"), READ),
FileData.ofPath(Path.of("/etc/system-release"), READ),
FileData.ofPath(Path.of("/usr/lib/os-release"), READ),
// read max virtual memory areas
FileData.ofPath(Path.of("/proc/sys/vm/max_map_count"), READ),
FileData.ofPath(Path.of("/proc/meminfo"), READ),
// load averages on Linux
FileData.ofPath(Path.of("/proc/loadavg"), READ),
// control group stats on Linux. cgroup v2 stats are in an unpredicable
// location under `/sys/fs/cgroup`, so unfortunately we have to allow
// read access to the entire directory hierarchy.
FileData.ofPath(Path.of("/proc/self/cgroup"), READ),
FileData.ofPath(Path.of("/sys/fs/cgroup/"), READ),
// // io stats on Linux
FileData.ofPath(Path.of("/proc/self/mountinfo"), READ),
FileData.ofPath(Path.of("/proc/diskstats"), READ)
)
)
)
Expand Down
8 changes: 0 additions & 8 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,6 @@ tests:
- class: org.elasticsearch.entitlement.runtime.policy.PolicyParserFailureTests
method: testEntitlementAbsolutePathWhenRelative
issue: https://github.com/elastic/elasticsearch/issues/122666
- class: org.elasticsearch.entitlement.qa.EntitlementsAllowedNonModularIT
issue: https://github.com/elastic/elasticsearch/issues/122568
- class: org.elasticsearch.entitlement.qa.EntitlementsDeniedIT
issue: https://github.com/elastic/elasticsearch/issues/122566
- class: org.elasticsearch.entitlement.qa.EntitlementsDeniedNonModularIT
issue: https://github.com/elastic/elasticsearch/issues/122569
- class: org.elasticsearch.entitlement.qa.EntitlementsAllowedIT
issue: https://github.com/elastic/elasticsearch/issues/122680
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
method: test {yaml=reference/snapshot-restore/apis/get-snapshot-api/line_408}
issue: https://github.com/elastic/elasticsearch/issues/122681
Expand Down

0 comments on commit cc96791

Please sign in to comment.