From 60aed50a1551482c21d8dbe90cb8f05109637e57 Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Wed, 24 Jan 2024 15:20:06 -0500 Subject: [PATCH 1/2] Corrects the usage of admin credentials Signed-off-by: Darshit Chanpura --- build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 3774dbb9..bcf72081 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,6 @@ import org.opensearch.gradle.test.RestIntegTestTask buildscript { ext { - System.setProperty("OPENSEARCH_INITIAL_ADMIN_PASSWORD", "myStrongPassword123!") isSnapshot = "true" == System.getProperty("build.snapshot", "true") opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT") buildVersionQualifier = System.getProperty("build.version_qualifier", "") @@ -430,7 +429,7 @@ def configureCluster(OpenSearchCluster cluster, Boolean securityEnabled) { } CrossClusterWaitForHttpResource wait = new CrossClusterWaitForHttpResource(protocol, cluster.getFirstNode().getHttpSocketURI(), cluster.nodes.size()) wait.setUsername("admin") - wait.setPassword(System.getProperty("OPENSEARCH_INITIAL_ADMIN_PASSWORD")) + wait.setPassword("admin") return wait.wait(500) } From 1ff3f7eccc7040aabd4f96a25bb3ef8e02c664bb Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Wed, 24 Jan 2024 15:26:34 -0500 Subject: [PATCH 2/2] Corrects integtest.sh Signed-off-by: Darshit Chanpura --- scripts/integtest.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/integtest.sh b/scripts/integtest.sh index 464108c7..a8416e06 100644 --- a/scripts/integtest.sh +++ b/scripts/integtest.sh @@ -74,12 +74,14 @@ IFS='.' read -ra version_array <<< "$OPENSEARCH_VERSION" if [ -z "$CREDENTIAL" ] then + CREDENTIAL="admin:admin" # Starting in 2.12.0, security demo configuration script requires an initial admin password + # That same password must be supplied here, else 401 Unauthorized may be seen when running this task if (( ${version_array[0]} > 2 || (${version_array[0]} == 2 && ${version_array[1]} >= 12) )); then - CREDENTIAL="admin:myStrongPassword123!" - else - CREDENTIAL="admin:admin" - fi + if [ "$SECURITY_ENABLED" == true]; then + CREDENTIAL="admin:myStrongPassword123!" + echo "A password is required to execute the integTest. This must the same as the password used to setup admin user." + fi fi USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'`