2929
3030import static java .nio .file .attribute .PosixFilePermissions .fromString ;
3131import static org .elasticsearch .packaging .util .DockerRun .getImageName ;
32+ import static org .elasticsearch .packaging .util .FileMatcher .p555 ;
3233import static org .elasticsearch .packaging .util .FileMatcher .p644 ;
3334import static org .elasticsearch .packaging .util .FileMatcher .p664 ;
34- import static org .elasticsearch .packaging .util .FileMatcher .p755 ;
3535import static org .elasticsearch .packaging .util .FileMatcher .p770 ;
3636import static org .elasticsearch .packaging .util .FileMatcher .p775 ;
3737import static org .elasticsearch .packaging .util .FileUtils .getCurrentVersion ;
@@ -443,9 +443,8 @@ public static void waitForPathToExist(Path path) throws InterruptedException {
443443 /**
444444 * Perform a variety of checks on an installation. If the current distribution is not OSS, additional checks are carried out.
445445 * @param installation the installation to verify
446- * @param distribution the distribution to verify
447446 */
448- public static void verifyContainerInstallation (Installation installation , Distribution distribution ) {
447+ public static void verifyContainerInstallation (Installation installation ) {
449448 verifyOssInstallation (installation );
450449 verifyDefaultInstallation (installation );
451450 }
@@ -460,15 +459,13 @@ private static void verifyOssInstallation(Installation es) {
460459
461460 Stream .of (es .home , es .data , es .logs , es .config , es .plugins ).forEach (dir -> assertPermissionsAndOwnership (dir , p775 ));
462461
463- Stream .of (es .modules ).forEach (dir -> assertPermissionsAndOwnership (dir , p755 ));
462+ Stream .of (es .bin , es . bundledJdk , es . lib , es . modules ).forEach (dir -> assertPermissionsAndOwnership (dir , p555 ));
464463
465464 Stream .of ("elasticsearch.yml" , "jvm.options" , "log4j2.properties" )
466465 .forEach (configFile -> assertPermissionsAndOwnership (es .config (configFile ), p664 ));
467466
468467 assertThat (dockerShell .run (es .bin ("elasticsearch-keystore" ) + " list" ).stdout , containsString ("keystore.seed" ));
469468
470- Stream .of (es .bin , es .lib ).forEach (dir -> assertPermissionsAndOwnership (dir , p755 ));
471-
472469 Stream .of (
473470 "elasticsearch" ,
474471 "elasticsearch-cli" ,
@@ -477,7 +474,7 @@ private static void verifyOssInstallation(Installation es) {
477474 "elasticsearch-node" ,
478475 "elasticsearch-plugin" ,
479476 "elasticsearch-shard"
480- ).forEach (executable -> assertPermissionsAndOwnership (es .bin (executable ), p755 ));
477+ ).forEach (executable -> assertPermissionsAndOwnership (es .bin (executable ), p555 ));
481478
482479 Stream .of ("LICENSE.txt" , "NOTICE.txt" , "README.asciidoc" ).forEach (doc -> assertPermissionsAndOwnership (es .home .resolve (doc ), p644 ));
483480
@@ -506,11 +503,18 @@ private static void verifyDefaultInstallation(Installation es) {
506503 "x-pack-env" ,
507504 "x-pack-security-env" ,
508505 "x-pack-watcher-env"
509- ).forEach (executable -> assertPermissionsAndOwnership (es .bin (executable ), p755 ));
506+ ).forEach (executable -> assertPermissionsAndOwnership (es .bin (executable ), p555 ));
510507
511508 // at this time we only install the current version of archive distributions, but if that changes we'll need to pass
512509 // the version through here
513- assertPermissionsAndOwnership (es .bin ("elasticsearch-sql-cli-" + getCurrentVersion () + ".jar" ), p755 );
510+ assertPermissionsAndOwnership (es .bin ("elasticsearch-sql-cli-" + getCurrentVersion () + ".jar" ), p555 );
511+
512+ final String architecture = getArchitecture ();
513+ Stream .of ("autodetect" , "categorize" , "controller" , "data_frame_analyzer" , "normalize" , "pytorch_inference" )
514+ .forEach (executableName -> {
515+ final Path executablePath = es .modules .resolve ("x-pack-ml/platform/linux-" + architecture + "/bin/" + executableName );
516+ assertPermissionsAndOwnership (executablePath , p555 );
517+ });
514518
515519 Stream .of ("role_mapping.yml" , "roles.yml" , "users" , "users_roles" )
516520 .forEach (configFile -> assertPermissionsAndOwnership (es .config (configFile ), p664 ));
@@ -619,4 +623,12 @@ public static Shell.Result getContainerLogs() {
619623 public static void restartContainer () {
620624 sh .run ("docker restart " + containerId );
621625 }
626+
627+ private static String getArchitecture () {
628+ String architecture = System .getProperty ("os.arch" , "x86_64" );
629+ if (architecture .equals ("amd64" )) {
630+ architecture = "x86_64" ;
631+ }
632+ return architecture ;
633+ }
622634}
0 commit comments