Skip to content

Commit

Permalink
add test output in failure script
Browse files Browse the repository at this point in the history
  • Loading branch information
Enaraque committed Dec 18, 2024
1 parent 1aefd1b commit 809e46c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/actions/passwords-tool/tests-stack-failure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ elif ! curl -s -u wazuh:wazuh -k -X POST "https://127.0.0.1:55000/security/user/
elif ! curl -s -u wazuuh:"${apiPass}" -k -X POST "https://127.0.0.1:55000/security/user/authenticate" | grep "Invalid credentials"; then
exit 1
elif ! curl -s -XGET https://127.0.0.1:9200/ -u admin:admin -k | grep "Unauthorized"; then
curl -s -XGET https://127.0.0.1:9200/ -u admin:admin -k
echo "testing curl -s -XGET https://127.0.0.1:9200/ -u admin:admin -k | grep "Unauthorized""
elif ! curl -s -XGET https://127.0.0.1:9200/ -u adminnnn:"${adminPass}" -k | grep "Unauthorized"; then
curl -s -XGET https://127.0.0.1:9200/ -u adminnnn:"${adminPass}" -k
echo "testing curl -s -XGET https://127.0.0.1:9200/ -u adminnnn:"${adminPass}" -k"
fi
17 changes: 17 additions & 0 deletions .github/actions/passwords-tool/tests-stack-success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
users=( admin anomalyadmin kibanaserver kibanaro logstash readall snapshotrestore )
api_users=( wazuh wazuh-wui )

echo '::group:: Change indexer password, password providing it.'

bash wazuh-passwords-tool.sh -u admin -p LN*X1v.VNtCZ5sESEtLfijPAd39LXGAI
if curl -s -XGET https://127.0.0.1:9200/ -u admin:LN*X1v.VNtCZ5sESEtLfijPAd39LXGAI -k -w %{http_code} | grep "401"; then
exit 1
fi
echo '::endgroup::'

echo '::group:: Change indexer password without providing it.'

indx_pass="$(bash wazuh-passwords-tool.sh -u admin | awk '/admin/{ print $NF }' | tr -d \' )"
if curl -s -XGET https://127.0.0.1:9200/ -u admin:"${indx_pass}" -k -w %{http_code} | grep "401"; then
exit 1
fi

echo '::endgroup::'

echo '::group:: Change all passwords except Wazuh API ones.'

mapfile -t pass < <(bash wazuh-passwords-tool.sh -a | grep 'The password for' | awk '{ print $NF }')
Expand Down

0 comments on commit 809e46c

Please sign in to comment.