Skip to content

Commit cc96791

Browse files
authored
[Entitlements] Add missing file entitlements for server (#122728)
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)
1 parent 24afbe3 commit cc96791

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import java.util.stream.Stream;
6060
import java.util.stream.StreamSupport;
6161

62+
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Mode.READ;
6263
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Mode.READ_WRITE;
6364

6465
/**
@@ -149,8 +150,25 @@ private static PolicyManager createPolicyManager() {
149150
new ManageThreadsEntitlement(),
150151
new FilesEntitlement(
151152
List.of(
152-
FilesEntitlement.FileData.ofPath(EntitlementBootstrap.bootstrapArgs().tempDir(), READ_WRITE),
153-
FilesEntitlement.FileData.ofPath(EntitlementBootstrap.bootstrapArgs().logsDir(), READ_WRITE)
153+
FileData.ofPath(bootstrapArgs.tempDir(), READ_WRITE),
154+
FileData.ofPath(bootstrapArgs.logsDir(), READ_WRITE),
155+
// OS release on Linux
156+
FileData.ofPath(Path.of("/etc/os-release"), READ),
157+
FileData.ofPath(Path.of("/etc/system-release"), READ),
158+
FileData.ofPath(Path.of("/usr/lib/os-release"), READ),
159+
// read max virtual memory areas
160+
FileData.ofPath(Path.of("/proc/sys/vm/max_map_count"), READ),
161+
FileData.ofPath(Path.of("/proc/meminfo"), READ),
162+
// load averages on Linux
163+
FileData.ofPath(Path.of("/proc/loadavg"), READ),
164+
// control group stats on Linux. cgroup v2 stats are in an unpredicable
165+
// location under `/sys/fs/cgroup`, so unfortunately we have to allow
166+
// read access to the entire directory hierarchy.
167+
FileData.ofPath(Path.of("/proc/self/cgroup"), READ),
168+
FileData.ofPath(Path.of("/sys/fs/cgroup/"), READ),
169+
// // io stats on Linux
170+
FileData.ofPath(Path.of("/proc/self/mountinfo"), READ),
171+
FileData.ofPath(Path.of("/proc/diskstats"), READ)
154172
)
155173
)
156174
)

muted-tests.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,6 @@ tests:
338338
- class: org.elasticsearch.entitlement.runtime.policy.PolicyParserFailureTests
339339
method: testEntitlementAbsolutePathWhenRelative
340340
issue: https://github.com/elastic/elasticsearch/issues/122666
341-
- class: org.elasticsearch.entitlement.qa.EntitlementsAllowedNonModularIT
342-
issue: https://github.com/elastic/elasticsearch/issues/122568
343-
- class: org.elasticsearch.entitlement.qa.EntitlementsDeniedIT
344-
issue: https://github.com/elastic/elasticsearch/issues/122566
345-
- class: org.elasticsearch.entitlement.qa.EntitlementsDeniedNonModularIT
346-
issue: https://github.com/elastic/elasticsearch/issues/122569
347-
- class: org.elasticsearch.entitlement.qa.EntitlementsAllowedIT
348-
issue: https://github.com/elastic/elasticsearch/issues/122680
349341
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
350342
method: test {yaml=reference/snapshot-restore/apis/get-snapshot-api/line_408}
351343
issue: https://github.com/elastic/elasticsearch/issues/122681

0 commit comments

Comments
 (0)