From 329f45e42e85c503b921030f1d536b0f57d7eaae Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Mon, 18 Dec 2023 16:37:01 -0500 Subject: [PATCH 1/8] Default admin password as admin Signed-off-by: Derek Ho --- .github/actions/start-opensearch/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/start-opensearch/action.yml b/.github/actions/start-opensearch/action.yml index cf3dfbeb..dc21b9aa 100644 --- a/.github/actions/start-opensearch/action.yml +++ b/.github/actions/start-opensearch/action.yml @@ -26,6 +26,7 @@ runs: fi OPENSEARCH_HOME=$(realpath ./opensearch-*) OPENSEARCH_JAVA_OPTS="-Djava.net.preferIPv4Stack=true" + OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin url="http://localhost:9200" cp ./client/.ci/opensearch/opensearch.yml $OPENSEARCH_HOME/config/ @@ -34,7 +35,7 @@ runs: if [[ -d "$OPENSEARCH_HOME/plugins/opensearch-security" ]]; then if [[ "$SECURED" == "true" ]]; then - bash $OPENSEARCH_HOME/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s + bash $OPENSEARCH_HOME/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s -t sed -i.bak -e 's/plugins.security.audit.type:.*/plugins.security.audit.type: log4j/' $OPENSEARCH_HOME/config/opensearch.yml cp ./client/.ci/opensearch/*.pem $OPENSEARCH_HOME/config/ url="https://localhost:9200" From 553f51daa30d1bcf0728c3e138d65d0bffd1ff87 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 16:45:32 -0500 Subject: [PATCH 2/8] Add 2.12.0 to matrix Signed-off-by: Derek Ho --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9bbf290..2c5767c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,7 +63,7 @@ jobs: strategy: fail-fast: false matrix: - version: ['1.1.0', '1.2.4', '1.3.4', '2.2.0', '2.4.0', '2.6.0', '2.8.0'] + version: ['1.1.0', '1.2.4', '1.3.4', '2.2.0', '2.4.0', '2.6.0', '2.8.0', '2.12.0'] secured: [true, false] steps: - name: Checkout Rust Client From bee37f19308bd62cca4e79022d9ddc40ceffcb01 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 16:49:08 -0500 Subject: [PATCH 3/8] Export var Signed-off-by: Derek Ho --- .github/actions/start-opensearch/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/start-opensearch/action.yml b/.github/actions/start-opensearch/action.yml index dc21b9aa..c1d92507 100644 --- a/.github/actions/start-opensearch/action.yml +++ b/.github/actions/start-opensearch/action.yml @@ -26,7 +26,7 @@ runs: fi OPENSEARCH_HOME=$(realpath ./opensearch-*) OPENSEARCH_JAVA_OPTS="-Djava.net.preferIPv4Stack=true" - OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin + export OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin url="http://localhost:9200" cp ./client/.ci/opensearch/opensearch.yml $OPENSEARCH_HOME/config/ From d19b28f5ceaa13d95d6cafdc8a9a2de8b6bbb1f2 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 27 Feb 2024 15:17:36 -0500 Subject: [PATCH 4/8] Add version logic Signed-off-by: Derek Ho --- .github/actions/start-opensearch/action.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/actions/start-opensearch/action.yml b/.github/actions/start-opensearch/action.yml index c1d92507..ae7d8bc2 100644 --- a/.github/actions/start-opensearch/action.yml +++ b/.github/actions/start-opensearch/action.yml @@ -27,6 +27,9 @@ runs: OPENSEARCH_HOME=$(realpath ./opensearch-*) OPENSEARCH_JAVA_OPTS="-Djava.net.preferIPv4Stack=true" export OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin + OPENSEARCH_REQUIRED_VERSION="2.12.0" + # Starting in 2.12.0, security demo configuration script requires an initial admin password + COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1` url="http://localhost:9200" cp ./client/.ci/opensearch/opensearch.yml $OPENSEARCH_HOME/config/ @@ -35,7 +38,11 @@ runs: if [[ -d "$OPENSEARCH_HOME/plugins/opensearch-security" ]]; then if [[ "$SECURED" == "true" ]]; then - bash $OPENSEARCH_HOME/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s -t + if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then + bash $OPENSEARCH_HOME/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s -t + else + bash $OPENSEARCH_HOME/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s + fi sed -i.bak -e 's/plugins.security.audit.type:.*/plugins.security.audit.type: log4j/' $OPENSEARCH_HOME/config/opensearch.yml cp ./client/.ci/opensearch/*.pem $OPENSEARCH_HOME/config/ url="https://localhost:9200" From 2aaa0e307002ca9d0d680801836686510761ef20 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 27 Feb 2024 15:23:32 -0500 Subject: [PATCH 5/8] Get the version via the properties Signed-off-by: Derek Ho --- .github/actions/start-opensearch/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/start-opensearch/action.yml b/.github/actions/start-opensearch/action.yml index ae7d8bc2..7ed35bef 100644 --- a/.github/actions/start-opensearch/action.yml +++ b/.github/actions/start-opensearch/action.yml @@ -26,6 +26,7 @@ runs: fi OPENSEARCH_HOME=$(realpath ./opensearch-*) OPENSEARCH_JAVA_OPTS="-Djava.net.preferIPv4Stack=true" + OPENSEARCH_VERSION=$(cat $OPENSEARCH_HOME/plugins/opensearch-security/plugin-descriptor.properties | grep '^version=' | cut -d'=' -f 2) export OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin OPENSEARCH_REQUIRED_VERSION="2.12.0" # Starting in 2.12.0, security demo configuration script requires an initial admin password From 909bcf9fe18f14568d434631f9c50b595d3ba7e3 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 27 Feb 2024 15:26:21 -0500 Subject: [PATCH 6/8] Invert the logic Signed-off-by: Derek Ho --- .github/actions/start-opensearch/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/start-opensearch/action.yml b/.github/actions/start-opensearch/action.yml index 7ed35bef..ebd1c68f 100644 --- a/.github/actions/start-opensearch/action.yml +++ b/.github/actions/start-opensearch/action.yml @@ -39,7 +39,7 @@ runs: if [[ -d "$OPENSEARCH_HOME/plugins/opensearch-security" ]]; then if [[ "$SECURED" == "true" ]]; then - if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then + if [ "$COMPARE_VERSION" == "$OPENSEARCH_REQUIRED_VERSION" ]; then bash $OPENSEARCH_HOME/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s -t else bash $OPENSEARCH_HOME/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s From 2719018ba1fdc1f2709f97aab0b1074065bb6e74 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 27 Feb 2024 15:30:37 -0500 Subject: [PATCH 7/8] Only pull the version if it exists Signed-off-by: Derek Ho --- .github/actions/start-opensearch/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/start-opensearch/action.yml b/.github/actions/start-opensearch/action.yml index ebd1c68f..83baa602 100644 --- a/.github/actions/start-opensearch/action.yml +++ b/.github/actions/start-opensearch/action.yml @@ -28,9 +28,6 @@ runs: OPENSEARCH_JAVA_OPTS="-Djava.net.preferIPv4Stack=true" OPENSEARCH_VERSION=$(cat $OPENSEARCH_HOME/plugins/opensearch-security/plugin-descriptor.properties | grep '^version=' | cut -d'=' -f 2) export OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin - OPENSEARCH_REQUIRED_VERSION="2.12.0" - # Starting in 2.12.0, security demo configuration script requires an initial admin password - COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1` url="http://localhost:9200" cp ./client/.ci/opensearch/opensearch.yml $OPENSEARCH_HOME/config/ @@ -39,6 +36,9 @@ runs: if [[ -d "$OPENSEARCH_HOME/plugins/opensearch-security" ]]; then if [[ "$SECURED" == "true" ]]; then + OPENSEARCH_REQUIRED_VERSION="2.12.0" + # Starting in 2.12.0, security demo configuration script requires an initial admin password + COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1` if [ "$COMPARE_VERSION" == "$OPENSEARCH_REQUIRED_VERSION" ]; then bash $OPENSEARCH_HOME/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s -t else From 4240ad3da7b8775181a3c8ccdfaffb14ffb76e9b Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 27 Feb 2024 15:33:02 -0500 Subject: [PATCH 8/8] Only extract the version if it exists Signed-off-by: Derek Ho --- .github/actions/start-opensearch/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/start-opensearch/action.yml b/.github/actions/start-opensearch/action.yml index 83baa602..306a9079 100644 --- a/.github/actions/start-opensearch/action.yml +++ b/.github/actions/start-opensearch/action.yml @@ -26,7 +26,6 @@ runs: fi OPENSEARCH_HOME=$(realpath ./opensearch-*) OPENSEARCH_JAVA_OPTS="-Djava.net.preferIPv4Stack=true" - OPENSEARCH_VERSION=$(cat $OPENSEARCH_HOME/plugins/opensearch-security/plugin-descriptor.properties | grep '^version=' | cut -d'=' -f 2) export OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin url="http://localhost:9200" @@ -36,6 +35,7 @@ runs: if [[ -d "$OPENSEARCH_HOME/plugins/opensearch-security" ]]; then if [[ "$SECURED" == "true" ]]; then + OPENSEARCH_VERSION=$(cat $OPENSEARCH_HOME/plugins/opensearch-security/plugin-descriptor.properties | grep '^version=' | cut -d'=' -f 2) OPENSEARCH_REQUIRED_VERSION="2.12.0" # Starting in 2.12.0, security demo configuration script requires an initial admin password COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`