Skip to content

Commit

Permalink
Remove references to admin:admin (opensearch-project#1298)
Browse files Browse the repository at this point in the history
* Remove references to admin:admin

Signed-off-by: Derek Ho <dxho@amazon.com>

* Try to pass in initial admin password via env variable

Signed-off-by: Derek Ho <dxho@amazon.com>

* Try using the env variable

Signed-off-by: Derek Ho <dxho@amazon.com>

* Revert file deletion and add logic for integration tests

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix env variable

Signed-off-by: Derek Ho <dxho@amazon.com>

* Update logic to be the same across all repos

Signed-off-by: Derek Ho <dxho@amazon.com>

* Keep old logic

Signed-off-by: Derek Ho <dxho@amazon.com>

* Change variable name

Signed-off-by: Derek Ho <dxho@amazon.com>

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
(cherry picked from commit 3ea239b)
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
  • Loading branch information
derek-ho authored and DarshitChanpura committed Feb 9, 2024
1 parent 7e2902c commit 4d22b88
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion HANDBOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ plugins.security.nodes_dn_dynamic_config_enabled: true
Allow connections from follower cluster on the leader as follows
```bash
curl -k -u admin:admin -XPUT "https://${LEADER}/_plugins/_security/api/nodesdn/follower" \
curl -k -u admin:<admin password> -XPUT "https://${LEADER}/_plugins/_security/api/nodesdn/follower" \
-H 'Content-type: application/json' \
-d'{"nodes_dn": ["CN=follower.example.com"]}'
```
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ 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", "2.12.0-SNAPSHOT")
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
Expand Down Expand Up @@ -429,7 +430,7 @@ def configureCluster(OpenSearchCluster cluster, Boolean securityEnabled) {
}
CrossClusterWaitForHttpResource wait = new CrossClusterWaitForHttpResource(protocol, cluster.getFirstNode().getHttpSocketURI(), cluster.nodes.size())
wait.setUsername("admin")
wait.setPassword("admin")
wait.setPassword(System.getProperty("OPENSEARCH_INITIAL_ADMIN_PASSWORD"))
return wait.wait(500)
}

Expand Down Expand Up @@ -682,6 +683,7 @@ clusters.each { name ->
if (securityEnabled) {
plugin(provider(securityPluginOld))
cliSetup("opensearch-security/install_demo_configuration.sh", "-y")

}
// Currently fetching the ARCHIVE distribution fails on mac as it tries to fetch the Mac specific "DARWIN" distribution
// for Opensearch which is not publish yet. Changing this to INTEG_TEST to make it work on mac.
Expand Down
11 changes: 9 additions & 2 deletions scripts/integtest.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,16 @@ then
SECURITY_ENABLED="true"
fi

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
if (( ${version_array[0]} > 2 || (${version_array[0]} == 2 && ${version_array[1]} >= 12) )); then
CREDENTIAL="admin:myStrongPassword123!"
else
CREDENTIAL="admin:admin"
fi
fi

USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'`
Expand Down Expand Up @@ -118,4 +125,4 @@ else
TRANSPORT_PORT="9300"
fi
./gradlew singleClusterSanityTest -Dfollower.http_host="$BIND_ADDRESS:$BIND_PORT" -Dfollower.transport_host="$BIND_ADDRESS:$TRANSPORT_PORT" -Dsecurity_enabled=$SECURITY_ENABLED -Duser=$USERNAME -Dpassword=$PASSWORD --console=plain
fi
fi

0 comments on commit 4d22b88

Please sign in to comment.