Skip to content

Commit 4a10945

Browse files
authored
[Entitlements] Add missing file entitlements for server (elastic#122728) (elastic#122747)
Add missing file entitlements for server. closes elastic#122569, closes elastic#122568, closes elastic#122567, closes elastic#122566 (Note, some failures are due to a `NoSuchAlgorithmException` when fips is enabled. This issue is unrelated to entitlements) (cherry picked from commit cc96791) # Conflicts: # muted-tests.yml
1 parent 525d333 commit 4a10945

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
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
)

0 commit comments

Comments
 (0)