Add wazuh-kubernetes reference repository
Some checks failed
Test / test (push) Has been cancelled

Added official Wazuh Kubernetes deployment repository for reference.
This provides:
- Kubernetes manifests for production deployments
- Resource limits and health check configurations
- Security best practices
- Multi-node and HA deployment examples

Useful for future improvements and K8s migration considerations.

Size: 900K

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Gui-Gos
2026-01-04 13:04:02 +01:00
parent 65b9ce6651
commit ae10472528
59 changed files with 4893 additions and 0 deletions

View File

@@ -0,0 +1,142 @@
name: Repository bumper
run-name: Bump ${{ github.ref_name }} (${{ inputs.id }})
on:
workflow_dispatch:
inputs:
version:
description: 'Target version (e.g. 1.2.3)'
default: ''
required: false
type: string
stage:
description: 'Version stage (e.g. alpha0)'
default: ''
required: false
type: string
tag:
description: 'Change branches references to tag-like references (e.g. v4.12.0-alpha7)'
default: false
required: false
type: boolean
issue-link:
description: 'Issue link in format https://github.com/wazuh/<REPO>/issues/<ISSUE-NUMBER>'
required: true
type: string
id:
description: 'Optional identifier for the run'
required: false
type: string
jobs:
bump:
name: Repository bumper
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
env:
CI_COMMIT_AUTHOR: wazuhci
CI_COMMIT_EMAIL: 22834044+wazuhci@users.noreply.github.com
CI_GPG_PRIVATE_KEY: ${{ secrets.CI_WAZUHCI_GPG_PRIVATE }}
GH_TOKEN: ${{ secrets.CI_WAZUHCI_BUMPER_TOKEN }}
BUMP_SCRIPT_PATH: tools/repository_bumper.sh
BUMP_LOG_PATH: tools
steps:
- name: Dump event payload
run: |
cat $GITHUB_EVENT_PATH | jq '.inputs'
- name: Set up GPG key
id: signing_setup
run: |
echo "${{ env.CI_GPG_PRIVATE_KEY }}" | gpg --batch --import
KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec/ {print $5; exit}')
echo "gpg_key_id=$KEY_ID" >> $GITHUB_OUTPUT
- name: Set up git
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
git config --global commit.gpgsign true
git config --global user.signingkey "${{ steps.signing_setup.outputs.gpg_key_id }}"
echo "use-agent" >> ~/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
echo RELOADAGENT | gpg-connect-agent
export DEBIAN_FRONTEND=noninteractive
export GPG_TTY=$(tty)
- name: Checkout repository
uses: actions/checkout@v4
with:
# Using workflow-specific GITHUB_TOKEN because currently CI_WAZUHCI_BUMPER_TOKEN
# doesn't have all the necessary permissions
token: ${{ env.GH_TOKEN }}
- name: Determine branch name
id: vars
env:
VERSION: ${{ inputs.version }}
STAGE: ${{ inputs.stage }}
TAG: ${{ inputs.tag }}
run: |
script_params=""
version=${{ env.VERSION }}
stage=${{ env.STAGE }}
tag=${{ env.TAG }}
# Both version and stage provided
if [[ -n "$version" && -n "$stage" && "$tag" != "true" ]]; then
script_params="--version ${version} --stage ${stage}"
elif [[ -n "$version" && -n "$stage" && "$tag" == "true" ]]; then
script_params="--version ${version} --stage ${stage} --tag ${tag}"
fi
issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}')
BRANCH_NAME="enhancement/wqa${issue_number}-bump-${{ github.ref_name }}"
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "script_params=${script_params}" >> $GITHUB_OUTPUT
- name: Create and switch to bump branch
run: |
git checkout -b ${{ steps.vars.outputs.branch_name }}
- name: Make version bump changes
run: |
echo "Running bump script"
bash ${{ env.BUMP_SCRIPT_PATH }} ${{ steps.vars.outputs.script_params }}
- name: Commit and push changes
run: |
git add .
git commit -m "feat: bump ${{ github.ref_name }}"
git push origin ${{ steps.vars.outputs.branch_name }}
- name: Create pull request
id: create_pr
run: |
gh auth setup-git
PR_URL=$(gh pr create \
--title "Bump ${{ github.ref_name }} branch" \
--body "Issue: ${{ inputs.issue-link }}" \
--base ${{ github.ref_name }} \
--head ${{ steps.vars.outputs.branch_name }})
echo "Pull request created: ${PR_URL}"
echo "pull_request_url=${PR_URL}" >> $GITHUB_OUTPUT
- name: Merge pull request
run: |
# Any checks for the PR are bypassed since the branch is expected to be functional (i.e. the bump process does not introduce any bugs)
gh pr merge "${{ steps.create_pr.outputs.pull_request_url }}" --merge --admin
- name: Show logs
run: |
echo "Bump complete."
echo "Branch: ${{ steps.vars.outputs.branch_name }}"
echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}"
echo "Bumper scripts logs:"
cat ${BUMP_LOG_PATH}/repository_bumper*log

View File

@@ -0,0 +1,212 @@
run-name: Kubernetes EKS deployment test - Branch ${{ inputs.BRANCH_VERSION }} - Launched by @${{ github.actor }}
name: Test Wazuh EKS deployment on Kubernetes
on:
workflow_dispatch:
inputs:
BRANCH_VERSION:
description: 'Branch version to deploy'
required: true
default: 'main'
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
env:
AWS_REGION: us-west-1
CLUSTER_NAME: test-eks-deploy${{ github.event.number }}
jobs:
EKS_deployment_test:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.BRANCH_VERSION }}
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE }}
aws-region: "${{ env.AWS_REGION }}"
- name: Install pytest
run: |
sudo apt install -y python3-pytest
- name: Install eksctl
run: |
ARCH=amd64
PLATFORM=$(uname -s)_$ARCH
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"
curl -sL "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_checksums.txt" | grep $PLATFORM | sha256sum --check
tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz
sudo mv /tmp/eksctl /usr/local/bin
- name: Deploy eks cluster
run: |
eksctl create cluster \
--name ${{ env.CLUSTER_NAME }} \
--with-oidc \
--region ${{ env.AWS_REGION }} \
--nodes-min 6 \
--nodes-max 6 \
--managed \
--spot \
-t t3a.medium \
--tags "issue=https://github.com/wazuh/wazuh-kubernetes/pull/${{ github.event.number }},team=devops,termination_date=2030-01-01 21:00:00"
- name: Create sa for ebs-csi-controller
run: |
eksctl create iamserviceaccount \
--name ebs-csi-controller-sa \
--region ${{ env.AWS_REGION }} \
--namespace kube-system \
--cluster ${{ env.CLUSTER_NAME }} \
--role-name eksctl-EBS-CSI-DriverRole-${{ env.CLUSTER_NAME }} \
--role-only \
--attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \
--approve
- name: Install addon aws-ebs-csi-driver into a eks cluster deployed
run: |
eksctl create addon \
--name aws-ebs-csi-driver \
--cluster ${{ env.CLUSTER_NAME }} \
--region ${{ env.AWS_REGION }} \
--service-account-role-arn arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/eksctl-EBS-CSI-DriverRole-${{ env.CLUSTER_NAME }} \
--force
- name: Create sa for aws-node
run: |
eksctl create iamserviceaccount \
--cluster ${{ env.CLUSTER_NAME }} \
--namespace kube-system \
--name aws-node \
--attach-policy-arn arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy \
--role-name AmazonEKSVPCCNIRole \
--override-existing-serviceaccounts \
--approve \
--region ${{ env.AWS_REGION }}
- name: Enable Network Policies in the EKS cluster
run: |
ADDON_VERSION=$(kubectl describe daemonset aws-node --namespace kube-system | grep amazon-k8s-cni: | cut -d : -f 3)
aws eks update-addon \
--cluster-name ${{ env.CLUSTER_NAME }} \
--addon-name vpc-cni \
--addon-version $ADDON_VERSION \
--service-account-role-arn arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/AmazonEKSVPCCNIRole \
--resolve-conflicts OVERWRITE \
--configuration-values '{"enableNetworkPolicy": "true"}' \
--region ${{ env.AWS_REGION }}
- name: Install yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq && sudo chmod +x /usr/local/bin/yq
- name: Get Wazuh version
run: |
WAZUH_VERSION=$(jq -r '.version' VERSION.json)
WAZUH_MAJOR=$(echo "$WAZUH_VERSION" | cut -d '.' -f 1)
WAZUH_MINOR=$(echo "$WAZUH_VERSION" | cut -d '.' -f 1-2)
echo WAZUH_VERSION=$WAZUH_VERSION >> $GITHUB_ENV
echo WAZUH_MAJOR=$WAZUH_MAJOR >> $GITHUB_ENV
echo WAZUH_MINOR=$WAZUH_MINOR >> $GITHUB_ENV
- name: Replace image registry to ECR
run: |
ECR_REGISTRY="${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com"
yq e -i ".spec.template.spec.containers[] |= select(.name == \"wazuh-dashboard\").image = \"$ECR_REGISTRY/wazuh/wazuh-dashboard:${{ env.WAZUH_VERSION }}\"" wazuh/indexer_stack/wazuh-dashboard/dashboard-deploy.yaml
yq e -i ".spec.template.spec.containers[] |= select(.name == \"wazuh-indexer\").image = \"$ECR_REGISTRY/wazuh/wazuh-indexer:${{ env.WAZUH_VERSION }}\"" wazuh/indexer_stack/wazuh-indexer/cluster/indexer-sts.yaml
yq e -i ".spec.template.spec.initContainers[] |= select(.name == \"init-wazuh-etc\").image = \"$ECR_REGISTRY/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}\"" wazuh/wazuh_managers/wazuh-master-sts.yaml
yq e -i ".spec.template.spec.containers[] |= select(.name == \"wazuh-manager\").image = \"$ECR_REGISTRY/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}\"" wazuh/wazuh_managers/wazuh-master-sts.yaml
yq e -i ".spec.template.spec.initContainers[] |= select(.name == \"init-wazuh-etc\").image = \"$ECR_REGISTRY/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}\"" wazuh/wazuh_managers/wazuh-worker-sts.yaml
yq e -i ".spec.template.spec.containers[] |= select(.name == \"wazuh-manager\").image = \"$ECR_REGISTRY/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}\"" wazuh/wazuh_managers/wazuh-worker-sts.yaml
- name: Download Wazuh certificates tool and config files
run: |
cd wazuh/
curl -LO "https://packages-dev.wazuh.com/${{ env.WAZUH_MINOR }}/wazuh-certs-tool.sh"
curl -LO "https://packages-dev.wazuh.com/${{ env.WAZUH_MINOR }}/config.yml"
- name: Update config.yml file
run: |
yq e -i '.nodes.indexer[0].name = "indexer"' wazuh/config.yml
yq e -i '.nodes.indexer[0].ip = "127.0.0.1"' wazuh/config.yml
yq e -i '.nodes.server[0].name = "server"' wazuh/config.yml
yq e -i '.nodes.server[0].ip = "127.0.0.1"' wazuh/config.yml
yq e -i '.nodes.dashboard[0].ip = "127.0.0.1"' wazuh/config.yml
- name: Create Wazuh certificates
run: |
cd wazuh/
bash wazuh-certs-tool.sh -A
- name: Deploy Nginx ingress controller
run: |
kubectl apply -f nginx/nginx-ingress-controller.yaml
- name: Wait 5 minutes for Wazuh stack startup
run: sleep 5m
- name: Update Wazuh ingress DNS
run: |
INGRESS_DNS=$(kubectl -n ingress-nginx get service ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
yq e -i ".spec.rules[0].host = \"$INGRESS_DNS\"" wazuh/base/wazuh-ingress.yaml
echo INGRESS_DNS=$INGRESS_DNS >> $GITHUB_ENV
- name: Deploy Wazuh stack
run: kubectl apply -k envs/eks/
- name: Wait 10 minutes for Wazuh stack startup
run: sleep 10m
- name: View stack status
run: kubectl get all -n wazuh -o wide
- name: View Wazuh dashboard logs
run: kubectl logs $(kubectl get pods -n wazuh | grep wazuh-dashboard | awk '{print $1;}') -n wazuh
- name: View Wazuh indexer 0 logs
run: kubectl logs wazuh-indexer-0 -n wazuh
- name: View Wazuh indexer 1 logs
run: kubectl logs wazuh-indexer-1 -n wazuh
- name: View Wazuh indexer 2 logs
run: kubectl logs wazuh-indexer-2 -n wazuh
- name: View Wazuh manager master logs
run: kubectl logs wazuh-manager-master-0 -n wazuh
- name: View Wazuh manager worker 0 logs
run: kubectl logs wazuh-manager-worker-0 -n wazuh
- name: View Wazuh manager worker 1 logs
run: kubectl logs wazuh-manager-worker-1 -n wazuh
- name: Run pytest
run: |
pytest tests/k8s_pytest.py -v --deployment-type eks --dashboard-url "${{ env.INGRESS_DNS }}"
- name: Delete eks cluster
if: always()
run: |
eksctl delete cluster \
--name ${{ env.CLUSTER_NAME }} \
--region ${{ env.AWS_REGION }}
- name: Delete EBS dynamic volumes
if: always()
run: |
for volume_id in $(aws ec2 describe-volumes \
--region ${{ env.AWS_REGION }} \
--filters Name=tag:KubernetesCluster,Values="${{ env.CLUSTER_NAME }}" \
--query "Volumes[].VolumeId" \
--output text); do
echo "Deleting Volume id: $volume_id"
aws ec2 delete-volume --region ${{ env.AWS_REGION }} --volume-id $volume_id
done

View File

@@ -0,0 +1,153 @@
run-name: Kubernetes Local deployment test - Branch ${{ inputs.BRANCH_VERSION }} - Launched by @${{ github.actor }}
name: Test Wazuh Local deployment on Kubernetes
on:
pull_request:
workflow_dispatch:
inputs:
BRANCH_VERSION:
description: 'Branch version to deploy'
required: true
default: 'main'
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
env:
AWS_REGION: us-west-1
ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-west-1.amazonaws.com
jobs:
Local_deployment_test:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.BRANCH_VERSION }}
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE }}
aws-region: "${{ env.AWS_REGION }}"
- name: Install pytest
run: |
sudo apt install -y python3-pytest
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
- name: free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt update -y && sudo apt upgrade -y
sudo apt clean
df -h
- name: Install Minikube cluster
run: |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
- name: Start Minikube cluster
run: minikube start --network-plugin=cni --cni=calico
- name: Get Wazuh version
run: |
WAZUH_VERSION=$(jq -r '.version' VERSION.json)
WAZUH_MAJOR=$(echo "$WAZUH_VERSION" | cut -d '.' -f 1)
WAZUH_MINOR=$(echo "$WAZUH_VERSION" | cut -d '.' -f 1-2)
echo WAZUH_VERSION=$WAZUH_VERSION >> $GITHUB_ENV
echo WAZUH_MAJOR=$WAZUH_MAJOR >> $GITHUB_ENV
echo WAZUH_MINOR=$WAZUH_MINOR >> $GITHUB_ENV
- name: Replace image registry to ECR
run: |
yq e -i '.spec.template.spec.containers[] |= select(.name == "wazuh-dashboard").image = "${{ env.ECR_REGISTRY }}/wazuh/wazuh-dashboard:${{ env.WAZUH_VERSION }}"' wazuh/indexer_stack/wazuh-dashboard/dashboard-deploy.yaml
yq e -i '.spec.template.spec.containers[] |= select(.name == "wazuh-indexer").image = "${{ env.ECR_REGISTRY }}/wazuh/wazuh-indexer:${{ env.WAZUH_VERSION }}"' wazuh/indexer_stack/wazuh-indexer/cluster/indexer-sts.yaml
yq e -i '.spec.template.spec.initContainers[] |= select(.name == "init-wazuh-etc").image = "${{ env.ECR_REGISTRY }}/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}"' wazuh/wazuh_managers/wazuh-master-sts.yaml
yq e -i '.spec.template.spec.containers[] |= select(.name == "wazuh-manager").image = "${{ env.ECR_REGISTRY }}/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}"' wazuh/wazuh_managers/wazuh-master-sts.yaml
yq e -i '.spec.template.spec.initContainers[] |= select(.name == "init-wazuh-etc").image = "${{ env.ECR_REGISTRY }}/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}"' wazuh/wazuh_managers/wazuh-worker-sts.yaml
yq e -i '.spec.template.spec.containers[] |= select(.name == "wazuh-manager").image = "${{ env.ECR_REGISTRY }}/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}"' wazuh/wazuh_managers/wazuh-worker-sts.yaml
- name: Login to AWS ECR
run: |
aws ecr get-login-password --region ${{ env.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_REGISTRY }}
- name: Download Wazuh images
run: |
docker pull ${{ env.ECR_REGISTRY }}/wazuh/wazuh-dashboard:${{ env.WAZUH_VERSION }}
docker pull ${{ env.ECR_REGISTRY }}/wazuh/wazuh-indexer:${{ env.WAZUH_VERSION }}
docker pull ${{ env.ECR_REGISTRY }}/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}
- name: Load Wazuh images into Minikube
run: |
minikube image load ${{ env.ECR_REGISTRY }}/wazuh/wazuh-dashboard:${{ env.WAZUH_VERSION }}
minikube image load ${{ env.ECR_REGISTRY }}/wazuh/wazuh-indexer:${{ env.WAZUH_VERSION }}
minikube image load ${{ env.ECR_REGISTRY }}/wazuh/wazuh-manager:${{ env.WAZUH_VERSION }}
- name: Download Wazuh certificates tool and config files
run: |
cd wazuh/
curl -LO "https://packages-dev.wazuh.com/${{ env.WAZUH_MINOR }}/wazuh-certs-tool.sh"
curl -LO "https://packages-dev.wazuh.com/${{ env.WAZUH_MINOR }}/config.yml"
- name: Update config.yml file
run: |
yq e -i '.nodes.indexer[0].name = "indexer"' wazuh/config.yml
yq e -i '.nodes.indexer[0].ip = "127.0.0.1"' wazuh/config.yml
yq e -i '.nodes.server[0].name = "server"' wazuh/config.yml
yq e -i '.nodes.server[0].ip = "127.0.0.1"' wazuh/config.yml
yq e -i '.nodes.dashboard[0].ip = "127.0.0.1"' wazuh/config.yml
- name: Create Wazuh certificates
run: |
cd wazuh/
bash wazuh-certs-tool.sh -A
- name: Change provisioner for minikube
run: |
sed -i 's/provisioner: microk8s.io\/hostpath/# provisioner: microk8s.io\/hostpath/; s/# provisioner: k8s.io\/minikube-hostpath/provisioner: k8s.io\/minikube-hostpath/' envs/local-env/storage-class.yaml
- name: Update Wazuh ingress DNS
run: |
yq e -i ".spec.rules[0].host = \"localhost\"" wazuh/base/wazuh-ingress.yaml
- name: Deploy Wazuh stack
run: kubectl apply -k envs/local-env/
- name: Wait 10 minutes for Wazuh stack startup
run: sleep 10m
- name: Start minikube tunnel
run: |
minikube tunnel &> /dev/null &
sleep 30
- name: View stack status
run: kubectl get all -n wazuh -o wide
- name: Wazuh dashboard pod name
run: |
DASHBOARD_POD=$(kubectl get pods -n wazuh | grep wazuh-dashboard | awk '{print $1;}')
echo DASHBOARD_POD=$DASHBOARD_POD >> $GITHUB_ENV
- name: View Wazuh dashboard logs
run: kubectl logs ${{ env.DASHBOARD_POD }} -n wazuh
- name: View Wazuh indexer 0 logs
run: kubectl logs wazuh-indexer-0 -n wazuh
- name: View Wazuh manager master logs
run: kubectl logs wazuh-manager-master-0 -n wazuh
- name: View Wazuh manager worker 0 logs
run: kubectl logs wazuh-manager-worker-0 -n wazuh
- name: Run pytest
run: |
pytest tests/k8s_pytest.py -v --deployment-type local

View File

@@ -0,0 +1,14 @@
repository_bumper_*.log
wazuh/certs/indexer_cluster/*.pem
wazuh/certs/indexer_cluster/*.csr
wazuh/certs/indexer_cluster/*.srl
wazuh/certs/dashboard_http/*.pem
wazuh/certs/dashboard_http/*.csr
wazuh/certs/dashboard_http/*.srl
wazuh/config.yml
wazuh/wazuh-certs-tool.sh
wazuh/wazuh-certificates
wazuh/wazuh-certificates/*
wazuh/wazuh-certificates-tool.log
tests/__pycache__/
.pytest_cache/

View File

@@ -0,0 +1,754 @@
# Change Log
All notable changes to this project will be documented in this file.
## [5.0.0]
### Added
- Added Network Policies to Wazuh Kubernetes deployment. ([#1281](https://github.com/wazuh/wazuh-kubernetes/pull/1281))
- Add git cloning options to the documentation. ([#1280](https://github.com/wazuh/wazuh-kubernetes/pull/1280))
- Added wazuh-kubernetes PR checks. ([#1273](https://github.com/wazuh/wazuh-kubernetes/pull/1273))
### Changed
- Added Nginx ingress controller for Wazuh Kubernetes deployment. ([#1272](https://github.com/wazuh/wazuh-kubernetes/pull/1272))
- Modify deployment configuration in Kubernetes. ([#1268](https://github.com/wazuh/wazuh-kubernetes/pull/1268))
- Wazuh server clean-up ([#1213](https://github.com/wazuh/wazuh-kubernetes/pull/1213))
- Replace OpenSearch deprecated settings ([#1109](https://github.com/wazuh/wazuh-kubernetes/pull/1109))
### Fixed
- None
### Deleted
- None
## [4.14.3]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [4.14.2]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [4.14.1]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [4.14.0]
### Added
- None
### Changed
- Remove dashboard chat setting ([#1209](https://github.com/wazuh/wazuh-kubernetes/pull/1209))
- Rollback data source setting ([#1188](https://github.com/wazuh/wazuh-kubernetes/pull/1188))
- Dashboard settings added ([#1187](https://github.com/wazuh/wazuh-kubernetes/pull/1187))
### Fixed
- None
### Deleted
- None
## [4.14.0]
### Added
- None
### Changed
- None
### Fixed
- Add new config path and new permission for conf and certs files ([#1152](https://github.com/wazuh/wazuh-kubernetes/pull/1152))
### Deleted
- None
## [4.13.1]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [4.13.0]
### Added
- Add opensearch_dashboard.yml parameters. ([#1172](https://github.com/wazuh/wazuh-kubernetes/pull/1172))
- Add missing malicious-ioc ruleset lists ([#1092](https://github.com/wazuh/wazuh-kubernetes/pull/1092))
- Integrate bumper script via GitHub action. ([#1086](https://github.com/wazuh/wazuh-kubernetes/pull/1086))
- Added repository_bumper script. ([#1039](https://github.com/wazuh/wazuh-kubernetes/pull/1039))
### Changed
- Syscollector configuration change ([#1181](https://github.com/wazuh/wazuh-kubernetes/pull/1181))
### Fixed
- Change ports order ([#1183](https://github.com/wazuh/wazuh-kubernetes/pull/1183))
### Deleted
- Remove 'stable' branch ocurrencies ([#1014](https://github.com/wazuh/wazuh-kubernetes/pull/1014))
## [4.12.0]
### Added
- None
### Changed
- Change VERSION file format ([#985](https://github.com/wazuh/wazuh-kubernetes/pull/985)) \- (VERSION file)
### Fixed
- None
### Deleted
- None
## [4.11.2]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [4.11.1]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [4.11.0]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [4.10.1]
### Added
- None
### Changed
- None
### Fixed
- None
### Deleted
- None
## [4.10.0]
### Added
- None
### Changed
- None
### Fixed
- Add labelSelector ([#872](https://github.com/wazuh/wazuh-kubernetes/pull/872)) \- (Wazuh worker STS)
### Deleted
- None
## [4.9.2]
### Added
- Update to Wazuh version [4.9.2](https://github.com/wazuh/wazuh/blob/v4.9.2/CHANGELOG.md#v492)
## [4.9.1]
### Added
- Update to Wazuh version [4.9.1](https://github.com/wazuh/wazuh/blob/v4.9.1/CHANGELOG.md#v491)
## [4.9.0]
### Added
- Update to Wazuh version [4.9.0](https://github.com/wazuh/wazuh/blob/v4.9.0/CHANGELOG.md#v490)
## [4.8.2]
### Added
- Update to Wazuh version [4.8.2](https://github.com/wazuh/wazuh/blob/v4.8.2/CHANGELOG.md#v482)
## [4.8.1]
### Added
- Update to Wazuh version [4.8.1](https://github.com/wazuh/wazuh/blob/v4.8.1/CHANGELOG.md#v481)
## [4.8.0]
### Added
- Update to Wazuh version [4.8.0](https://github.com/wazuh/wazuh/blob/v4.8.0/CHANGELOG.md#v480)
## [4.7.5]
### Added
- Update to Wazuh version [4.7.5](https://github.com/wazuh/wazuh/blob/v4.7.5/CHANGELOG.md#v475)
## [4.7.4]
### Added
- Update to Wazuh version [4.7.4](https://github.com/wazuh/wazuh/blob/v4.7.4/CHANGELOG.md#v474)
## [4.7.3]
### Added
- Update to Wazuh version [4.7.3](https://github.com/wazuh/wazuh/blob/v4.7.3/CHANGELOG.md#v473)
## [4.7.2]
### Added
- Update to Wazuh version [4.7.2](https://github.com/wazuh/wazuh/blob/v4.7.2/CHANGELOG.md#v472)
## [4.7.1]
### Added
- Update to Wazuh version [4.7.1](https://github.com/wazuh/wazuh/blob/v4.7.1/CHANGELOG.md#v471)
## [4.7.0]
### Added
- Update to Wazuh version [4.7.0](https://github.com/wazuh/wazuh/blob/v4.7.0/CHANGELOG.md#v470)
## [4.6.0]
### Added
- Update to Wazuh version [4.6.0](https://github.com/wazuh/wazuh/blob/v4.6.0/CHANGELOG.md#v460)
## [4.5.4]
### Added
- Update to Wazuh version [4.5.4](https://github.com/wazuh/wazuh/blob/v4.5.4/CHANGELOG.md#v454)
## [4.5.3]
### Added
- Update to Wazuh version [4.5.3](https://github.com/wazuh/wazuh/blob/v4.5.3/CHANGELOG.md#v453)
## [4.5.2]
### Added
- Update to Wazuh version [4.5.2](https://github.com/wazuh/wazuh/blob/v4.5.2/CHANGELOG.md#v452)
## [4.5.1]
### Added
- Update to Wazuh version [4.5.1](https://github.com/wazuh/wazuh/blob/v4.5.1/CHANGELOG.md#v451)
## [4.5.0]
### Added
- Update to Wazuh version [4.5.0](https://github.com/wazuh/wazuh/blob/v4.5.0/CHANGELOG.md#v450)
## [4.4.5]
### Added
- Update to Wazuh version [4.4.5](https://github.com/wazuh/wazuh/blob/v4.4.5/CHANGELOG.md#v445)
## [4.4.4]
### Added
- Update to Wazuh version [4.4.4](https://github.com/wazuh/wazuh/blob/v4.4.4/CHANGELOG.md#v444)
## [4.4.3]
### Added
- Update to Wazuh version [4.4.3](https://github.com/wazuh/wazuh/blob/v4.4.3/CHANGELOG.md#v443)
## [4.4.2]
### Added
- Update to Wazuh version [4.4.2](https://github.com/wazuh/wazuh/blob/v4.4.2/CHANGELOG.md#v442)
## [4.4.1]
### Added
- Update to Wazuh version [4.4.1](https://github.com/wazuh/wazuh/blob/v4.4.1/CHANGELOG.md#v441)
## [4.4.0]
### Added
- Update to Wazuh version [4.4.0](https://github.com/wazuh/wazuh/blob/v4.4.0/CHANGELOG.md#v440)
## [4.3.11]
### Added
- Update to Wazuh version [4.3.11](https://github.com/wazuh/wazuh/blob/v4.3.11/CHANGELOG.md#v4311)
## [4.3.10]
### Added
- Update to Wazuh version [4.3.10](https://github.com/wazuh/wazuh/blob/v4.3.10/CHANGELOG.md#v4310)
## [4.3.9]
### Added
- Update to Wazuh version [4.3.9](https://github.com/wazuh/wazuh/blob/v4.3.9/CHANGELOG.md#v439)
## [4.3.8]
### Added
- Update to Wazuh version [4.3.8](https://github.com/wazuh/wazuh/blob/v4.3.8/CHANGELOG.md#v438)
## [4.3.7]
### Added
- Update to Wazuh version [4.3.7](https://github.com/wazuh/wazuh/blob/v4.3.7/CHANGELOG.md#v437)
## [4.3.6]
### Added
- Update to Wazuh version [4.3.6](https://github.com/wazuh/wazuh/blob/v4.3.6/CHANGELOG.md#v436)
## [4.3.5]
### Added
- Update to Wazuh version [4.3.5](https://github.com/wazuh/wazuh/blob/v4.3.5/CHANGELOG.md#v435)
## [4.3.4]
### Added
- Update to Wazuh version [4.3.4](https://github.com/wazuh/wazuh/blob/v4.3.4/CHANGELOG.md#v434)
## [4.3.3]
### Added
- Update to Wazuh version [4.3.3](https://github.com/wazuh/wazuh/blob/v4.3.3/CHANGELOG.md#v433)
## [4.3.2]
### Added
- Update to Wazuh version [4.3.2](https://github.com/wazuh/wazuh/blob/v4.3.2/CHANGELOG.md#v432)
## [4.3.1]
### Added
- Update to Wazuh version [4.3.1](https://github.com/wazuh/wazuh/blob/v4.3.1/CHANGELOG.md#v431)
## [4.3.0]
### Added
- Update to Wazuh version [4.3.0](https://github.com/wazuh/wazuh/blob/v4.3.0/CHANGELOG.md#v430)
## [4.2.7]
### Added
- Update to Wazuh version [4.2.7](https://github.com/wazuh/wazuh/blob/v4.2.7/CHANGELOG.md#v427)
## [4.2.6]
### Added
- Update to Wazuh version [4.2.6](https://github.com/wazuh/wazuh/blob/v4.2.6/CHANGELOG.md#v426)
## [4.2.5]
### Added
- Update to Wazuh version [4.2.5](https://github.com/wazuh/wazuh/blob/v4.2.5/CHANGELOG.md#v425)
## [4.2.4]
### Added
- Update to Wazuh version [4.2.4](https://github.com/wazuh/wazuh/blob/v4.2.4/CHANGELOG.md#v424)
## [4.2.3]
### Added
- Update to Wazuh version [4.2.3](https://github.com/wazuh/wazuh/blob/v4.2.3/CHANGELOG.md#v423)
## [4.2.2]
### Added
- Update to Wazuh version [4.2.2](https://github.com/wazuh/wazuh/blob/v4.2.2/CHANGELOG.md#v422)
## [4.2.1]
### Added
- Update to Wazuh version [4.2.1](https://github.com/wazuh/wazuh/blob/v4.2.1/CHANGELOG.md#v421)
## [4.2.0]
### Added
- Update to Wazuh version [4.2.0](https://github.com/wazuh/wazuh/blob/v4.2.0/CHANGELOG.md#v420)
## [4.1.5]
### Added
- Update to Wazuh version [4.1.5](https://github.com/wazuh/wazuh/blob/v4.1.5/CHANGELOG.md#v415)
## [4.1.1]
### Added
- Update to Wazuh version [4.1.1](https://github.com/wazuh/wazuh/blob/v4.1.1/CHANGELOG.md#v411)
## [4.1.0]
### Added
- Update to Wazuh version [4.1.0](https://github.com/wazuh/wazuh/blob/v4.1.0/CHANGELOG.md#v410)
- Use overlays to create multiple envs ([@xr09](https://github.com/xr09)) [PR#142](https://github.com/wazuh/wazuh-kubernetes/pull/142)
## Fixed
- Set DISABLE_INSTALL_DEMO_CONFIG ([@xr09](https://github.com/xr09)) [PR#146](https://github.com/wazuh/wazuh-kubernetes/pull/146)
## [4.0.4]
### Added
- Update to Wazuh version [4.0.4_1.11.0](https://github.com/wazuh/wazuh/blob/v4.0.4/CHANGELOG.md#v404)
## [4.0.3]
### Added
- Update to Wazuh version 4.0.3_1.11.0
### Fixed
- Specify `volumeBindingMode` on the storage class ([@gwvandesteeg](https://github.com/gwvandesteeg) [#116](https://github.com/wazuh/wazuh-kubernetes/issues/116))
## [4.0.2]
### Added
- Update to Wazuh version 4.0.2_1.11.0
- Support Opendistro for Elasticsearch v1.11.0
## [4.0.1]
### Added
- Update to Wazuh version 4.0.1_1.11.0
- Support Opendistro for Elasticsearch v1.11.0
## [4.0.0]
### Added
- Update to Wazuh version 4.0.0_1.10.1
- Support Opendistro for Elasticsearch v1.10.1
- Use a single wazuh-manager-worker StatefulSet ([@rjmoseley](https://github.com/rjmoseley) [#106](https://github.com/wazuh/wazuh-kubernetes/pull/106))
- Using Kubernetes secrets to store credentials ([@1stOfHisGame](https://github.com/1stOfHisGame) [#108](https://github.com/wazuh/wazuh-kubernetes/pull/108))
## [v3.13.2]
### Added
- Update to Wazuh version 3.13.2_7.9.1
### Fixed
- Increased Kibana max-old-space-size ([@DFolchA](https://github.com/DFolchA)) [#98](https://github.com/wazuh/wazuh-kubernetes/pull/98)
## [v3.13.1]
### Added
- Update to Wazuh version 3.13.1_7.8.0
## [v3.13.0]
### Added
- Update to Wazuh version 3.13.0_7.7.1
## [v3.12.3]
### Added
- Update to Wazuh version 3.12.3_7.6.2
## [v3.12.2]
### Added
- Update to Wazuh version 3.12.2_7.6.2
- Add reference to local-env branch on the readme ([@xr09](https://github.com/xr09)) [PR#82](https://github.com/wazuh/wazuh-kubernetes/pull/82)
### Fixed
- Path to elasticearch deployment yamls was outdated ([@jctello](https://github.com/jctello)) [PR#82](https://github.com/wazuh/wazuh-kubernetes/pull/84/commits/927b7dabc96d5c1c9f63981858661bba6206b6ef)
## [v3.12.0]
### Added
- Update to Wazuh version 3.12.0_7.6.1
## [v3.11.4]
### Added
- Update to Wazuh version 3.11.4_7.6.1
## [v3.11.3]
### Added
- Update to Wazuh version 3.11.4_7.6.1
## [v3.11.2]
### Added
- Update to Wazuh version 3.11.2_7.5.2
## [v3.11.1]
### Added
- Update to Wazuh version 3.11.1_7.5.1
## [v3.11.0]
### Added
- Update to Wazuh version 3.11.0_7.5.1
## [v3.10.2]
### Added
- Update to Wazuh version 3.10.2_7.3.2
## [v3.10.0]
### Added
- Update to Wazuh version 3.10.0_7.3.2
## [v3.9.5]
### Added
- Update to Wazuh version 3.9.5_7.2.1
### Changed
- Changed default Nginx login credentials ([jm404](https://github.com/jm404)) [#8b5ec11](https://github.com/wazuh/wazuh-kubernetes/commit/8b5ec111354cc71deae33fbc7182275a29272024)
- Changed resources limit for Wazuh Manager containers ([jm404](https://github.com/jm404)) [#ec6bc40](https://github.com/wazuh/wazuh-kubernetes/commit/ec6bc4020f8a4cfd3268a9947421bbe92a5808f1)
### Removed
- Deleted Logstash from repository ([jm404](https://github.com/jm404)) [#dae6c2f](https://github.com/wazuh/wazuh-kubernetes/commit/dae6c2f169b06d8c2534713bd8ec80b7ececc4dd)
- Deleted Postfix volume from Wazuh Managers ([jm404](https://github.com/jm404)) [#29fdf65](https://github.com/wazuh/wazuh-kubernetes/commit/29fdf652e6a4306e76035ade2d89d018ca008226)
## [v3.9.4]
### Added
- Update to Wazuh version 3.9.1_7.1.0
### Removed
- Deleted Logstash from repository ([jm404](https://github.com/jm404)) [#dae6c2f](https://github.com/wazuh/wazuh-kubernetes/commit/dae6c2f169b06d8c2534713bd8ec80b7ececc4dd)
## [v3.9.1]
- Update to Wazuh version 3.9.1_6.8.0
## [v3.9.0]
- Update to Wazuh version 3.9.0 ([#40](https://github.com/wazuh/wazuh-kubernetes/pull/38))
### Changed
- Use of Wazuh elasticsearch images ([manuasir](https://github.com/manuasir)) [#40](https://github.com/wazuh/wazuh-kubernetes/pull/40)
### Fixed
- Fix broken links of instructions.md ([#34](https://github.com/wazuh/wazuh-kubernetes/pull/34))
## [v3.8.1]
### Changed
- Update to Wazuh v3.8.1. ([#25](https://github.com/wazuh/wazuh-kubernetes/pull/25))
## [v3.8.0]
### Changed
- Upgrade Wazuh version 3.8.0. ([#23](https://github.com/wazuh/wazuh-kubernetes/pull/23))
## [v3.7.2]
### Added
- Add directory structre. ([#15](https://github.com/wazuh/wazuh-kubernetes/pull/15))
### Changed
- Update wazuh images to 3.7.2 6.5.4. ([#15](https://github.com/wazuh/wazuh-kubernetes/pull/15))
## [v3.7.1]
## [v3.7.0]
### Added
- Initial version

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,108 @@
# Wazuh Kubernetes
[![Slack](https://img.shields.io/badge/slack-join-blue.svg)](https://wazuh.com/community/join-us-on-slack/)
[![Email](https://img.shields.io/badge/email-join-blue.svg)](https://groups.google.com/forum/#!forum/wazuh)
[![Documentation](https://img.shields.io/badge/docs-view-green.svg)](https://documentation.wazuh.com)
[![Documentation](https://img.shields.io/badge/web-view-green.svg)](https://wazuh.com)
Deploy a Wazuh cluster with a basic indexer and dashboard stack on Kubernetes.
## Branches
* `main` branch contains the latest code, be aware of possible bugs on this branch.
## Documentation
## Amazon EKS development
To deploy a cluster on Amazon EKS cluster read the instructions on [instructions.md](instructions.md).
Note: For Kubernetes version 1.23 or higher, the assignment of an IAM Role is necessary for the CSI driver to function correctly. Within the AWS documentation you can find the instructions for the assignment: https://docs.aws.amazon.com/eks/latest/userguide/ebs-csi.html
The installation of the CSI driver is mandatory for new and old deployments if you are going to use Kubernetes 1.23 for the first time or you need to upgrade the cluster.
## Local development
To deploy a cluster on your local environment (like Minikube, Kind or Microk8s) read the instructions on [local-environment.md](local-environment.md).
## Diagram
![Wazuh Kubernetes Architecture](wazuh-namespace.png)
## Directory structure
├── CHANGELOG.md
├── cleanup.md
├── envs
│   ├── eks
│   │   ├── dashboard-resources.yaml
│   │   ├── indexer-resources.yaml
│   │   ├── kustomization.yml
│   │   ├── storage-class.yaml
│   │   ├── wazuh-master-resources.yaml
│   │   └── wazuh-worker-resources.yaml
│   └── local-env
│   ├── indexer-resources.yaml
│   ├── kustomization.yml
│   ├── storage-class.yaml
│   └── wazuh-resources.yaml
├── instructions.md
├── LICENSE
├── local-environment.md
├── README.md
├── upgrade.md
├── VERSION.json
└── wazuh
├── base
│   ├── storage-class.yaml
│   └── wazuh-ns.yaml
├── certs
│   ├── dashboard_http
│   │   └── generate_certs.sh
│   └── indexer_cluster
│   └── generate_certs.sh
├── indexer_stack
│   ├── wazuh-dashboard
│   │   ├── dashboard_conf
│   │   │   └── opensearch_dashboards.yml
│   │   ├── dashboard-deploy.yaml
│   │   └── dashboard-svc.yaml
│   └── wazuh-indexer
│   ├── cluster
│   │   ├── indexer-api-svc.yaml
│   │   └── indexer-sts.yaml
│   ├── indexer_conf
│   │   ├── internal_users.yml
│   │   └── opensearch.yml
│   └── indexer-svc.yaml
├── kustomization.yml
├── secrets
│   ├── dashboard-cred-secret.yaml
│   ├── indexer-cred-secret.yaml
│   ├── wazuh-api-cred-secret.yaml
│   ├── wazuh-authd-pass-secret.yaml
│   └── wazuh-cluster-key-secret.yaml
└── wazuh_managers
├── wazuh-cluster-svc.yaml
├── wazuh_conf
│   ├── master.conf
│   └── worker.conf
├── wazuh-master-sts.yaml
├── wazuh-master-svc.yaml
├── wazuh-workers-svc.yaml
└── wazuh-worker-sts.yaml
## Contribute
If you want to contribute to our project please don't hesitate to send a pull request. You can also join our users [mailing list](https://groups.google.com/d/forum/wazuh) or the [Wazuh Slack community channel](https://wazuh.com/community/join-us-on-slack/) to ask questions and participate in discussions.
## Credits and Thank you
Based on the previous work from JPLachance [coveo/wazuh-kubernetes](https://github.com/coveo/wazuh-kubernetes) (2018/11/22).
## License and copyright
WAZUH
Copyright (C) 2016, Wazuh Inc. (License GPLv2)
## References
* [Wazuh website](http://wazuh.com)

View File

@@ -0,0 +1,45 @@
# Wazuh Open Source Project Security Policy
Version: 2023-06-12
## Introduction
This document outlines the Security Policy for Wazuh's open source projects. It emphasizes our commitment to maintain a secure environment for our users and contributors, and reflects our belief in the power of collaboration to identify and resolve security vulnerabilities.
## Scope
This policy applies to all open source projects developed, maintained, or hosted by Wazuh.
## Reporting Security Vulnerabilities
If you believe you've discovered a potential security vulnerability in one of our open source projects, we strongly encourage you to report it to us responsibly.
Please submit your findings as security advisories under the "Security" tab in the relevant GitHub repository. Alternatively, you may send the details of your findings to [security@wazuh.com](mailto:security@wazuh.com).
## Vulnerability Disclosure Policy
Upon receiving a report of a potential vulnerability, our team will initiate an investigation. If the reported issue is confirmed as a vulnerability, we will take the following steps:
1. Acknowledgment: We will acknowledge the receipt of your vulnerability report and begin our investigation.
2. Validation: We will validate the issue and work on reproducing it in our environment.
3. Remediation: We will work on a fix and thoroughly test it
4. Release & Disclosure: After 90 days from the discovery of the vulnerability, or as soon as a fix is ready and thoroughly tested (whichever comes first), we will release a security update for the affected project. We will also publicly disclose the vulnerability by publishing a CVE (Common Vulnerabilities and Exposures) and acknowledging the discovering party.
5. Exceptions: In order to preserve the security of the Wazuh community at large, we might extend the disclosure period to allow users to patch their deployments.
This 90-day period allows for end-users to update their systems and minimizes the risk of widespread exploitation of the vulnerability.
## Automatic Scanning
We leverage GitHub Actions to perform automated scans of our supply chain. These scans assist us in identifying vulnerabilities and outdated dependencies in a proactive and timely manner.
## Credit
We believe in giving credit where credit is due. If you report a security vulnerability to us, and we determine that it is a valid vulnerability, we will publicly credit you for the discovery when we disclose the vulnerability. If you wish to remain anonymous, please indicate so in your initial report.
We do appreciate and encourage feedback from our community, but currently we do not have a bounty program. We might start bounty programs in the future.
## Compliance with this Policy
We consider the discovery and reporting of security vulnerabilities an important public service. We encourage responsible reporting of any vulnerabilities that may be found in our site or applications.
Furthermore, we will not take legal action against or suspend or terminate access to the site or services of those who discover and report security vulnerabilities in accordance with this policy because of the fact.
We ask that all users and contributors respect this policy and the security of our community's users by disclosing vulnerabilities to us in accordance with this policy.
## Changes to this Security Policy
This policy may be revised from time to time. Each version of the policy will be identified at the top of the page by its effective date.
If you have any questions about this Security Policy, please contact us at [security@wazuh.com](mailto:security@wazuh.com)

View File

@@ -0,0 +1,4 @@
{
"version": "5.0.0",
"stage": "alpha0"
}

View File

@@ -0,0 +1,27 @@
# Clean up
Steps to perform a clean up of our deployments, services and volumes used in our environment.
## Delete the cluster
To delete your Wazuh cluster just use `kubectl delete -k envs/<ENVIRONMENT>` from this repository directory. (being <ENVIRONMENT> one of `EKS` or `local-env`)
## Delete the persistent volumes manually.
Since we use `reclaimPolicy: Retain` in the storage class definition you must delete volumes manually if you want to clean these as well.
```
ubuntu@k8s-control-server:~$ kubectl get persistentvolume
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-024466da-f7c5-11e8-b9b8-022ada63b4ac 10Gi RWO Retain Released wazuh/wazuh-manager-worker-wazuh-manager-worker-1 wazuh-storage 6d
pvc-b3226ad3-f7c4-11e8-b9b8-022ada63b4ac 30Gi RWO Retain Bound wazuh/wazuh-elasticsearch-wazuh-elasticsearch-0 wazuh-storage 6d
pvc-fb821971-f7c4-11e8-b9b8-022ada63b4ac 10Gi RWO Retain Released wazuh/wazuh-manager-master-wazuh-manager-master-0 wazuh-storage 6d
pvc-ffe7bf66-f7c4-11e8-b9b8-022ada63b4ac 10Gi RWO Retain Released wazuh/wazuh-manager-worker-wazuh-manager-worker-0 wazuh-storage 6d
```
```
ubuntu@k8s-control-server:~$ kubectl delete persistentvolume pvc-b3226ad3-f7c4-11e8-b9b8-022ada63b4ac
```
Once these steps are completed, our Wazuh deployment will have been removed from the Kubernetes environment.

View File

@@ -0,0 +1,24 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
apiVersion: apps/v1
kind: Deployment
metadata:
name: wazuh-dashboard
namespace: wazuh
spec:
template:
spec:
containers:
- name: wazuh-dashboard
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
cpu: 400m
memory: 2Gi

View File

@@ -0,0 +1,35 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: wazuh-indexer
namespace: wazuh
spec:
template:
spec:
containers:
- name: wazuh-indexer
resources:
requests:
cpu: 500m
memory: 1Gi
limits:
cpu: 1
memory: 2Gi
volumeClaimTemplates:
- metadata:
name: wazuh-indexer
namespace: indexer-cluster
spec:
accessModes:
- ReadWriteOnce
storageClassName: wazuh-storage
resources:
requests:
storage: 10Gi

View File

@@ -0,0 +1,21 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../wazuh
- network-policies/allow-ingress-to-dashboard.yaml
- network-policies/allow-ingress-to-manager-master.yaml
- network-policies/allow-ingress-to-manager-worker.yaml
patches:
- path: storage-class.yaml
- path: indexer-resources.yaml
- path: dashboard-resources.yaml
- path: wazuh-master-resources.yaml
- path: wazuh-worker-resources.yaml

View File

@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-ingress-to-dashboard
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-dashboard
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: ingress-nginx
ports:
- protocol: TCP
port: 443

View File

@@ -0,0 +1,20 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-ingress-to-manager-master
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-manager
node-type: master
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: ingress-nginx
ports:
- protocol: TCP
port: 1515

View File

@@ -0,0 +1,20 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-ingress-to-manager-worker
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-manager
node-type: worker
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: ingress-nginx
ports:
- protocol: TCP
port: 1514

View File

@@ -0,0 +1,19 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh StorageClass
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: wazuh-storage
provisioner: kubernetes.io/aws-ebs
parameters:
encrypted: 'true'
type: gp2
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Retain # Useful in case you delete the PersistentVolumeClaim

View File

@@ -0,0 +1,35 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: wazuh-manager-master
namespace: wazuh
spec:
template:
spec:
containers:
- name: wazuh-manager
resources:
requests:
cpu: 1
memory: 1Gi
limits:
cpu: 2
memory: 2Gi
volumeClaimTemplates:
- metadata:
name: wazuh-manager-master
namespace: wazuh
spec:
accessModes:
- ReadWriteOnce
storageClassName: wazuh-storage
resources:
requests:
storage: 50Gi

View File

@@ -0,0 +1,35 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: wazuh-manager-worker
namespace: wazuh
spec:
template:
spec:
containers:
- name: wazuh-manager
resources:
requests:
cpu: 1
memory: 1Gi
limits:
cpu: 2
memory: 2Gi
volumeClaimTemplates:
- metadata:
name: wazuh-manager-worker
namespace: wazuh
spec:
accessModes:
- ReadWriteOnce
storageClassName: wazuh-storage
resources:
requests:
storage: 50Gi

View File

@@ -0,0 +1,25 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: wazuh-indexer
namespace: wazuh
spec:
replicas: 1
template:
spec:
containers:
- name: wazuh-indexer
resources:
requests:
cpu: 500m
memory: 1Gi
limits:
cpu: 1
memory: 2Gi

View File

@@ -0,0 +1,16 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../wazuh
patches:
- path: storage-class.yaml
- path: indexer-resources.yaml
- path: wazuh-resources.yaml

View File

@@ -0,0 +1,22 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh StorageClass
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: wazuh-storage
# Microk8s is our standard for local development
provisioner: microk8s.io/hostpath
# In case you're running Minikube you can comment the line above and use this one
# provisioner: k8s.io/minikube-hostpath
# If you're using a different provider you can list storage classes
# with: "kubectl get sc" and look for the column "Provisioner"

View File

@@ -0,0 +1,14 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: wazuh-manager-worker
namespace: wazuh
spec:
replicas: 1

View File

@@ -0,0 +1,357 @@
# Usage
This guide describes the necessary steps to deploy Wazuh on Kubernetes.
## Pre-requisites
- Kubernetes cluster already deployed.
- Kubernetes can run on a wide range of Cloud providers and bare-metal environments, this repository focuses on [AWS](https://aws.amazon.com/). It was tested using [Amazon EKS](https://docs.aws.amazon.com/eks). You should be able to:
- Create Persistent Volumes on top of AWS EBS when using a volumeClaimTemplates
- Create a record set in AWS Route 53 from a Kubernetes LoadBalancer.
- Having at least two Kubernetes nodes in order to meet the *podAntiAffinity* policy.
- For Kubernetes version 1.23 or higher, the assignment of an IAM Role is necessary for the CSI driver to function correctly. Within the AWS documentation you can find the instructions for the assignment: https://docs.aws.amazon.com/eks/latest/userguide/ebs-csi.html
- The installation of the CSI driver is necessary for new and old deployments, since it is a Kubernetes feature.
- Wazuh deployment includes Network policy configurations to restrict communication between pods. Verify if the EKS cluster configuration has Network policy configuration enabled.
## Overview
### StateFulSet and Deployments Controllers
Like a Deployment, a StatefulSet manages Pods that are based on an identical container specification, but it maintains an identity attached to each of its pods. These pods are created from the same specification, but they are not interchangeable: each one has a persistent identifier maintained across any rescheduling.
It is useful for stateful applications like databases that save the data to a persistent storage. The states of each Wazuh manager as well as Wazuh indexer are desirable to maintain, so we declare them using StatefulSet to ensure that they maintain their states in every startup.
Deployments are intended for stateless use and are quite lightweight and seem to be appropriate for Wazuh dashboard and Nginx, where it is not necessary to maintain the states.
### Pods
#### Wazuh master
This pod contains the master node of the Wazuh cluster. The master node centralizes and coordinates worker nodes, making sure the critical and required data is consistent across all nodes.
The management is performed only in this node, so the agent registration service (authd) and the API are placed here.
Details:
- Image: Docker Hub 'wazuh/wazuh-manager'
- Controller: StatefulSet
#### Wazuh worker 0 / 1
These pods contain a worker node of the Wazuh cluster. They will receive the agent events.
Details:
- Image: Docker Hub 'wazuh/wazuh-manager'
- Controller: StatefulSet
#### Wazuh indexer
Wazuh indexer pod. Used to build an Wazuh indexer cluster.
Details:
- Image: wazuh/wazuh-indexer
- Controller: StatefulSet
#### Wazuh dashboard
Wazuh dashboard pod. It lets you visualize your Wazuh indexer data, along with other features as the Wazuh app.
Details:
- image: Docker Hub 'wazuh/wazuh-dashboard'
- Controller: Deployment
### Services
#### Indexer stack
- wazuh-indexer:
- Communication for Wazuh indexer nodes.
- indexer:
- Wazuh indexer API. Used by Wazuh dashboard to write/read alerts.
- dashboard:
- Wazuh dashboard service. https://wazuh.your-domain.com:443
#### Wazuh
- wazuh:
- Wazuh API: wazuh-master.your-domain.com:55000
- Agent registration service (authd): wazuh-master.your-domain.com:1515
- wazuh-workers:
- Reporting service: wazuh-manager.your-domain.com:1514
- wazuh-cluster:
- Communication for Wazuh manager nodes.
### Network policies
- allow-dns
- Allows DNS traffic within the cluster.
- allow-ingress-to-dashboard
- Allows incoming traffic from the ingress controller to port 443 of wazuh-dashboard
- allow-ingress-to-manager-master
- Allows incoming traffic from the ingress controller to port 1515 of wazuh-manager (master)
- allow-ingress-to-manager-worker
- Allows incoming traffic from the ingress controller to port 1514 of wazuh-manager (worker)
- dashboard-egress
- Allows outgoing traffic from wazuh-dashboard pods to ports 9200 of wazuh-indexer and 55000 of wazuh-manager (master)
- default-deny-all
- Denies all incoming and outgoing traffic not explicitly declared in a network policy
- indexer-egress
- Allows outgoing traffic from wazuh-indexer pods to the Ports 9200 and 9300 of wazuh-indexer nodes
- indexer-ingress
- Allows incoming traffic from wazuh-dashboard (9200), wazuh-manager (9200), and wazuh-indexer (9300) pods to wazuh-indexer pods
- manager-egress-external
- Allows outgoing traffic from wazuh-manager pods to the internet (for downloading CTI)
- manager-egress
- Allows outgoing traffic from wazuh-manager pods to wazuh-indexer port 9200
- wazuh-api-ingress
- Allows incoming traffic from wazuh-dashboard (55000) and other wazuh-manager pods to port 1516
- wazuh-worker-egress
- Allows outgoing traffic from the wazuh-manager pods (workers) to wazuh-manager ports 1516 and 55000
## Deploy
### Step 1: Deploy Kubernetes
Deploying the Kubernetes cluster is out of the scope of this guide.
This repository focuses on [AWS](https://aws.amazon.com/) but it should be easy to adapt it to another Cloud provider. In case you are using AWS, we recommend [EKS](https://docs.aws.amazon.com/en_us/eks/latest/userguide/getting-started.html).
### Step 2: Create domains to access the services
We recommend creating domains and certificates to access the services. Examples:
- wazuh-master.your-domain.com: Wazuh API and authd registration service.
- wazuh-manager.your-domain.com: Reporting service.
- wazuh.your-domain.com: Wazuh dashboard app.
Note: You can skip this step and the services will be accessible using the Load balancer DNS from the VPC.
### Step 3: Deployment
Clone this repository to deploy the necessary services and pods.
```BASH
$ git clone https://github.com/wazuh/wazuh-kubernetes.git -b v5.0.0 --depth=1
$ cd wazuh-kubernetes
```
### Step 3.1: Setup SSL certificates
Wazuh uses certificates to establish confidentiality and encrypt communications between its central components. Follow these steps to create certificates for the Wazuh central components.
Download the `wazuh-certs-tool.sh` script. This creates the certificates that encrypt communications between the Wazuh central components.
#### 3.1.1 Download the Wazuh certificates tool script and config.yml file:
```
$ curl -sO https://packages.wazuh.com/5.0/wazuh-certs-tool.sh
$ curl -sO https://packages.wazuh.com/5.0/config.yml
```
#### 3.1.2 Edit the config.yml file with the configuration of the Wazuh components to be deployed
```
nodes:
# Wazuh indexer nodes
indexer:
- name: indexer
ip: "127.0.0.1"
server:
- name: server
ip: "127.0.0.1"
# Wazuh dashboard nodes
dashboard:
- name: dashboard
ip: "127.0.0.1"
```
#### 3.1.3 Run the Wazuh certificates tool script:
```
bash wazuh-certs-tool.sh -A
```
The required certificates are imported via secretGenerator on the `kustomization.yml` file:
secretGenerator:
- name: indexer-certs
files:
- wazuh-certificates/root-ca.pem
- wazuh-certificates/indexer.pem
- wazuh-certificates/indexer-key.pem
- wazuh-certificates/dashboard.pem
- wazuh-certificates/dashboard-key.pem
- wazuh-certificates/admin.pem
- wazuh-certificates/admin-key.pem
- wazuh-certificates/server.pem
- wazuh-certificates/server-key.pem
- name: dashboard-certs
files:
- wazuh-certificates/dashboard.pem
- wazuh-certificates/dashboard-key.pem
- wazuh-certificates/root-ca.pem
### Step 3.2: Apply Nginx ingress controller
To expose services outside the `EKS` cluster, we are using the Nginx ingress controller. To deploy it, we must run the following:
```BASH
$ kubectl apply -f nginx/nginx-ingress-controler.yaml
namespace/ingress-nginx created
serviceaccount/ingress-nginx created
serviceaccount/ingress-nginx-admission created
role.rbac.authorization.k8s.io/ingress-nginx created
role.rbac.authorization.k8s.io/ingress-nginx-admission created
clusterrole.rbac.authorization.k8s.io/ingress-nginx created
clusterrole.rbac.authorization.k8s.io/ingress-nginx-admission created
rolebinding.rbac.authorization.k8s.io/ingress-nginx created
rolebinding.rbac.authorization.k8s.io/ingress-nginx-admission created
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx created
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx-admission created
configmap/ingress-nginx-controller created
service/ingress-nginx-controller created
service/ingress-nginx-controller-admission created
configmap/wazuh-server-tcp created
deployment.apps/ingress-nginx-controller created
job.batch/ingress-nginx-admission-create created
job.batch/ingress-nginx-admission-patch created
ingressclass.networking.k8s.io/nginx created
validatingwebhookconfiguration.admissionregistration.k8s.io/ingress-nginx-admission created
```
```BASH
$ kubectl -n ingress-nginx get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx-controller LoadBalancer 10.100.228.67 a0c363db4315d484fa38751820a9e89b-e1811181631efef0.elb.us-west-1.amazonaws.com 80:30561/TCP,443:32533/TCP,1514:31784/TCP,1515:31274/TCP 36s
ingress-nginx-controller-admission ClusterIP 10.100.118.85 <none> 443/TCP 35s
```
### Step 3.3: Apply all manifests using kustomize
We are using the overlay feature of kustomize to create two variants: `eks` and `local-env`, in this guide we're using `eks`. (For a deployment on a local environment check the guide on [local-environment.md](local-environment.md))
You can adjust resources for the cluster on `envs/eks/`, you can tune cpu, memory as well as storage for persistent volumes of each of the cluster objects.
### Step 3.3.1: Update the Ingress host
For TLS Passthrough to work correctly, it is necessary to modify the ingress host `wazuh-ingress` with the `FQDN` of the load balancer obtained in the command `kubectl -n ingress-nginx get svc`
for example:
```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: wazuh-ingress
annotations:
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
spec:
ingressClassName: nginx
rules:
- host: a0c363db4315d484fa38751820a9e89b-e1811181631efef0.elb.us-west-1.amazonaws.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: dashboard
port:
number: 443
```
### Step 3.3.2: Deploy Wazuh cluster
By using the kustomization file on the `eks` variant we can now deploy the whole cluster with a single command:
```BASH
$ kubectl apply -k envs/eks/
```
### Verifying the deployment
#### Namespace
```BASH
$ kubectl get namespaces | grep wazuh
wazuh Active 12m
```
#### Services
```BASH
$ kubectl get services -n wazuh
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
dashboard ClusterIP 10.100.196.140 <none> 443/TCP 23m
wazuh-api ClusterIP 10.100.58.98 <none> 55000/TCP 23m
wazuh-cluster ClusterIP None <none> 1516/TCP 23m
wazuh-events ClusterIP 10.100.63.117 <none> 1514/TCP 23m
wazuh-indexer ClusterIP None <none> 9300/TCP,9200/TCP 23m
wazuh-registration ClusterIP 10.100.40.83 <none> 1515/TCP 23m
```
#### Deployments
```BASH
$ kubectl get deployments -n wazuh
NAME READY UP-TO-DATE AVAILABLE AGE
wazuh-dashboard 1/1 1 1 4h16m
```
#### Statefulsets
```BASH
$ kubectl get statefulsets -n wazuh
NAME READY AGE
wazuh-indexer 3/3 4h17m
wazuh-manager-master 1/1 4h17m
wazuh-manager-worker 2/2 4h17m
```
#### Pods
```BASH
$ kubectl get pods -n wazuh
NAME READY STATUS RESTARTS AGE
wazuh-dashboard-57d455f894-ffwsk 1/1 Running 0 4h17m
wazuh-indexer-0 1/1 Running 0 4h17m
wazuh-indexer-1 1/1 Running 0 4h17m
wazuh-indexer-2 1/1 Running 0 4h17m
wazuh-manager-master-0 1/1 Running 0 4h17m
wazuh-manager-worker-0 1/1 Running 0 4h17m
wazuh-manager-worker-1 1/1 Running 0 4h17m
```
#### Network Policies
```BASH
$ kubectl -n wazuh get networkpolicy
NAME POD-SELECTOR AGE
allow-dns <none> 51s
allow-ingress-to-dashboard app=wazuh-dashboard 50s
allow-ingress-to-manager-master app=wazuh-manager,node-type=master 49s
allow-ingress-to-manager-worker app=wazuh-manager,node-type=worker 48s
dashboard-egress app=wazuh-dashboard 47s
default-deny-all <none> 46s
indexer-egress app=wazuh-indexer 45s
indexer-ingress app=wazuh-indexer 44s
manager-egress app=wazuh-manager,node-type=master 43s
manager-egress-external app=wazuh-manager 42s
wazuh-api-ingress app=wazuh-manager,node-type=master 42s
wazuh-worker-egress app=wazuh-manager,node-type=worker 41s
```
#### Accessing Wazuh dashboard
In case you created domain names for the services, you should be able to access Wazuh dashboard using the proposed domain name: https://wazuh.your-domain.com.
Also, you can access using the External-IP (from the VPC): https://xxx-yyy-zzz.us-east-1.elb.amazonaws.com:443
```BASH
$ kubectl -n ingress-nginx get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx-controller LoadBalancer 10.100.228.67 a0c363db4315d484fa38751820a9e89b-e1811181631efef0.elb.us-west-1.amazonaws.com 80:30561/TCP,443:32533/TCP,1514:31784/TCP,1515:31274/TCP 36s
ingress-nginx-controller-admission ClusterIP 10.100.118.85 <none> 443/TCP 35s
```

View File

@@ -0,0 +1,143 @@
# Usage
This guide describes the necessary steps to deploy Wazuh on a local Kubernetes environment (Microk8s, Minikube, Kind).
Here we will describe the steps unique for a deployment on a local development scenario. For general knowledge read [instructions.md](instructions.md) as well which describes a deployment in more detail using an EKS cluster.
Wazuh deployment includes Network policy configurations to restrict communication between pods. This guide was created using MiniKube and Calico as the CNI.
## Pre-requisites
- Kubernetes cluster already deployed.
### Resource requirements
To deploy the `local-env` variant the Kubernetes cluster should have at least the following resources **available**:
- 2 CPU units
- 3 Gi of memory
- 2 Gi of storage
## Deployment
### Clone this repository.
```BASH
$ git clone https://github.com/wazuh/wazuh-kubernetes.git -b v5.0.0 --depth=1
$ cd wazuh-kubernetes
```
### Setup SSL certificates
Wazuh uses certificates to establish confidentiality and encrypt communications between its central components. Follow these steps to create certificates for the Wazuh central components.
Download the `wazuh-certs-tool.sh` script. This creates the certificates that encrypt communications between the Wazuh central components.
```BASH
cd wazuh/
curl -sO https://packages.wazuh.com/5.0/wazuh-certs-tool.sh
```
Run `wazuh-certs-tool.sh` to create the certificates.
```BASH
bash wazuh-certs-tool.sh -A
```
The required certificates are imported via secretGenerator on the `kustomization.yml` file:
secretGenerator:
- name: indexer-certs
files:
- wazuh-certificates/root-ca.pem
- wazuh-certificates/indexer.pem
- wazuh-certificates/indexer-key.pem
- wazuh-certificates/dashboard.pem
- wazuh-certificates/dashboard-key.pem
- wazuh-certificates/admin.pem
- wazuh-certificates/admin-key.pem
- wazuh-certificates/server.pem
- wazuh-certificates/server-key.pem
- name: dashboard-certs
files:
- wazuh-certificates/dashboard.pem
- wazuh-certificates/dashboard-key.pem
- wazuh-certificates/root-ca.pem
### Tune storage class with custom provisioner
Depending on the type of cluster you're running for local development the Storage Class may have a different provisioner.
You can check yours by running `kubectl get sc`. You will see something like this:
```BASH
~> kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
elk-gp2 microk8s.io/hostpath Delete Immediate false 67d
microk8s-hostpath (default) microk8s.io/hostpath Delete Immediate false 54d
```
The provisioner column displays `microk8s.io/hostpath`, you must edit the file `envs/local-env/storage-class.yaml` and setup this provisioner.
### Change Wazuh ingress host
To deploy correctly in a local environment, it is necessary to change the parameter `<UPDATE-WITH-THE-FQDN-OF-THE-INGRESS>` to `localhost` in the file `wazuh/base/wazuh-ingress.yaml`, for example:
```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: wazuh-ingress
annotations:
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
spec:
ingressClassName: nginx
rules:
- host: localhost
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: dashboard
port:
number: 443
```
### Apply all manifests using kustomize
We are using the overlay feature of kustomize two create two variants: `eks` and `local-env`, in this guide we're using `local-env`. (For a production deployment on EKS check the guide on [instructions.md](instructions.md))
It is possible to adjust resources for the cluster by editing patches on `envs/local-env/`, the number of replicas for Elasticsearch nodes and Wazuh workers are reduced on the `local-env` variant to save resources. This could be undone by removing these patches from the `kustomization.yaml` or alter the patches themselves with different values.
> **Note**: This guide was created using MiniKube and Calico as the CNI.
By using the kustomization file on the `local-env` variant we can now deploy the whole cluster with a single command:
```BASH
$ kubectl apply -k envs/local-env/
```
#### Accessing Dashboard
To access the Dashboard interface you can use port-forward:
```bash
$ kubectl -n wazuh port-forward service/dashboard 8443:443
```
Dashboard will be accesible on ``https://localhost:8443``.
#### Exposing Wazuh server ports
```BASH
$ kubectl -n wazuh port-forward service/wazuh-events 1514:1514
```
```BASH
$ kubectl -n wazuh port-forward service/wazuh-registration 1515:1515
```
> **Note**: You can run the process in background adding `&` to the port-forward command, for example: kubectl -n wazuh port-forward service/wazuh-events 1514:1514 &

View File

@@ -0,0 +1,699 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
name: ingress-nginx
---
apiVersion: v1
automountServiceAccountToken: true
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx
namespace: ingress-nginx
---
apiVersion: v1
automountServiceAccountToken: true
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission
namespace: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx
namespace: ingress-nginx
rules:
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- apiGroups:
- ""
resources:
- configmaps
- pods
- secrets
- endpoints
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- services
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses/status
verbs:
- update
- apiGroups:
- networking.k8s.io
resources:
- ingressclasses
verbs:
- get
- list
- watch
- apiGroups:
- coordination.k8s.io
resourceNames:
- ingress-nginx-leader
resources:
- leases
verbs:
- get
- update
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- list
- watch
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission
namespace: ingress-nginx
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx
rules:
- apiGroups:
- ""
resources:
- configmaps
- endpoints
- nodes
- pods
- secrets
- namespaces
verbs:
- list
- watch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- apiGroups:
- ""
resources:
- services
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- networking.k8s.io
resources:
- ingresses/status
verbs:
- update
- apiGroups:
- networking.k8s.io
resources:
- ingressclasses
verbs:
- get
- list
- watch
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- list
- watch
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission
rules:
- apiGroups:
- admissionregistration.k8s.io
resources:
- validatingwebhookconfigurations
verbs:
- get
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx
namespace: ingress-nginx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ingress-nginx
subjects:
- kind: ServiceAccount
name: ingress-nginx
namespace: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission
namespace: ingress-nginx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ingress-nginx-admission
subjects:
- kind: ServiceAccount
name: ingress-nginx-admission
namespace: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ingress-nginx
subjects:
- kind: ServiceAccount
name: ingress-nginx
namespace: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ingress-nginx-admission
subjects:
- kind: ServiceAccount
name: ingress-nginx-admission
namespace: ingress-nginx
---
apiVersion: v1
data: null
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-controller
namespace: ingress-nginx
---
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-type: nlb
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
externalTrafficPolicy: Local
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- appProtocol: http
name: http
port: 80
protocol: TCP
targetPort: http
- appProtocol: https
name: https
port: 443
protocol: TCP
targetPort: https
- name: wazuh-events
port: 1514
targetPort: 1514
protocol: TCP
- name: registration
port: 1515
targetPort: 1515
protocol: TCP
selector:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-controller-admission
namespace: ingress-nginx
spec:
ports:
- appProtocol: https
name: https-webhook
port: 443
targetPort: webhook
selector:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
name: wazuh-server-tcp
namespace: ingress-nginx
data:
"1514": "wazuh/wazuh-events:1514"
"1515": "wazuh/wazuh-registration:1515"
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
minReadySeconds: 0
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
strategy:
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
- --publish-service=$(POD_NAMESPACE)/ingress-nginx-controller
- --election-id=ingress-nginx-leader
- --controller-class=k8s.io/ingress-nginx
- --ingress-class=nginx
- --configmap=$(POD_NAMESPACE)/ingress-nginx-controller
- --validating-webhook=:8443
- --validating-webhook-certificate=/usr/local/certificates/cert
- --validating-webhook-key=/usr/local/certificates/key
- --tcp-services-configmap=ingress-nginx/wazuh-server-tcp
- --enable-ssl-passthrough
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: LD_PRELOAD
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.14.1@sha256:f95a79b85fb93ac3de752c71a5c27d5ceae10a18b61904dec224c1c6a4581e47
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
name: controller
ports:
- containerPort: 80
name: http
protocol: TCP
- containerPort: 443
name: https
protocol: TCP
- containerPort: 8443
name: webhook
protocol: TCP
- containerPort: 1514
name: wazuh-events
protocol: TCP
- containerPort: 1515
name: registration
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
requests:
cpu: 100m
memory: 90Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- ALL
readOnlyRootFilesystem: false
runAsGroup: 82
runAsNonRoot: true
runAsUser: 101
seccompProfile:
type: RuntimeDefault
volumeMounts:
- mountPath: /usr/local/certificates/
name: webhook-cert
readOnly: true
dnsPolicy: ClusterFirst
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: ingress-nginx
terminationGracePeriodSeconds: 300
volumes:
- name: webhook-cert
secret:
secretName: ingress-nginx-admission
---
apiVersion: batch/v1
kind: Job
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission-create
namespace: ingress-nginx
spec:
template:
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
- --host=ingress-nginx-controller-admission,ingress-nginx-controller-admission.$(POD_NAMESPACE).svc
- --namespace=$(POD_NAMESPACE)
- --secret-name=ingress-nginx-admission
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.6.5@sha256:03a00eb0e255e8a25fa49926c24cde0f7e12e8d072c445cdf5136ec78b546285
imagePullPolicy: IfNotPresent
name: create
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
restartPolicy: OnFailure
serviceAccountName: ingress-nginx-admission
ttlSecondsAfterFinished: 0
---
apiVersion: batch/v1
kind: Job
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission-patch
namespace: ingress-nginx
spec:
template:
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
- --webhook-name=ingress-nginx-admission
- --namespace=$(POD_NAMESPACE)
- --patch-mutating=false
- --secret-name=ingress-nginx-admission
- --patch-failure-policy=Fail
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.6.5@sha256:03a00eb0e255e8a25fa49926c24cde0f7e12e8d072c445cdf5136ec78b546285
imagePullPolicy: IfNotPresent
name: patch
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
restartPolicy: OnFailure
serviceAccountName: ingress-nginx-admission
ttlSecondsAfterFinished: 0
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: nginx
spec:
controller: k8s.io/ingress-nginx
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.14.1
name: ingress-nginx-admission
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: ingress-nginx-controller-admission
namespace: ingress-nginx
path: /networking/v1/ingresses
port: 443
failurePolicy: Fail
matchPolicy: Equivalent
name: validate.nginx.ingress.kubernetes.io
rules:
- apiGroups:
- networking.k8s.io
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- ingresses
sideEffects: None

View File

@@ -0,0 +1,16 @@
"""Pytest configuration for Wazuh Kubernetes tests"""
def pytest_addoption(parser):
"""Add custom command-line options"""
parser.addoption(
"--deployment-type",
action="store",
default="local",
help="Deployment type: local or eks"
)
parser.addoption(
"--dashboard-url",
action="store",
default="localhost",
help="Dashboard URL for testing"
)

View File

@@ -0,0 +1,102 @@
import subprocess
import pytest
import re
ADMIN_USER = "admin"
ADMIN_PASSWORD = "admin"
class TestWazuhKubernetes:
"""Test suite for Wazuh Kubernetes deployment"""
@pytest.fixture(scope="class")
def namespace(self):
"""Kubernetes namespace where Wazuh is deployed"""
return "wazuh"
@pytest.fixture(scope="class")
def dashboard_pod(self, namespace):
"""Get Wazuh dashboard pod name"""
cmd = f"kubectl -n {namespace} get pods -l app=wazuh-dashboard -o jsonpath='{{.items[0].metadata.name}}'"
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
return result.stdout.strip()
def test_indexer_cluster_health(self, namespace):
"""Check if Wazuh indexer cluster health is green"""
cmd = f'kubectl -n {namespace} exec -it wazuh-indexer-0 -- curl -XGET "https://localhost:9200/_cluster/health" -u {ADMIN_USER}:{ADMIN_PASSWORD} -k -s'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
print(f"Cluster health status: {result.stdout}")
assert "green" in result.stdout, "Cluster health is not green"
def test_indexer_indices_health(self, namespace):
"""Check if all Wazuh indexer indices are green"""
cmd = f'kubectl -n {namespace} exec -it wazuh-indexer-0 -- curl -XGET "https://localhost:9200/_cat/indices" -u {ADMIN_USER}:{ADMIN_PASSWORD} -k -s'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
print(f"Indices status:\n{result.stdout}")
lines = result.stdout.strip().split('\n')
lines_total = len([line for line in lines if line.strip()])
lines_green = len([line for line in lines if 'green' in line])
assert lines_total == lines_green, f"Not all indices are green: {lines_green}/{lines_total}"
def test_indexer_nodes_count(self, namespace, request):
"""Check if there are the expected number of Wazuh indexer nodes"""
deployment_type = request.config.getoption("--deployment-type", default="local")
expected_nodes = 3 if deployment_type == "eks" else 1
cmd = f'kubectl -n {namespace} exec -it wazuh-indexer-0 -- curl -XGET "https://localhost:9200/_cat/nodes" -u {ADMIN_USER}:{ADMIN_PASSWORD} -k -s'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
nodes_count = len(re.findall(r'indexer', result.stdout))
print(f"Deployment type: {deployment_type}")
print(f"Wazuh indexer nodes: {nodes_count}")
assert nodes_count == expected_nodes, f"Expected {expected_nodes} indexer nodes for {deployment_type} deployment, found {nodes_count}"
def test_wazuh_templates(self, namespace):
"""Check if Wazuh templates are present (more than 3)"""
cmd = f'kubectl -n {namespace} exec -it wazuh-indexer-0 -- curl -XGET "https://localhost:9200/_cat/templates" -u {ADMIN_USER}:{ADMIN_PASSWORD} -k -s'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
templates = re.findall(r'.*(?:wazuh|wazuh-agent|wazuh-statistics).*', result.stdout)
qty_templates = len(templates)
print("Wazuh templates:")
for template in templates:
print(template)
assert qty_templates > 3, f"Expected more than 3 templates, found {qty_templates}"
def test_manager_services_running(self, namespace):
"""Check if Wazuh manager has at least 10 services running"""
cmd = f'kubectl -n {namespace} exec -it wazuh-manager-master-0 -- /var/ossec/bin/wazuh-control status'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
print("Wazuh Manager services status:")
print(result.stdout)
running_services = len(re.findall(r'is running', result.stdout))
print(f"Running services: {running_services}")
assert running_services >= 10, f"Expected at least 10 running services, found {running_services}"
def test_dashboard_service_url(self, namespace, dashboard_pod, request):
"""Check if Wazuh dashboard service returns HTTP 200"""
dashboard_url = request.config.getoption("--dashboard-url", "localhost")
if dashboard_url == "localhost":
cmd = f'kubectl -n {namespace} exec -it {dashboard_pod} -- curl -XGET --silent https://{dashboard_url}/app/status -k -u {ADMIN_USER}:{ADMIN_PASSWORD} -I -s'
else:
cmd = f'curl -XGET --silent https://{dashboard_url}/app/status -k -u {ADMIN_USER}:{ADMIN_PASSWORD} -I -s'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
status_match = re.search(r'^HTTP.*?\s+(\d+)', result.stdout, re.MULTILINE)
status = int(status_match.group(1)) if status_match else 0
print(f"Wazuh dashboard status: {status}")
assert status == 200, f"Expected status 200, got {status}"
if __name__ == "__main__":
pytest.main([__file__, "-v", "--tb=short"])

View File

@@ -0,0 +1,176 @@
#!/bin/bash
# This script is used to update the version of a repository in the specified files.
# It takes a version number as an argument and updates the version in the specified files.
# Usage: ./repository_bumper.sh <version>
# Global variables
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
LOG_FILE="${DIR}/tools/repository_bumper_$(date +"%Y-%m-%d_%H-%M-%S-%3N").log"
VERSION=""
STAGE=""
FILES_EDITED=()
FILES_EXCLUDED='--exclude="repository_bumper_*.log" --exclude="CHANGELOG.md" --exclude="repository_bumper.sh" --exclude="*_bumper_repository.yml"'
get_old_version_and_stage() {
local VERSION_FILE="${DIR}/VERSION.json"
OLD_VERSION=$(jq -r '.version' "${VERSION_FILE}")
OLD_STAGE=$(jq -r '.stage' "${VERSION_FILE}")
echo "Old version: ${OLD_VERSION}" | tee -a "${LOG_FILE}"
echo "Old stage: ${OLD_STAGE}" | tee -a "${LOG_FILE}"
}
grep_command() {
# This function is used to search for a specific string in the specified directory.
# It takes two arguments: the string to search for and the directory to search in.
# Usage: grep_command <string> <directory>
eval grep -Rl "${1}" "${2}" --exclude-dir=".git" $FILES_EXCLUDED "${3}"
}
update_version_in_files() {
local OLD_MAYOR="$(echo "${OLD_VERSION}" | cut -d '.' -f 1)"
local OLD_MINOR="$(echo "${OLD_VERSION}" | cut -d '.' -f 2)"
local OLD_PATCH="$(echo "${OLD_VERSION}" | cut -d '.' -f 3)"
local NEW_MAYOR="$(echo "${VERSION}" | cut -d '.' -f 1)"
local NEW_MINOR="$(echo "${VERSION}" | cut -d '.' -f 2)"
local NEW_PATCH="$(echo "${VERSION}" | cut -d '.' -f 3)"
m_m_p_files=( $(grep_command "${OLD_MAYOR}\.${OLD_MINOR}\.${OLD_PATCH}" "${DIR}") )
for file in "${m_m_p_files[@]}"; do
sed -i "s/\bv${OLD_MAYOR}\.${OLD_MINOR}\.${OLD_PATCH}\b/v${NEW_MAYOR}\.${NEW_MINOR}\.${NEW_PATCH}/g; s/\b${OLD_MAYOR}\.${OLD_MINOR}\.${OLD_PATCH}/${NEW_MAYOR}\.${NEW_MINOR}\.${NEW_PATCH}/g" "${file}"
if [[ $(git diff --name-only "${file}") ]]; then
FILES_EDITED+=("${file}")
fi
done
m_m_files=( $(grep_command "${OLD_MAYOR}\.${OLD_MINOR}" "${DIR}") )
for file in "${m_m_files[@]}"; do
sed -i -E "/[0-9]+\.[0-9]+\.[0-9]+/! s/(^|[^0-9.])(${OLD_MAYOR}\.${OLD_MINOR})([^0-9.]|$)/\1${NEW_MAYOR}.${NEW_MINOR}\3/g" "$file"
if [[ $(git diff --name-only "${file}") ]]; then
FILES_EDITED+=("${file}")
fi
done
m_x_files=( $(grep_command "${OLD_MAYOR}\.x" "${DIR}" | grep -v "${DIR}/kitchen/README.md") )
for file in "${m_x_files[@]}"; do
sed -i "s/\b${OLD_MAYOR}\.x\b/${NEW_MAYOR}\.x/g" "${file}"
if [[ $(git diff --name-only "${file}") ]]; then
FILES_EDITED+=("${file}")
fi
done
if ! sed -i "/^All notable changes to this project will be documented in this file.$/a \\\n## [${VERSION}]\\n\\n### Added\\n\\n- None\\n\\n### Changed\\n\\n- None\\n\\n### Fixed\\n\\n- None\\n\\n### Deleted\\n\\n- None" "${DIR}/CHANGELOG.md"; then
echo "Error: Failed to update CHANGELOG.md" | tee -a "${LOG_FILE}"
fi
if [[ $(git diff --name-only "${DIR}/CHANGELOG.md") ]]; then
FILES_EDITED+=("${DIR}/CHANGELOG.md")
fi
}
update_stage_in_files() {
local OLD_STAGE="$(echo "${OLD_STAGE}")"
sed -i "s/${OLD_STAGE}/${STAGE}/g" "${DIR}/VERSION.json"
if [[ $(git diff --name-only "${DIR}/VERSION.json") ]]; then
FILES_EDITED+=("${DIR}/VERSION.json")
fi
}
update_docker_images_tag() {
local NEW_TAG="$1"
local DOCKERFILES=( $(grep_command -E "wazuh/wazuh-[a-zA-Z0-9._-]*" "${DIR}") )
for file in "${DOCKERFILES[@]}"; do
sed -i -E "s/(wazuh\/wazuh-[a-zA-Z0-9._-]*):[a-zA-Z0-9._-]+/\1:${NEW_TAG}/g" "${file}"
if [[ $(git diff --name-only "${file}") ]]; then
FILES_EDITED+=("${file}")
fi
done
}
main() {
echo "Starting repository version bumping process..." | tee -a "${LOG_FILE}"
echo "Log file: ${LOG_FILE}"
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--version)
VERSION="$2"
shift 2
;;
--stage)
STAGE="$2"
shift 2
;;
--tag)
TAG="$2"
shift 2
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
# Validate arguments
if [[ -z "${VERSION}" ]]; then
echo "Error: --version argument is required." | tee -a "${LOG_FILE}"
exit 1
fi
if [[ -z "${STAGE}" ]]; then
echo "Error: --stage argument is required." | tee -a "${LOG_FILE}"
exit 1
fi
# Validate if version is in the correct format
if ! [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Version must be in the format X.Y.Z (e.g., 1.2.3)." | tee -a "${LOG_FILE}"
exit 1
fi
# Validate if stage is in the correct format
STAGE=$(echo "${STAGE}" | tr '[:upper:]' '[:lower:]')
if ! [[ "${STAGE}" =~ ^(alpha[0-9]*|beta[0-9]*|rc[0-9]*|stable)$ ]]; then
echo "Error: Stage must be one of the following examples: alpha1, beta1, rc1, stable." | tee -a "${LOG_FILE}"
exit 1
fi
# Validate if tag is true or false
if [[ -n "$TAG" && ! "$TAG" =~ ^(true|false)$ ]]; then
echo "Error: --tag must be either true or false." | tee -a "${LOG_FILE}"
exit 1
fi
# Get old version and stage
get_old_version_and_stage
if [[ "${OLD_VERSION}" == "${VERSION}" && "${OLD_STAGE}" == "${STAGE}" ]]; then
echo "Version and stage are already up to date." | tee -a "${LOG_FILE}"
echo "No changes needed." | tee -a "${LOG_FILE}"
exit 0
fi
if [[ "${OLD_VERSION}" != "${VERSION}" ]]; then
echo "Updating version from ${OLD_VERSION} to ${VERSION}" | tee -a "${LOG_FILE}"
update_version_in_files "${VERSION}"
fi
if [[ "${OLD_STAGE}" != "${STAGE}" ]]; then
echo "Updating stage from ${OLD_STAGE} to ${STAGE}" | tee -a "${LOG_FILE}"
update_stage_in_files "${STAGE}"
fi
# Update Docker images tag if tag is true
if [[ "${TAG}" == "true" ]]; then
echo "Updating Docker images tag to ${VERSION}-${STAGE}" | tee -a "${LOG_FILE}"
update_docker_images_tag "${VERSION}-${STAGE}"
fi
echo "The following files were edited:" | tee -a "${LOG_FILE}"
for file in $(printf "%s\n" "${FILES_EDITED[@]}" | sort -u); do
echo "${file}" | tee -a "${LOG_FILE}"
done
echo "Version and stage updated successfully." | tee -a "${LOG_FILE}"
}
# Call the main method with all arguments
main "$@"

View File

@@ -0,0 +1,197 @@
# Wazuh Upgrade
When upgrading our version of Wazuh installed in Kubernetes we must follow the following steps.
## Check which files are exported to the volume
Our Kubernetes deployment uses our Wazuh images from Docker. If we look at the following code extracted from the Wazuh configuration using Docker we can see which directories and files are used in the upgrades.
```
PERMANENT_DATA[((i++))]="/var/ossec/api/configuration"
PERMANENT_DATA[((i++))]="/var/ossec/etc"
PERMANENT_DATA[((i++))]="/var/ossec/logs"
PERMANENT_DATA[((i++))]="/var/ossec/queue"
PERMANENT_DATA[((i++))]="/var/ossec/var/multigroups"
PERMANENT_DATA[((i++))]="/var/ossec/active-response/bin"
PERMANENT_DATA[((i++))]="/var/ossec/wodles"
```
Any file that we modify referring to the files previously mentioned, will be changed also the corresponding volume. When the corresponding Wazuh pod is created again, it will get the cited files from the volume, thus keeping the changes made previously.
To better understand it, we will give an example:
We have our newly created Kubernetes environment following our instructions. In this example, the image of Wazuh used has been `wazuh/wazuh:3.13.1_7.8.0`.
```
containers:
- name: wazuh-manager
image: 'wazuh/wazuh:3.13.2_7.9.1'
```
Let's proceed by creating a set of rules in our `local_rules.xml` file at location `/var/ossec/etc/rules` in our wazuh manager master pod.
```
root@wazuh-manager-master-0:/# vim /var/ossec/etc/rules/local_rules.xml
root@wazuh-manager-master-0:/# cat /var/ossec/etc/rules/local_rules.xml
<!-- Local rules -->
<!-- Modify it at your will. -->
<!-- Example -->
<group name="local,syslog,sshd,">
<!--
Dec 10 01:02:02 host sshd[1234]: Failed none for root from 1.1.1.1 port 1066 ssh2
-->
<rule id="100001" level="5">
<if_sid>5716</if_sid>
<srcip>1.1.1.1</srcip>
<description>sshd: authentication failed from IP 1.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
<rule id="100002" level="5">
<if_sid>5716</if_sid>
<srcip>2.1.1.1</srcip>
<description>sshd: authentication failed from IP 2.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
<rule id="100003" level="7">
<if_sid>5716</if_sid>
<srcip>3.1.1.1</srcip>
<description>sshd: authentication failed from IP 3.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
</group>
```
This action has modified the `local_rules.xml` file in the `/var/ossec/data/etc/rules` path and in the `/etc/postfix/etc/` rules path due these routes reference our volume assembly points.
```
volumeMounts:
- name: config
mountPath: /wazuh-config-mount/etc/ossec.conf
subPath: ossec.conf
readOnly: true
- name: wazuh-manager-master
mountPath: /var/ossec/data
- name: wazuh-manager-master
mountPath: /etc/postfix
```
We can see their content.
```
root@wazuh-manager-master-0:/# cat /var/ossec/data/etc/rules/local_rules.xml
<!-- Local rules -->
<!-- Modify it at your will. -->
<!-- Example -->
<group name="local,syslog,sshd,">
<!--
Dec 10 01:02:02 host sshd[1234]: Failed none for root from 1.1.1.1 port 1066 ssh2
-->
<rule id="100001" level="5">
<if_sid>5716</if_sid>
<srcip>1.1.1.1</srcip>
<description>sshd: authentication failed from IP 1.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
<rule id="100002" level="5">
<if_sid>5716</if_sid>
<srcip>2.1.1.1</srcip>
<description>sshd: authentication failed from IP 2.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
<rule id="100003" level="7">
<if_sid>5716</if_sid>
<srcip>3.1.1.1</srcip>
<description>sshd: authentication failed from IP 3.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
</group>
root@wazuh-manager-master-0:/# cat /etc/postfix/etc/rules/local_rules.xml
<!-- Local rules -->
<!-- Modify it at your will. -->
<!-- Example -->
<group name="local,syslog,sshd,">
<!--
Dec 10 01:02:02 host sshd[1234]: Failed none for root from 1.1.1.1 port 1066 ssh2
-->
<rule id="100001" level="5">
<if_sid>5716</if_sid>
<srcip>1.1.1.1</srcip>
<description>sshd: authentication failed from IP 1.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
<rule id="100002" level="5">
<if_sid>5716</if_sid>
<srcip>2.1.1.1</srcip>
<description>sshd: authentication failed from IP 2.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
<rule id="100003" level="7">
<if_sid>5716</if_sid>
<srcip>3.1.1.1</srcip>
<description>sshd: authentication failed from IP 3.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
</group>
```
At this point, if the pod was dropped or updated, Kubernetes would be in charge of creating a replica of it that would link to the volumes created and would maintain any changes referenced in the files and directories that we export to those volumes.
Once explained the operation regarding the volumes, we proceed to update Wazuh in two simple steps.
## 1. Change the image of the container
The first step is to change the image of the pod in each file that deploys each node of the Wazuh cluster.
These files are the statefulSet files:
- wazuh-master-sts.yaml
- wazuh-worker-sts.yaml
For example we had this version before:
```
containers:
- name: wazuh-manager
image: 'wazuh/wazuh:3.13.1_7.8.0'
```
And now we're going to upgrade to the next version:
```
containers:
- name: wazuh-manager
image: 'wazuh/wazuh:3.13.2_7.9.1'
```
## 2. Apply the new configuration
The second and last step is to apply the new configuration of each pod. For example for the wazuh manager master:
```
ubuntu@k8s-control-server:~/wazuh-kubernetes/manager_cluster$ kubectl apply -f wazuh-manager-master-sts.yaml
statefulset.apps "wazuh-manager-master" configured
```
This process will end the old pod while creating a new one with the new version, linked to the same volume. Once the Pods are booted, we will have our update ready and we can check the new version of Wazuh installed, the cluster and the changes that have been maintained through the use of the volumes.
### Note: It is important to update all Wazuh node pods, because the cluster only works when all nodes have the same version.

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 KiB

View File

@@ -0,0 +1,22 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-dns
namespace: wazuh
spec:
podSelector: {}
policyTypes:
- Egress
egress:
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- protocol: UDP
port: 53
- protocol: TCP
port: 53

View File

@@ -0,0 +1,10 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
namespace: wazuh
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress

View File

@@ -0,0 +1,14 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh StorageClass
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: wazuh-storage
# provisioner: k8s.io/minikube-hostpath

View File

@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: wazuh-ingress
annotations:
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
spec:
ingressClassName: nginx
rules:
- host: <UPDATE-WITH-THE-FQDN-OF-THE-INGRESS>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: dashboard
port:
number: 443

View File

@@ -0,0 +1,13 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh namespace
apiVersion: v1
kind: Namespace
metadata:
name: wazuh

View File

@@ -0,0 +1,98 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Dashboard Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: wazuh-dashboard
namespace: wazuh
spec:
replicas: 1
selector:
matchLabels:
app: wazuh-dashboard
template:
metadata:
labels:
app: wazuh-dashboard
name: wazuh-dashboard
spec:
volumes:
- name: config
configMap:
name: dashboard-conf
- name: dashboard-certs
secret:
secretName: dashboard-certs
containers:
- name: wazuh-dashboard
image: 'wazuh/wazuh-dashboard:5.0.0'
resources:
limits:
cpu: 500m
memory: 1Gi
volumeMounts:
- name: dashboard-certs
mountPath: /usr/share/wazuh-dashboard/config/certs/dashboard.pem
readOnly: true
subPath: dashboard.pem
- name: dashboard-certs
mountPath: /usr/share/wazuh-dashboard/config/certs/dashboard-key.pem
readOnly: true
subPath: dashboard-key.pem
- name: dashboard-certs
mountPath: /usr/share/wazuh-dashboard/config/certs/root-ca.pem
subPath: root-ca.pem
readOnly: true
ports:
- containerPort: 443
name: dashboard
env:
- name: OPENSEARCH_HOSTS
value: 'https://wazuh-indexer:9200'
- name: INDEXER_USERNAME
valueFrom:
secretKeyRef:
name: indexer-cred
key: username
- name: INDEXER_PASSWORD
valueFrom:
secretKeyRef:
name: indexer-cred
key: password
- name: DASHBOARD_USERNAME
valueFrom:
secretKeyRef:
name: dashboard-cred
key: username
- name: DASHBOARD_PASSWORD
valueFrom:
secretKeyRef:
name: dashboard-cred
key: password
- name: SERVER_SSL_ENABLED
value: "true"
- name: SERVER_SSL_CERTIFICATE
value: /usr/share/wazuh-dashboard/config/certs/dashboard.pem
- name: SERVER_SSL_KEY
value: /usr/share/wazuh-dashboard/config/certs/dashboard-key.pem
- name: OPENSEARCH_SSL_CERTIFICATE_AUTHORITIES
value: /usr/share/wazuh-dashboard/config/certs/root-ca.pem
- name: WAZUH_API_URL
value: https://wazuh-api
- name: API_USERNAME
valueFrom:
secretKeyRef:
name: wazuh-api-cred
key: username
- name: API_PASSWORD
valueFrom:
secretKeyRef:
name: wazuh-api-cred
key: password

View File

@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: dashboard-egress
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-dashboard
policyTypes:
- Egress
egress:
- to:
- podSelector:
matchLabels:
app: wazuh-indexer
ports:
- protocol: TCP
port: 9200
- to:
- podSelector:
matchLabels:
app: wazuh-manager
node-type: master
ports:
- protocol: TCP
port: 55000

View File

@@ -0,0 +1,23 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Dashboard service
apiVersion: v1
kind: Service
metadata:
name: dashboard
namespace: wazuh
labels:
app: wazuh-dashboard
spec:
selector:
app: wazuh-dashboard
ports:
- name: dashboard
port: 443
targetPort: 443

View File

@@ -0,0 +1,140 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Indexer StatefulSet: 3 master nodes.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: wazuh-indexer
namespace: wazuh
spec:
replicas: 3
selector:
matchLabels:
app: wazuh-indexer
serviceName: wazuh-indexer
template:
metadata:
labels:
app: wazuh-indexer
name: wazuh-indexer
spec:
securityContext:
fsGroup: 1000
# Set the wazuh-indexer volume permissions so the wazuh-indexer user can use it
volumes:
- name: indexer-certs
secret:
secretName: indexer-certs
defaultMode: 0600
initContainers:
- name: volume-mount-hack
image: busybox
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 100m
memory: 256Mi
command:
- sh
- '-c'
- 'chown -R 1000:1000 /var/lib/wazuh-indexer'
volumeMounts:
- name: wazuh-indexer
mountPath: /var/lib/wazuh-indexer
- name: increase-the-vm-max-map-count
image: busybox
command:
- sysctl
- -w
- vm.max_map_count=262144
securityContext:
privileged: true
containers:
- name: wazuh-indexer
image: 'wazuh/wazuh-indexer:5.0.0'
resources:
limits:
cpu: 500m
memory: 1564Mi
env:
- name: bootstrap.memory_lock
value: "false"
- name: network.host
value: "0.0.0.0"
- name: node.name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: cluster.initial_cluster_manager_nodes
value: wazuh-indexer-0
# For a 3-node cluster, all nodes should be listed here, if another node is added, it should be included as well
- name: discovery.seed_hosts
value: "wazuh-indexer-0.wazuh-indexer,wazuh-indexer-1.wazuh-indexer,wazuh-indexer-2.wazuh-indexer"
- name: node.max_local_storage_nodes
value: "3"
- name: plugins.security.allow_default_init_securityindex
value: "true"
- name: NODES_DN
value: CN=indexer,OU=Wazuh,O=Wazuh,L=California,C=US
- name: OPENSEARCH_JAVA_OPTS
value: '-Xms1g -Xmx1g -Dlog4j2.formatMsgNoLookups=true'
- name: DISCOVERY_SERVICE
value: wazuh-indexer
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: DISABLE_INSTALL_DEMO_CONFIG
value: 'true'
securityContext:
runAsUser: 1000
runAsGroup: 1000
capabilities:
add: ["SYS_CHROOT"]
volumeMounts:
- name: wazuh-indexer
mountPath: /var/lib/wazuh-indexer
- name: indexer-certs
mountPath: /usr/share/wazuh-indexer/config/certs/indexer-key.pem
subPath: indexer-key.pem
readOnly: true
- name: indexer-certs
mountPath: /usr/share/wazuh-indexer/config/certs/indexer.pem
subPath: indexer.pem
readOnly: true
- name: indexer-certs
mountPath: /usr/share/wazuh-indexer/config/certs/root-ca.pem
subPath: root-ca.pem
readOnly: true
- name: indexer-certs
mountPath: /usr/share/wazuh-indexer/config/certs/admin.pem
subPath: admin.pem
readOnly: true
- name: indexer-certs
mountPath: /usr/share/wazuh-indexer/config/certs/admin-key.pem
subPath: admin-key.pem
readOnly: true
ports:
- containerPort: 9200
name: indexer-rest
- containerPort: 9300
name: indexer-nodes
volumeClaimTemplates:
- metadata:
name: wazuh-indexer
namespace: indexer-cluster
spec:
accessModes:
- ReadWriteOnce
storageClassName: wazuh-storage
resources:
requests:
storage: 500Mi

View File

@@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: indexer-egress
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-indexer
policyTypes:
- Egress
egress:
- to:
- podSelector:
matchLabels:
app: wazuh-indexer
ports:
- protocol: TCP
port: 9300
- to:
- podSelector:
matchLabels:
app: wazuh-indexer
ports:
- protocol: TCP
port: 9200

View File

@@ -0,0 +1,34 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: indexer-ingress
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-indexer
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
app: wazuh-dashboard
ports:
- protocol: TCP
port: 9200
- from:
- podSelector:
matchLabels:
app: wazuh-manager
node-type: master
ports:
- protocol: TCP
port: 9200
- from:
- podSelector:
matchLabels:
app: wazuh-indexer
ports:
- protocol: TCP
port: 9300

View File

@@ -0,0 +1,27 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Indexer service: Communications
apiVersion: v1
kind: Service
metadata:
name: wazuh-indexer
namespace: wazuh
labels:
app: wazuh-indexer
spec:
selector:
app: wazuh-indexer
ports:
- name: indexer-nodes
port: 9300
targetPort: 9300
- name: indexer-rest
port: 9200
targetPort: 9200
clusterIP: None

View File

@@ -0,0 +1,63 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
# Adds wazuh namespace to all resources.
namespace: wazuh
secretGenerator:
- name: indexer-certs
files:
- wazuh-certificates/root-ca.pem
- wazuh-certificates/indexer.pem
- wazuh-certificates/indexer-key.pem
- wazuh-certificates/dashboard.pem
- wazuh-certificates/dashboard-key.pem
- wazuh-certificates/admin.pem
- wazuh-certificates/admin-key.pem
- wazuh-certificates/server.pem
- wazuh-certificates/server-key.pem
- name: dashboard-certs
files:
- wazuh-certificates/dashboard.pem
- wazuh-certificates/dashboard-key.pem
- wazuh-certificates/root-ca.pem
resources:
- base/wazuh-ns.yaml
- base/storage-class.yaml
- base/wazuh-ingress.yaml
- base/Allow-DNS-np.yaml
- base/default-deny-all.yaml
- secrets/wazuh-api-cred-secret.yaml
- secrets/wazuh-authd-pass-secret.yaml
- secrets/wazuh-cluster-key-secret.yaml
- secrets/dashboard-cred-secret.yaml
- secrets/indexer-cred-secret.yaml
- wazuh_managers/wazuh-cluster-svc.yaml
- wazuh_managers/wazuh-events-svc.yaml
- wazuh_managers/wazuh-registration-svc.yaml
- wazuh_managers/wazuh-api-svc.yaml
- wazuh_managers/wazuh-master-sts.yaml
- wazuh_managers/wazuh-worker-sts.yaml
- wazuh_managers/manager-egress.yaml
- wazuh_managers/manager-egress-external.yaml
- wazuh_managers/wazuh-master-ingress.yaml
- wazuh_managers/wazuh-worker-egress.yaml
- indexer_stack/wazuh-indexer/indexer-svc.yaml
- indexer_stack/wazuh-indexer/indexer-egress.yaml
- indexer_stack/wazuh-indexer/indexer-ingress.yaml
- indexer_stack/wazuh-indexer/cluster/indexer-sts.yaml
- indexer_stack/wazuh-dashboard/dashboard-deploy.yaml
- indexer_stack/wazuh-dashboard/dashboard-svc.yaml
- indexer_stack/wazuh-dashboard/dashboard-egress.yaml

View File

@@ -0,0 +1,16 @@
# Copyright (C) 2022 Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh dashboard API credentials secret
apiVersion: v1
kind: Secret
metadata:
name: dashboard-cred
data:
username: a2liYW5hc2VydmVy # string "kibanaserver" base64 encoded
password: a2liYW5hc2VydmVy # string "kibanaserver" base64 encoded

View File

@@ -0,0 +1,16 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh API credentials secret
apiVersion: v1
kind: Secret
metadata:
name: indexer-cred
data:
username: YWRtaW4= # string "admin" base64 encoded
password: YWRtaW4= # string "admin" base64 encoded

View File

@@ -0,0 +1,17 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh API credentials secret
apiVersion: v1
kind: Secret
metadata:
name: wazuh-api-cred
namespace: wazuh
data:
username: d2F6dWgtd3Vp # string "wazuh-wui" base64 encoded
password: TXlTM2NyMzdQNDUwci4qLQ== # string "MyS3cr37P450r.*-" base64 encoded

View File

@@ -0,0 +1,16 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh authd password secret
apiVersion: v1
kind: Secret
metadata:
name: wazuh-authd-pass
namespace: wazuh
data:
authd.pass: cGFzc3dvcmQ= # string "password" base64 encoded

View File

@@ -0,0 +1,16 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh cluster key secret
apiVersion: v1
kind: Secret
metadata:
name: wazuh-cluster-key
namespace: wazuh
data:
key: MTIzYTQ1YmM2N2RlZjg5MWdoMjNpNDVqazY3bDhtbjk= # string "123a45bc67def891gh23i45jk67l8mn9" base64 encoded

View File

@@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: manager-egress-external
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-manager
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: 0.0.0.0/0
ports:
- protocol: TCP
port: 443

View File

@@ -0,0 +1,20 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: manager-egress
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-manager
node-type: master
policyTypes:
- Egress
egress:
- to:
- podSelector:
matchLabels:
app: wazuh-indexer
ports:
- protocol: TCP
port: 9200

View File

@@ -0,0 +1,26 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh master Service: API and registration (authd)
apiVersion: v1
kind: Service
metadata:
name: wazuh-api
namespace: wazuh
labels:
app: wazuh-manager
annotations:
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
spec:
selector:
app: wazuh-manager
node-type: master
ports:
- name: api
port: 55000
targetPort: 55000

View File

@@ -0,0 +1,24 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh cluster Service: Manager nodes communication
apiVersion: v1
kind: Service
metadata:
name: wazuh-cluster
namespace: wazuh
labels:
app: wazuh-manager
spec:
selector:
app: wazuh-manager
ports:
- name: cluster
port: 1516
targetPort: 1516
clusterIP: None

View File

@@ -0,0 +1,24 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh workers service: Agent reporting
apiVersion: v1
kind: Service
metadata:
name: wazuh-events
namespace: wazuh
labels:
app: wazuh-manager
spec:
selector:
app: wazuh-manager
node-type: worker
ports:
- name: agents-events
port: 1514
targetPort: 1514

View File

@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: wazuh-api-ingress
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-manager
node-type: master
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
app: wazuh-dashboard
ports:
- protocol: TCP
port: 55000
- from:
- podSelector:
matchLabels:
app: wazuh-manager
ports:
- protocol: TCP
port: 1516

View File

@@ -0,0 +1,160 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh master StatefulSet
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: wazuh-manager-master
namespace: wazuh
spec:
replicas: 1
selector:
matchLabels:
app: wazuh-manager
node-type: master
serviceName: wazuh-cluster
podManagementPolicy: Parallel
template:
metadata:
labels:
app: wazuh-manager
node-type: master
name: wazuh-manager-master
spec:
volumes:
- name: wazuh-server-certs
secret:
secretName: indexer-certs
- name: wazuh-authd-pass
secret:
secretName: wazuh-authd-pass
securityContext:
fsGroup: 101
initContainers:
- name: init-wazuh-etc
image: 'wazuh/wazuh-manager:5.0.0'
command:
- /bin/sh
- -c
- |
if [ -z "$(ls -A /pvc-etc)" ]; then
cp -a /var/ossec/etc/* /pvc-etc/
fi
volumeMounts:
- name: wazuh-manager-master
mountPath: /pvc-etc
subPath: wazuh/var/ossec/etc
containers:
- name: wazuh-manager
image: 'wazuh/wazuh-manager:5.0.0'
resources:
limits:
cpu: 400m
memory: 512Mi
securityContext:
capabilities:
add: ["SYS_CHROOT"]
volumeMounts:
- name: wazuh-authd-pass
mountPath: /wazuh-config-mount/etc/authd.pass
subPath: authd.pass
readOnly: true
- name: wazuh-manager-master
mountPath: /var/ossec/api/configuration
subPath: wazuh/var/ossec/api/configuration
- name: wazuh-manager-master
mountPath: /var/ossec/etc
subPath: wazuh/var/ossec/etc
- name: wazuh-server-certs
mountPath: /var/ossec/etc/certs/root-ca.pem
readOnly: true
subPath: root-ca.pem
- name: wazuh-server-certs
mountPath: /var/ossec/etc/certs/server.pem
subPath: server.pem
readOnly: true
- name: wazuh-server-certs
mountPath: /var/ossec/etc/certs/server-key.pem
subPath: server-key.pem
readOnly: true
- name: wazuh-manager-master
mountPath: /var/ossec/logs
subPath: wazuh/var/ossec/logs
- name: wazuh-manager-master
mountPath: /var/ossec/queue
subPath: wazuh/var/ossec/queue
- name: wazuh-manager-master
mountPath: /var/ossec/var/multigroups
subPath: wazuh/var/ossec/var/multigroups
- name: wazuh-manager-master
mountPath: /var/ossec/active-response/bin
subPath: wazuh/var/ossec/active-response/bin
- name: wazuh-manager-master
mountPath: /var/ossec/wodles
subPath: wazuh/var/ossec/wodles
ports:
- containerPort: 1515
name: registration
- containerPort: 1516
name: cluster
- containerPort: 55000
name: api
env:
- name: WAZUH_INDEXER_HOSTS
value: 'wazuh-indexer:9200'
- name: WAZUH_NODE_NAME
value: 'master'
- name: WAZUH_NODE_TYPE
value: 'master'
- name: WAZUH_CLUSTER_BIND_ADDR
value: '0.0.0.0'
- name: WAZUH_CLUSTER_NODES
value: 'wazuh-cluster'
- name: INDEXER_USERNAME
valueFrom:
secretKeyRef:
name: indexer-cred
key: username
- name: INDEXER_PASSWORD
valueFrom:
secretKeyRef:
name: indexer-cred
key: password
- name: SSL_CERTIFICATE_AUTHORITIES
value: /var/ossec/etc/certs/root-ca.pem
- name: SSL_CERTIFICATE
value: /var/ossec/etc/certs/server.pem
- name: SSL_KEY
value: /var/ossec/etc/certs/server-key.pem
- name: API_USERNAME
valueFrom:
secretKeyRef:
name: wazuh-api-cred
key: username
- name: API_PASSWORD
valueFrom:
secretKeyRef:
name: wazuh-api-cred
key: password
- name: WAZUH_CLUSTER_KEY
valueFrom:
secretKeyRef:
name: wazuh-cluster-key
key: key
volumeClaimTemplates:
- metadata:
name: wazuh-manager-master
namespace: wazuh
spec:
accessModes:
- ReadWriteOnce
storageClassName: wazuh-storage
resources:
requests:
storage: 500Mi

View File

@@ -0,0 +1,24 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh master Service: API and registration (authd)
apiVersion: v1
kind: Service
metadata:
name: wazuh-registration
namespace: wazuh
labels:
app: wazuh-manager
spec:
selector:
app: wazuh-manager
node-type: master
ports:
- name: registration
port: 1515
targetPort: 1515

View File

@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: wazuh-worker-egress
namespace: wazuh
spec:
podSelector:
matchLabels:
app: wazuh-manager
node-type: worker
policyTypes:
- Egress
egress:
- to:
- podSelector:
matchLabels:
app: wazuh-manager
ports:
- protocol: TCP
port: 1516
- to:
- podSelector:
matchLabels:
app: wazuh-manager
ports:
- protocol: TCP
port: 55000

View File

@@ -0,0 +1,153 @@
# Copyright (C) 2019, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
# Wazuh workers StatefulSet
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: wazuh-manager-worker
namespace: wazuh
spec:
replicas: 2
selector:
matchLabels:
app: wazuh-manager
node-type: worker
serviceName: wazuh-cluster
podManagementPolicy: Parallel
template:
metadata:
labels:
app: wazuh-manager
node-type: worker
name: wazuh-manager-worker
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: wazuh-manager
node-type: worker
volumes:
- name: wazuh-server-certs
secret:
secretName: indexer-certs
initContainers:
- name: init-wazuh-etc
image: 'wazuh/wazuh-manager:5.0.0'
command:
- /bin/sh
- -c
- |
if [ -z "$(ls -A /pvc-etc)" ]; then
cp -a /var/ossec/etc/* /pvc-etc/
fi
volumeMounts:
- name: wazuh-manager-worker
mountPath: /pvc-etc
subPath: wazuh/var/ossec/etc
securityContext:
fsGroup: 101
containers:
- name: wazuh-manager
image: 'wazuh/wazuh-manager:5.0.0'
resources:
limits:
cpu: 400m
memory: 512Mi
securityContext:
capabilities:
add: ["SYS_CHROOT"]
volumeMounts:
- name: wazuh-manager-worker
mountPath: /var/ossec/api/configuration
subPath: wazuh/var/ossec/api/configuration
- name: wazuh-manager-worker
mountPath: /var/ossec/etc
subPath: wazuh/var/ossec/etc
- name: wazuh-server-certs
mountPath: /var/ossec/etc/certs/root-ca.pem
readOnly: true
subPath: root-ca.pem
- name: wazuh-server-certs
mountPath: /var/ossec/etc/certs/server.pem
subPath: server.pem
readOnly: true
- name: wazuh-server-certs
mountPath: /var/ossec/etc/certs/server-key.pem
subPath: server-key.pem
readOnly: true
- name: wazuh-manager-worker
mountPath: /var/ossec/logs
subPath: wazuh/var/ossec/logs
- name: wazuh-manager-worker
mountPath: /var/ossec/queue
subPath: wazuh/var/ossec/queue
- name: wazuh-manager-worker
mountPath: /var/ossec/var/multigroups
subPath: wazuh/var/ossec/var/multigroups
- name: wazuh-manager-worker
mountPath: /var/ossec/active-response/bin
subPath: wazuh/var/ossec/active-response/bin
- name: wazuh-manager-worker
mountPath: /var/ossec/wodles
subPath: wazuh/var/ossec/wodles
ports:
- containerPort: 1514
name: agents-events
- containerPort: 1516
name: cluster
env:
- name: WAZUH_INDEXER_HOSTS
value: 'wazuh-indexer:9200'
- name: WAZUH_NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: WAZUH_NODE_TYPE
value: 'worker'
- name: WAZUH_CLUSTER_BIND_ADDR
value: '0.0.0.0'
- name: WAZUH_CLUSTER_NODES
value: 'wazuh-cluster'
- name: INDEXER_USERNAME
valueFrom:
secretKeyRef:
name: indexer-cred
key: username
- name: INDEXER_PASSWORD
valueFrom:
secretKeyRef:
name: indexer-cred
key: password
- name: SSL_CERTIFICATE_AUTHORITIES
value: /var/ossec/etc/certs/root-ca.pem
- name: SSL_CERTIFICATE
value: /var/ossec/etc/certs/server.pem
- name: SSL_KEY
value: /var/ossec/etc/certs/server-key.pem
- name: WAZUH_CLUSTER_KEY
valueFrom:
secretKeyRef:
name: wazuh-cluster-key
key: key
volumeClaimTemplates:
- metadata:
name: wazuh-manager-worker
namespace: wazuh
spec:
accessModes:
- ReadWriteOnce
storageClassName: wazuh-storage
resources:
requests:
storage: 500Mi