|
59 | 59 | import java.util.stream.Stream; |
60 | 60 | import java.util.stream.StreamSupport; |
61 | 61 |
|
| 62 | +import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Mode.READ; |
62 | 63 | import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Mode.READ_WRITE; |
63 | 64 |
|
64 | 65 | /** |
@@ -149,8 +150,25 @@ private static PolicyManager createPolicyManager() { |
149 | 150 | new ManageThreadsEntitlement(), |
150 | 151 | new FilesEntitlement( |
151 | 152 | 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) |
154 | 172 | ) |
155 | 173 | ) |
156 | 174 | ) |
|
0 commit comments