From 50c5256bd591249f577fd1f88d16c7ab7e699c96 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 16:47:46 -0800 Subject: [PATCH] Remove default admin credential references in DEVELOPER_GUIDE (#1415) (#1420) * Remove default admin credentials Signed-off-by: Ryan Bogan (cherry picked from commit 0c000ade1f4a52d8035ff9e016410b2e34a9c2df) Co-authored-by: Ryan Bogan --- DEVELOPER_GUIDE.md | 10 +++------- build.gradle | 2 ++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index a62437a8b..964aeea6b 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -274,15 +274,12 @@ curl localhost:9200 Additionally, it is also possible to run a cluster with security enabled: ```shell script -./gradlew run -Dsecurity.enabled=true -Dhttps=true -Duser=admin -Dpassword=admin +./gradlew run -Dsecurity.enabled=true -Dhttps=true -Duser=admin -Dpassword= ``` -By default, if `-Dsecurity.enabled=true` is passed the following defaults will be used: `https=true`, `user=admin` and -`password=admin`. - Then, to access the cluster, we can run ```bash -curl https://localhost:9200 --insecure -u admin:admin +curl https://localhost:9200 --insecure -u admin: { "name" : "integTest-0", @@ -301,7 +298,6 @@ curl https://localhost:9200 --insecure -u admin:admin }, "tagline" : "The OpenSearch Project: https://opensearch.org/" } -``` ### Run Multi-node Cluster Locally @@ -331,7 +327,7 @@ Integration tests can be run with remote cluster. For that run the following com In case remote cluster is secured it's possible to pass username and password with the following command: ``` -./gradlew :integTestRemote -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="integTest-0" -Dhttps=true -Duser=admin -Dpassword=admin +./gradlew :integTestRemote -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="integTest-0" -Dhttps=true -Duser=admin -Dpassword= ``` ### Debugging diff --git a/build.gradle b/build.gradle index 2ed70a66e..462adb910 100644 --- a/build.gradle +++ b/build.gradle @@ -336,12 +336,14 @@ integTest { var is_https = System.getProperty("https") var user = System.getProperty("user") var password = System.getProperty("password") + if (System.getProperty("security.enabled") != null) { // If security is enabled, set is_https/user/password defaults is_https = is_https == null ? "true" : is_https user = user == null ? "admin" : user password = password == null ? "admin" : password } + systemProperty("https", is_https) systemProperty("user", user) systemProperty("password", password)