Skip to content

Commit 97abe7d

Browse files
committed
Add docs for multinode wazuh
1 parent d95dfb1 commit 97abe7d

File tree

6 files changed

+112
-27
lines changed

6 files changed

+112
-27
lines changed

doc/source/configuration/wazuh.rst

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
Wazuh
33
=====
44

5+
The short version
6+
=================
7+
8+
#. Create an infrastructure VM for the Wazuh manager, and add it to the wazuh-manager group
9+
#. Configure the infrastructure VM with kayobe: ``kayobe infra vm host configure``
10+
#. Edit your config under
11+
``etc/kayobe/inventory/group_vars/wazuh-manager/wazuh-manager``, in
12+
particular the defaults assume that the ``provision_oc_net`` network will be
13+
used.
14+
#. Generate secrets: ``kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-secrets.yml``
15+
#. Encrypt the secrets: ``ansible-vault encrypt --vault-password-file ~/vault.password $KAYOBE_CONFIG_PATH/environments/ci-multinode/wazuh-secrets.yml``
16+
#. Deploy the Wazuh manager: ``kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-manager.yml``
17+
#. Deploy the Wazuh agents: ``kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-agent.yml``
18+
19+
520
Wazuh Manager
621
=============
722

@@ -74,8 +89,8 @@ Define network interfaces ``etc/kayobe/inventory/group_vars/wazuh-manager/networ
7489
7590
7691
The Wazuh manager may need to be exposed externally, in which case it may require another interface.
77-
This can be done as follows in ``etc/kayobe/inventory/group_vars/wazuh-manager/network-interfaces`` ,
78-
with the network defined in network.yml as usual.
92+
This can be done as follows in ``etc/kayobe/inventory/group_vars/wazuh-manager/network-interfaces``,
93+
with the network defined in ``networks.yml`` as usual.
7994

8095
.. code-block:: console
8196
@@ -128,18 +143,18 @@ Several services are used for the communication of Wazuh components. Below is th
128143
Manually provisioned VM
129144
-----------------------
130145

131-
In case where you can’t use infra-vms to deploy your wazuh-manager VM but you want to configure
132-
host using kayobe, there are some tips (note that depending on your setup this don’t have to always apply):
146+
In cases where you can’t use infra-vms to deploy your wazuh-manager VM but you want to configure
147+
the host using kayobe, here are some tips (note that depending on your setup this doesn't have to always apply):
133148

134-
* Depending on preferences host have to be part of some group in inventory. ``infra-vms`` group still seems as best choice
149+
* Depending on preferences, hosts have to be part of some group in inventory. ``infra-vms`` group still seems like the best choice.
135150
You can use ``kayobe infra vm host configure`` to configure host in this case.
136-
Bellow tips are based on assumption that infra-vm will be used.
137-
* user ``stack`` with password less sudo and accessible with ssh keys needs to be present on host.
151+
The tips below are based on the assumption that infra-vm will be used.
152+
* user ``stack`` with passwordless sudo and access with ssh keys needs to be present on the host.
138153
It can be achieved in many different ways, depending on your setup.
139154
* lvm configuration should be placed in ``host_vars/<host_name>``
140-
* wazuh-manager host have to be part of ``infra-vms`` group (directly or as child)
141-
* network used on host needs to be defined in ``networks.yml`` and
142-
if you have pre-alocated IP, it should be added to ``network-allocation.yml``.
155+
* wazuh-manager hosts have to be part of ``infra-vms`` group (directly or as child)
156+
* The network used on the host needs to be defined in ``networks.yml`` and
157+
if you have pre-alocated an IP, it should be added to ``network-allocation.yml``.
143158
For example, if using host with IP 10.10.224.5 in network 10.10.224.0/24 one have to add:
144159

145160

@@ -169,18 +184,18 @@ Deploying Wazuh Manager services
169184
Setup
170185
-----
171186

172-
To install specific version modify wazuh-ansible entry in ``etc/kayobe/ansible/requirements.yml``:
187+
To install a specific version modify the wazuh-ansible entry in ``etc/kayobe/ansible/requirements.yml``:
173188

174189
.. code-block:: console
175190
176191
roles:
177192
- name: wazuh-ansible
178193
src: https://github.com/stackhpc/wazuh-ansible
179-
version: stackhpc
194+
version: custom-branch
180195
181-
Version above was tested and verified, but there is no reason to use not different one.
196+
The default version has been tested and verified, but there is no reason not to use a different one.
182197

183-
Install the role:
198+
Reinstall the role if required:
184199

185200
``kayobe control host bootstrap``
186201

@@ -210,9 +225,10 @@ You may need to modify some of the variables, including:
210225
.. note::
211226

212227
NOTE:
213-
If you are using multiple environments, and you need to customise Wazuh in each environement, create override files in an appropriate directory,
228+
If you are using multiple environments, and you need to customise Wazuh in
229+
each environment, create override files in an appropriate directory,
214230
for example `etc/kayobe/environments/production/inventory/group_vars/`
215-
Files which values can be overridden (in context of Wazuh):
231+
Files which values can be overridden (in the context of Wazuh):
216232
- etc/kayobe/inventory/group_vars/wazuh/wazuh-manager/wazuh-manager
217233
- etc/kayobe/wazuh-manager.yml
218234
- etc/kayobe/inventory/group_vars/wazuh/wazuh-agent/wazuh-agent
@@ -259,7 +275,6 @@ does not exist, it will generate the following certificates in ``etc/kayobe/ansi
259275
* root-ca.key root-ca.pem
260276

261277

262-
263278
It is also possible to use externally generated certificates for wazuh-dashboard. root-ca.pem should contain the CA chain.
264279
Those certificates can be uploaded to ``etc/kayobe/ansible/wazuh/custom_certificates``,
265280
and will replace certificates generated by wazuh.

doc/source/contributor/environments/ci-multinode.rst

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,77 @@ with:
324324
325325
There are various other options for sonobuoy, see the `documentation
326326
<https://sonobuoy.io/docs/>`_ for more details.
327+
328+
Wazuh
329+
======
330+
331+
Adding Wazuh to a new deployment
332+
--------------------------------
333+
334+
Wazuh is supported but not deployed by default. If you are using the standard
335+
[StackHPC multinode
336+
terraform](https://github.com/stackhpc/terraform-kayobe-multinode), there is a
337+
``deploy_wazuh`` terraform variable that will add it to the automated setup.
338+
339+
Adding Wazuh to an existing deployment
340+
--------------------------------------
341+
342+
Create an additional VM with the same basic configuration (key, image, flavour
343+
etc.) as the existing deployment.
344+
345+
Add the IP and hostname to ``/etc/hosts`` on the ansible control host.
346+
347+
Add the hostname to the ``[wazuh-manager]`` group in
348+
``$KAYOBE_CONFIG_PATH/environments/ci-multinode/inventory/hosts``.
349+
350+
Add the host to the ``[infra-vms]`` group, either directly or by making the
351+
``wazuh-manager`` group a child group of ``infra-vms``.
352+
353+
Create the following directory structure:
354+
``$KAYOBE_CONFIG_PATH/hooks/infra-vm-host-configure/pre.d/``
355+
356+
Either copy or symlink in the growroot, networking, and vxlan playbooks as
357+
shown in ``$KAYOBE_CONFIG_PATH/hooks/seed-host-configure/pre.d/``.
358+
359+
Configure the Wazuh manager VM:
360+
361+
.. code-block:: bash
362+
363+
kayobe infra vm host configure
364+
365+
Create and encrypt the Wazuh secrets
366+
367+
.. code-block:: bash
368+
369+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-secrets.yml
370+
ansible-vault encrypt --vault-password-file ~/vault.password $KAYOBE_CONFIG_PATH/environments/ci-multinode/wazuh-secrets.yml
371+
372+
Run the Wazuh manager and agent deployment playbooks:
373+
374+
.. code-block:: bash
375+
376+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-manager.yml
377+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-agent.yml
378+
379+
Wazuh should now be fully deployed. To test the service, you can use sshuttle
380+
or some other forwarding protocol to access the Wazuh dashboard.
381+
382+
.. code-block:: bash
383+
384+
sshuttle -r <wazuh-manager-hostname> <wazuh-manager-ip>
385+
386+
The above example assumes an SSH configuration that allows access with
387+
``ssh <wazuh-manager-hostname>``.
388+
389+
Open ``https://<wazuh-manager-ip>/`` in a web browser, and you should see a
390+
login screen.
391+
392+
The default username is ``admin`` and the password is the
393+
``opendistro_admin_password`` which can be found in ``wazuh-secrets.yml`` e.g.
394+
395+
.. code-block:: bash
396+
397+
ansible-vault view $KAYOBE_CONFIG_PATH/environments/ci-multinode/wazuh-secrets.yml --vault-password-file ~/vault.password | grep opendistro_admin_password
398+
399+
If the deployment has been successful, you should be able to see a Wazuh agent
400+
for each host in your deployment (aside from the Wazuh manager itself).

etc/kayobe/ansible/configure-vxlan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Configure VXLAN
3-
hosts: "{{ configure_vxlan_playbook_hosts | default('seed,compute,controllers,storage') }}"
3+
hosts: controllers,compute,infra-vms,seed,storage
44
gather_facts: true
55
vars:
66
ansible_user: "{{ bootstrap_user }}"

etc/kayobe/ansible/fix-networking.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Fix networking
3-
hosts: "{{ fix_networking_playbook_hosts | default('seed,compute,controllers,storage') }}"
3+
hosts: controllers,compute,infra-vms,seed,storage
44
gather_facts: false
55
vars:
66
ansible_user: "{{ bootstrap_user }}"

etc/kayobe/environments/ci-multinode/stackhpc-ci.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ kolla_docker_namespace: stackhpc-dev
1212
# hostname.
1313
resolv_is_managed: false
1414

15-
###############################################################################
16-
# Hook playbook configuration.
17-
18-
# Infrastructure VMs in a multinode deployment are deployed as separate hosts,
19-
# so need the same extra configuration as any other host.
20-
fix_networking_playbook_hosts: 'seed,compute,controllers,storage,infra-vms'
21-
configure_vxlan_playbook_hosts: 'seed,compute,controllers,storage,infra-vms'
22-
2315
###############################################################################
2416
# StackHPC configuration.
2517

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
features:
3+
- |
4+
Added support for Wazuh in the ci-multinode environment.

0 commit comments

Comments
 (0)