Skip to content

Commit e405521

Browse files
authored
Add missing entitlements discovered in IT tests (elastic#123015) (elastic#123032)
(cherry picked from commit d1b7639)
1 parent 007149c commit e405521

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
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
@@ -42,6 +42,7 @@ public record BootstrapArgs(
4242
Function<String, Path> repoDirResolver,
4343
Path[] dataDirs,
4444
Path configDir,
45+
Path libDir,
4546
Path logsDir,
4647
Path tempDir
4748
) {
@@ -56,6 +57,7 @@ public record BootstrapArgs(
5657
throw new IllegalArgumentException("must provide at least one data directory");
5758
}
5859
requireNonNull(configDir);
60+
requireNonNull(libDir);
5961
requireNonNull(logsDir);
6062
requireNonNull(tempDir);
6163
}
@@ -78,6 +80,7 @@ public static BootstrapArgs bootstrapArgs() {
7880
* @param repoDirResolver a functor to map a repository location to its Elasticsearch path.
7981
* @param dataDirs data directories for Elasticsearch
8082
* @param configDir the config directory for Elasticsearch
83+
* @param libDir the lib directory for Elasticsearch
8184
* @param tempDir the temp directory for Elasticsearch
8285
* @param logsDir the log directory for Elasticsearch
8386
*/
@@ -89,6 +92,7 @@ public static void bootstrap(
8992
Function<String, Path> repoDirResolver,
9093
Path[] dataDirs,
9194
Path configDir,
95+
Path libDir,
9296
Path logsDir,
9397
Path tempDir
9498
) {
@@ -104,6 +108,7 @@ public static void bootstrap(
104108
repoDirResolver,
105109
dataDirs,
106110
configDir,
111+
libDir,
107112
logsDir,
108113
tempDir
109114
);

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ private static PolicyManager createPolicyManager() {
234234
Collections.addAll(
235235
serverScopes,
236236
new Scope("org.bouncycastle.fips.tls", List.of(new FilesEntitlement(List.of(FileData.ofPath(trustStorePath, READ))))),
237-
new Scope("org.bouncycastle.fips.core", List.of(new ManageThreadsEntitlement()))
237+
new Scope(
238+
"org.bouncycastle.fips.core",
239+
// read to lib dir is required for checksum validation
240+
List.of(new FilesEntitlement(List.of(FileData.ofPath(bootstrapArgs.libDir(), READ))), new ManageThreadsEntitlement())
241+
)
238242
);
239243
}
240244

modules/repository-s3/src/main/plugin-metadata/entitlement-policy.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ ALL-UNNAMED:
55
- relative_path: "repository-s3/aws-web-identity-token-file"
66
relative_to: "config"
77
mode: "read"
8+
- relative_path: ".aws/"
9+
relative_to: "home"
10+
mode: "read"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ private static void initPhase2(Bootstrap bootstrap) throws IOException {
250250
nodeEnv::resolveRepoDir,
251251
nodeEnv.dataDirs(),
252252
nodeEnv.configDir(),
253+
nodeEnv.libDir(),
253254
nodeEnv.logsDir(),
254255
nodeEnv.tmpDir()
255256
);

0 commit comments

Comments
 (0)