Skip to content

Commit 4706068

Browse files
authored
Give NamedComponentReader access to read plugins directories (elastic#123431) (elastic#123442)
The NamedComponentReader reads a file created upon plugin installation for stable plugins from the plugin installation dir. This commit passes the plugins directory through to entitlements and grants server access.
1 parent 403b8c6 commit 4706068

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

libs/entitlement/src/main/java/org/elasticsearch/entitlement/bootstrap/EntitlementBootstrap.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public record BootstrapArgs(
4141
Path[] sharedRepoDirs,
4242
Path configDir,
4343
Path libDir,
44+
Path pluginsDir,
4445
Path logsDir,
4546
Path tempDir,
4647
Path pidFile,
@@ -58,6 +59,7 @@ public record BootstrapArgs(
5859
requireNonNull(sharedRepoDirs);
5960
requireNonNull(configDir);
6061
requireNonNull(libDir);
62+
requireNonNull(pluginsDir);
6163
requireNonNull(logsDir);
6264
requireNonNull(tempDir);
6365
requireNonNull(suppressFailureLogClasses);
@@ -82,6 +84,7 @@ public static BootstrapArgs bootstrapArgs() {
8284
* @param sharedRepoDirs shared repository directories for Elasticsearch
8385
* @param configDir the config directory for Elasticsearch
8486
* @param libDir the lib directory for Elasticsearch
87+
* @param pluginsDir the directory where plugins are installed for Elasticsearch
8588
* @param tempDir the temp directory for Elasticsearch
8689
* @param logsDir the log directory for Elasticsearch
8790
* @param pidFile path to a pid file for Elasticsearch, or {@code null} if one was not specified
@@ -96,6 +99,7 @@ public static void bootstrap(
9699
Path[] sharedRepoDirs,
97100
Path configDir,
98101
Path libDir,
102+
Path pluginsDir,
99103
Path logsDir,
100104
Path tempDir,
101105
Path pidFile,
@@ -114,6 +118,7 @@ public static void bootstrap(
114118
sharedRepoDirs,
115119
configDir,
116120
libDir,
121+
pluginsDir,
117122
logsDir,
118123
tempDir,
119124
pidFile,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ private static PolicyManager createPolicyManager() {
152152
Collections.addAll(
153153
serverModuleFileDatas,
154154
// Base ES directories
155+
FileData.ofPath(bootstrapArgs.pluginsDir(), READ),
155156
FileData.ofPath(bootstrapArgs.configDir(), READ),
156157
FileData.ofPath(bootstrapArgs.logsDir(), READ_WRITE),
157158
FileData.ofRelativePath(Path.of(""), DATA, READ_WRITE),

server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ private static void initPhase2(Bootstrap bootstrap) throws IOException {
254254
nodeEnv.repoDirs(),
255255
nodeEnv.configDir(),
256256
nodeEnv.libDir(),
257+
nodeEnv.pluginsDir(),
257258
nodeEnv.logsDir(),
258259
nodeEnv.tmpDir(),
259260
args.pidFile(),

0 commit comments

Comments
 (0)