|
34 | 34 | import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement; |
35 | 35 | import org.elasticsearch.entitlement.runtime.policy.entitlements.ReadStoreAttributesEntitlement; |
36 | 36 | import org.elasticsearch.entitlement.runtime.policy.entitlements.SetHttpsConnectionPropertiesEntitlement; |
| 37 | +import org.elasticsearch.entitlement.runtime.policy.entitlements.WriteSystemPropertiesEntitlement; |
37 | 38 |
|
38 | 39 | import java.lang.instrument.Instrumentation; |
39 | 40 | import java.lang.reflect.Constructor; |
@@ -262,15 +263,17 @@ private static PolicyManager createPolicyManager() { |
262 | 263 | var serverPolicy = new Policy("server", serverScopes); |
263 | 264 | // agents run without a module, so this is a special hack for the apm agent |
264 | 265 | // this should be removed once https://github.com/elastic/elasticsearch/issues/109335 is completed |
| 266 | + // See also modules/apm/src/main/plugin-metadata/entitlement-policy.yaml |
265 | 267 | List<Entitlement> agentEntitlements = List.of( |
266 | 268 | new CreateClassLoaderEntitlement(), |
267 | 269 | new ManageThreadsEntitlement(), |
268 | 270 | new SetHttpsConnectionPropertiesEntitlement(), |
269 | 271 | new OutboundNetworkEntitlement(), |
| 272 | + new WriteSystemPropertiesEntitlement(Set.of("AsyncProfiler.safemode")), |
| 273 | + new LoadNativeLibrariesEntitlement(), |
270 | 274 | new FilesEntitlement( |
271 | 275 | List.of( |
272 | | - FileData.ofPath(Path.of("/co/elastic/apm/agent/"), READ), |
273 | | - FileData.ofPath(Path.of("/agent/co/elastic/apm/agent/"), READ), |
| 276 | + FileData.ofPath(bootstrapArgs.logsDir(), READ_WRITE), |
274 | 277 | FileData.ofPath(Path.of("/proc/meminfo"), READ), |
275 | 278 | FileData.ofPath(Path.of("/sys/fs/cgroup/"), READ) |
276 | 279 | ) |
|
0 commit comments