forked from wazuh/wazuh-docker
Add env variables
This commit is contained in:
+43
-40
@@ -33,20 +33,16 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
build-images:
|
build-images:
|
||||||
# needs: prepare-variables
|
needs: prepare-variables
|
||||||
# uses: ./.github/workflows/Procedure_push_docker_images.yml
|
uses: ./.github/workflows/Procedure_push_docker_images.yml
|
||||||
# secrets: inherit
|
secrets: inherit
|
||||||
# with:
|
with:
|
||||||
# image_tag: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }}
|
image_tag: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }}
|
||||||
# docker_reference: ${{ github.head_ref }}
|
docker_reference: ${{ github.head_ref }}
|
||||||
# revision: ${{ needs.prepare-variables.outputs.WAZUH_TAG_REVISION }}
|
revision: ${{ needs.prepare-variables.outputs.WAZUH_TAG_REVISION }}
|
||||||
# reference: "latest"
|
reference: "latest"
|
||||||
# id: ${{ github.run_id }}
|
id: ${{ github.run_id }}
|
||||||
# dev: true
|
dev: true
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Skip build
|
|
||||||
run: echo "Build images step skipped"
|
|
||||||
|
|
||||||
Execute-Goss-tests:
|
Execute-Goss-tests:
|
||||||
needs: [prepare-variables, build-images]
|
needs: [prepare-variables, build-images]
|
||||||
@@ -91,6 +87,10 @@ jobs:
|
|||||||
WAZUH_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }}
|
WAZUH_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }}
|
||||||
WAZUH_MINOR_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_MINOR_VERSION }}
|
WAZUH_MINOR_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_MINOR_VERSION }}
|
||||||
WAZUH_REGISTRY: ${{ needs.prepare-variables.outputs.WAZUH_REGISTRY }}
|
WAZUH_REGISTRY: ${{ needs.prepare-variables.outputs.WAZUH_REGISTRY }}
|
||||||
|
INDEXER_USERNAME: admin
|
||||||
|
INDEXER_PASSWORD: admin
|
||||||
|
API_USERNAME: wazuh-wui
|
||||||
|
API_PASSWORD: MyS3cr37P450r.*-
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
@@ -155,7 +155,7 @@ jobs:
|
|||||||
INDEXER_CONTAINERS=$(docker ps --format '{{.Names}}' | grep "indexer")
|
INDEXER_CONTAINERS=$(docker ps --format '{{.Names}}' | grep "indexer")
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
echo "Checking Wazuh indexer health (Attempt $i/10)"
|
echo "Checking Wazuh indexer health (Attempt $i/10)"
|
||||||
RESPONSE=$(curl -XGET "https://0.0.0.0:9200/_cluster/health?pretty" -u admin:admin -k -s --retry 2 || true)
|
RESPONSE=$(curl -XGET "https://0.0.0.0:9200/_cluster/health?pretty" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s --retry 2 || true)
|
||||||
INDEXER_CONTAINERS=$(docker ps --format '{{.Names}}' | grep "indexer")
|
INDEXER_CONTAINERS=$(docker ps --format '{{.Names}}' | grep "indexer")
|
||||||
if echo "$RESPONSE" | grep -qE "green|yellow"; then
|
if echo "$RESPONSE" | grep -qE "green|yellow"; then
|
||||||
echo "Cluster Online"
|
echo "Cluster Online"
|
||||||
@@ -173,19 +173,19 @@ jobs:
|
|||||||
done
|
done
|
||||||
[ $i -lt 10 ] && sleep 60
|
[ $i -lt 10 ] && sleep 60
|
||||||
done
|
done
|
||||||
status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | wc -l`"
|
status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | wc -l`"
|
||||||
status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | grep -E "green|yellow" | wc -l`"
|
status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | grep -E "green|yellow" | wc -l`"
|
||||||
if [[ $status_index_green -eq $status_index ]]; then
|
if [[ $status_index_green -eq $status_index ]]; then
|
||||||
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s
|
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s
|
||||||
else
|
else
|
||||||
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s
|
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
- name: Check Wazuh indexer nodes
|
- name: Check Wazuh indexer nodes
|
||||||
run: |
|
run: |
|
||||||
nodes="`curl -XGET "https://0.0.0.0:9200/_cat/nodes" -u admin:admin -k -s | grep -E "indexer" | wc -l`"
|
nodes="`curl -XGET "https://0.0.0.0:9200/_cat/nodes" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | grep -E "indexer" | wc -l`"
|
||||||
if [[ $nodes -eq 1 ]]; then
|
if [[ $nodes -eq 1 ]]; then
|
||||||
echo "Wazuh indexer nodes: ${nodes}"
|
echo "Wazuh indexer nodes: ${nodes}"
|
||||||
else
|
else
|
||||||
@@ -207,7 +207,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
echo "Checking documents in wazuh-states (Attempt $i/10)..."
|
echo "Checking documents in wazuh-states (Attempt $i/10)..."
|
||||||
RESPONSE=$(curl -XGET "https://0.0.0.0:9200/wazuh-states*/_count" -u admin:admin -k -s || echo "{}")
|
RESPONSE=$(curl -XGET "https://0.0.0.0:9200/wazuh-states*/_count" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s || echo "{}")
|
||||||
DOCS=$(echo "$RESPONSE" | jq -r '.count // 0')
|
DOCS=$(echo "$RESPONSE" | jq -r '.count // 0')
|
||||||
if [[ "$DOCS" -gt 0 ]]; then
|
if [[ "$DOCS" -gt 0 ]]; then
|
||||||
echo "wazuh-states index has documents: ${DOCS}"
|
echo "wazuh-states index has documents: ${DOCS}"
|
||||||
@@ -223,8 +223,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Check Wazuh templates
|
- name: Check Wazuh templates
|
||||||
run: |
|
run: |
|
||||||
qty_templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:admin -k -s | grep -P "wazuh|wazuh-agent|wazuh-statistics" | wc -l`"
|
qty_templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | grep -P "wazuh|wazuh-agent|wazuh-statistics" | wc -l`"
|
||||||
templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:admin -k -s | grep -P "wazuh|wazuh-agent|wazuh-statistics"`"
|
templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | grep -P "wazuh|wazuh-agent|wazuh-statistics"`"
|
||||||
if [[ $qty_templates -gt 3 ]]; then
|
if [[ $qty_templates -gt 3 ]]; then
|
||||||
echo "wazuh templates:"
|
echo "wazuh templates:"
|
||||||
echo "${templates}"
|
echo "${templates}"
|
||||||
@@ -246,13 +246,12 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
TOKEN: $(curl -s -u wazuh-wui:MyS3cr37P450r.*- -k -X GET "https://0.0.0.0:55000/security/user/authenticate?raw=true")
|
TOKEN: $(curl -s -u ${{ env.API_USERNAME }}:${{ env.API_PASSWORD }} -k -X GET "https://0.0.0.0:55000/security/user/authenticate?raw=true")
|
||||||
|
|
||||||
- name: Check Wazuh dashboard service URL
|
- name: Check Wazuh dashboard service URL
|
||||||
run: |
|
run: |
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
echo "Checking Wazuh dashboard (Attempt $i/10)"
|
echo "Checking Wazuh dashboard (Attempt $i/10)"
|
||||||
STATUS=$(curl -k -s -o /dev/null -w "%{http_code}" -u admin:admin "https://0.0.0.0:443/app/status")
|
STATUS=$(curl -k -s -o /dev/null -w "%{http_code}" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} "https://0.0.0.0:443/app/status")
|
||||||
echo "Current status: $STATUS"
|
echo "Current status: $STATUS"
|
||||||
if [[ "$STATUS" == "200" ]]; then
|
if [[ "$STATUS" == "200" ]]; then
|
||||||
echo "Wazuh dashboard is UP"
|
echo "Wazuh dashboard is UP"
|
||||||
@@ -293,7 +292,7 @@ jobs:
|
|||||||
sleep 20
|
sleep 20
|
||||||
curl -k -s -X GET "https://localhost:55000/agents?pretty=true" -H "Authorization: Bearer ${{env.TOKEN}}"
|
curl -k -s -X GET "https://localhost:55000/agents?pretty=true" -H "Authorization: Bearer ${{env.TOKEN}}"
|
||||||
env:
|
env:
|
||||||
TOKEN: $(curl -s -u wazuh-wui:MyS3cr37P450r.*- -k -X GET "https://0.0.0.0:55000/security/user/authenticate?raw=true")
|
TOKEN: $(curl -s -u ${{ env.API_USERNAME }}:${{ env.API_PASSWORD }} -k -X GET "https://0.0.0.0:55000/security/user/authenticate?raw=true")
|
||||||
|
|
||||||
- name: Check errors in ossec.log for Wazuh manager
|
- name: Check errors in ossec.log for Wazuh manager
|
||||||
run: ./.github/single-node-log-check.sh
|
run: ./.github/single-node-log-check.sh
|
||||||
@@ -310,6 +309,10 @@ jobs:
|
|||||||
WAZUH_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }}
|
WAZUH_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_IMAGE_VERSION }}
|
||||||
WAZUH_MINOR_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_MINOR_VERSION }}
|
WAZUH_MINOR_VERSION: ${{ needs.prepare-variables.outputs.WAZUH_MINOR_VERSION }}
|
||||||
WAZUH_REGISTRY: ${{ needs.prepare-variables.outputs.WAZUH_REGISTRY }}
|
WAZUH_REGISTRY: ${{ needs.prepare-variables.outputs.WAZUH_REGISTRY }}
|
||||||
|
INDEXER_USERNAME: admin
|
||||||
|
INDEXER_PASSWORD: admin
|
||||||
|
API_USERNAME: wazuh-wui
|
||||||
|
API_PASSWORD: MyS3cr37P450r.*-
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
@@ -382,7 +385,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
for i in {1..20}; do
|
for i in {1..20}; do
|
||||||
echo "Checking Wazuh indexer health (Attempt $i/10)"
|
echo "Checking Wazuh indexer health (Attempt $i/10)"
|
||||||
RESPONSE=$(curl -XGET "https://0.0.0.0:9200/_cluster/health?pretty" -u admin:admin -k -s --retry 2 || true)
|
RESPONSE=$(curl -XGET "https://0.0.0.0:9200/_cluster/health?pretty" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s --retry 2 || true)
|
||||||
INDEXER_CONTAINERS=$(docker ps --format '{{.Names}}' | grep "indexer")
|
INDEXER_CONTAINERS=$(docker ps --format '{{.Names}}' | grep "indexer")
|
||||||
if echo "$RESPONSE" | grep -qE "green|yellow"; then
|
if echo "$RESPONSE" | grep -qE "green|yellow"; then
|
||||||
echo "Cluster Online"
|
echo "Cluster Online"
|
||||||
@@ -400,12 +403,12 @@ jobs:
|
|||||||
done
|
done
|
||||||
[ $i -lt 10 ] && sleep 60
|
[ $i -lt 10 ] && sleep 60
|
||||||
done
|
done
|
||||||
status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | wc -l`"
|
status_index="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | wc -l`"
|
||||||
status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s | grep -E "green" | wc -l`"
|
status_index_green="`curl -XGET "https://0.0.0.0:9200/_cat/indices" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | grep -E "green" | wc -l`"
|
||||||
if [[ $status_index_green -eq $status_index ]]; then
|
if [[ $status_index_green -eq $status_index ]]; then
|
||||||
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s
|
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s
|
||||||
else
|
else
|
||||||
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u admin:admin -k -s
|
curl -XGET "https://0.0.0.0:9200/_cat/indices" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -424,7 +427,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Check Wazuh indexer nodes
|
- name: Check Wazuh indexer nodes
|
||||||
run: |
|
run: |
|
||||||
nodes="`curl -XGET "https://0.0.0.0:9200/_cat/nodes" -u admin:admin -k -s | grep -E "indexer" | wc -l`"
|
nodes="`curl -XGET "https://0.0.0.0:9200/_cat/nodes" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | grep -E "indexer" | wc -l`"
|
||||||
if [[ $nodes -eq 3 ]]; then
|
if [[ $nodes -eq 3 ]]; then
|
||||||
echo "Wazuh indexer nodes: ${nodes}"
|
echo "Wazuh indexer nodes: ${nodes}"
|
||||||
else
|
else
|
||||||
@@ -435,7 +438,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
echo "Checking documents in wazuh-states (Attempt $i/10)..."
|
echo "Checking documents in wazuh-states (Attempt $i/10)..."
|
||||||
RESPONSE=$(curl -XGET "https://0.0.0.0:9200/wazuh-states*/_count" -u admin:admin -k -s || echo "{}")
|
RESPONSE=$(curl -XGET "https://0.0.0.0:9200/wazuh-states*/_count" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s || echo "{}")
|
||||||
DOCS=$(echo "$RESPONSE" | jq -r '.count // 0')
|
DOCS=$(echo "$RESPONSE" | jq -r '.count // 0')
|
||||||
if [[ "$DOCS" -gt 0 ]]; then
|
if [[ "$DOCS" -gt 0 ]]; then
|
||||||
echo "wazuh-states index has documents: ${DOCS}"
|
echo "wazuh-states index has documents: ${DOCS}"
|
||||||
@@ -451,8 +454,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Check Wazuh templates
|
- name: Check Wazuh templates
|
||||||
run: |
|
run: |
|
||||||
qty_templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:admin -k -s | grep "wazuh" | wc -l`"
|
qty_templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | grep "wazuh" | wc -l`"
|
||||||
templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u admin:admin -k -s | grep "wazuh"`"
|
templates="`curl -XGET "https://0.0.0.0:9200/_cat/templates" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} -k -s | grep "wazuh"`"
|
||||||
if [[ $qty_templates -gt 3 ]]; then
|
if [[ $qty_templates -gt 3 ]]; then
|
||||||
echo "wazuh templates:"
|
echo "wazuh templates:"
|
||||||
echo "${templates}"
|
echo "${templates}"
|
||||||
@@ -464,7 +467,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Check Wazuh manager start
|
- name: Check Wazuh manager start
|
||||||
run: |
|
run: |
|
||||||
services="`curl -k -s -X GET "https://0.0.0.0:55000/clsuter/manager/status?pretty=true" -H "Authorization: Bearer ${{env.TOKEN}}" | jq -r .data.affected_items | grep running | wc -l`"
|
services="`curl -k -s -X GET "https://0.0.0.0:55000/clsuter/manager/status?pretty=true" -H "Authorization: Bearer ${{ env.TOKEN}}" | jq -r .data.affected_items | grep running | wc -l`"
|
||||||
if [[ $services -gt 10 ]]; then
|
if [[ $services -gt 10 ]]; then
|
||||||
echo "Wazuh Manager Services: ${services}"
|
echo "Wazuh Manager Services: ${services}"
|
||||||
echo "OK"
|
echo "OK"
|
||||||
@@ -481,13 +484,13 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
TOKEN: $(curl -s -u wazuh-wui:MyS3cr37P450r.*- -k -X GET "https://0.0.0.0:55000/security/user/authenticate?raw=true")
|
TOKEN: $(curl -s -u ${{ env.API_USERNAME }}:${{ env.API_PASSWORD }} -k -X GET "https://0.0.0.0:55000/security/user/authenticate?raw=true")
|
||||||
|
|
||||||
- name: Check Wazuh dashboard service URL
|
- name: Check Wazuh dashboard service URL
|
||||||
run: |
|
run: |
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
echo "Checking Wazuh dashboard (Attempt $i/10)"
|
echo "Checking Wazuh dashboard (Attempt $i/10)"
|
||||||
STATUS=$(curl -k -s -o /dev/null -w "%{http_code}" -u admin:admin "https://0.0.0.0:443/app/status")
|
STATUS=$(curl -k -s -o /dev/null -w "%{http_code}" -u ${{ env.INDEXER_USERNAME }}:${{ env.INDEXER_PASSWORD }} "https://0.0.0.0:443/app/status")
|
||||||
echo "Current status: $STATUS"
|
echo "Current status: $STATUS"
|
||||||
if [[ "$STATUS" == "200" ]]; then
|
if [[ "$STATUS" == "200" ]]; then
|
||||||
echo "Wazuh dashboard is UP"
|
echo "Wazuh dashboard is UP"
|
||||||
@@ -527,7 +530,7 @@ jobs:
|
|||||||
sleep 20
|
sleep 20
|
||||||
curl -k -s -X GET "https://localhost:55000/agents?pretty=true" -H "Authorization: Bearer ${{env.TOKEN}}"
|
curl -k -s -X GET "https://localhost:55000/agents?pretty=true" -H "Authorization: Bearer ${{env.TOKEN}}"
|
||||||
env:
|
env:
|
||||||
TOKEN: $(curl -s -u wazuh-wui:MyS3cr37P450r.*- -k -X GET "https://0.0.0.0:55000/security/user/authenticate?raw=true")
|
TOKEN: $(curl -s -u ${{ env.API_USERNAME }}:${{ env.API_PASSWORD }} -k -X GET "https://0.0.0.0:55000/security/user/authenticate?raw=true")
|
||||||
|
|
||||||
- name: Check errors in ossec.log for Wazuh manager
|
- name: Check errors in ossec.log for Wazuh manager
|
||||||
run: ./.github/multi-node-log-check.sh
|
run: ./.github/multi-node-log-check.sh
|
||||||
Reference in New Issue
Block a user