|
@@ -34,6 +34,7 @@ import org.elasticsearch.entitlement.runtime.policy.entitlements.ManageThreadsEn
|
|
|
import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement;
|
|
|
import org.elasticsearch.entitlement.runtime.policy.entitlements.ReadStoreAttributesEntitlement;
|
|
|
import org.elasticsearch.entitlement.runtime.policy.entitlements.SetHttpsConnectionPropertiesEntitlement;
|
|
|
+import org.elasticsearch.entitlement.runtime.policy.entitlements.WriteSystemPropertiesEntitlement;
|
|
|
|
|
|
import java.lang.instrument.Instrumentation;
|
|
|
import java.lang.reflect.Constructor;
|
|
@@ -262,15 +263,17 @@ public class EntitlementInitialization {
|
|
|
var serverPolicy = new Policy("server", serverScopes);
|
|
|
// agents run without a module, so this is a special hack for the apm agent
|
|
|
// this should be removed once https://github.com/elastic/elasticsearch/issues/109335 is completed
|
|
|
+ // See also modules/apm/src/main/plugin-metadata/entitlement-policy.yaml
|
|
|
List<Entitlement> agentEntitlements = List.of(
|
|
|
new CreateClassLoaderEntitlement(),
|
|
|
new ManageThreadsEntitlement(),
|
|
|
new SetHttpsConnectionPropertiesEntitlement(),
|
|
|
new OutboundNetworkEntitlement(),
|
|
|
+ new WriteSystemPropertiesEntitlement(Set.of("AsyncProfiler.safemode")),
|
|
|
+ new LoadNativeLibrariesEntitlement(),
|
|
|
new FilesEntitlement(
|
|
|
List.of(
|
|
|
- FileData.ofPath(Path.of("/co/elastic/apm/agent/"), READ),
|
|
|
- FileData.ofPath(Path.of("/agent/co/elastic/apm/agent/"), READ),
|
|
|
+ FileData.ofPath(bootstrapArgs.logsDir(), READ_WRITE),
|
|
|
FileData.ofPath(Path.of("/proc/meminfo"), READ),
|
|
|
FileData.ofPath(Path.of("/sys/fs/cgroup/"), READ)
|
|
|
)
|