|
| 1 | +One method for deploying and maintaining Wazuh is the `official |
| 2 | +Ansible playbooks <https://github.com/wazuh/wazuh-ansible>`_. These |
| 3 | +can be integrated into |kayobe_config| as a custom playbook. |
| 4 | + |
| 5 | +Configuring Wazuh Manager |
| 6 | +------------------------- |
| 7 | + |
| 8 | +Wazuh Manager is configured by editing the ``wazuh-manager.yml`` |
| 9 | +groups vars file found at |
| 10 | +``etc/kayobe/inventory/group_vars/wazuh-manager/``. This file |
| 11 | +controls various aspects of Wazuh Manager configuration. |
| 12 | +Most notably: |
| 13 | + |
| 14 | +*domain_name*: |
| 15 | + The domain used by Search Guard CE when generating certificates. |
| 16 | + |
| 17 | +*wazuh_manager_ip*: |
| 18 | + The IP address that the Wazuh Manager shall reside on for communicating with the agents. |
| 19 | + |
| 20 | +*wazuh_manager_connection*: |
| 21 | + Used to define port and protocol for the manager to be listening on. |
| 22 | + |
| 23 | +*wazuh_manager_authd*: |
| 24 | + Connection settings for the daemon responsible for registering new agents. |
| 25 | + |
| 26 | +Running ``kayobe playbook run |
| 27 | +$KAYOBE_CONFIG_PATH/ansible/wazuh-manager.yml`` will deploy these |
| 28 | +changes. |
| 29 | + |
| 30 | +Secrets |
| 31 | +------- |
| 32 | + |
| 33 | +Wazuh requires that secrets or passwords are set for itself and the services with which it communiticates. |
| 34 | +The playbook ``etc/kayobe/ansible/wazuh-secrets.yml`` automates the creation of these secrets, which should then be encrypted with Ansible Vault. |
| 35 | + |
| 36 | +To update the secrets you can execute the following two commands |
| 37 | + |
| 38 | +.. code-block:: shell |
| 39 | + :substitutions: |
| 40 | +
|
| 41 | + kayobe# kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-secrets.yml \ |
| 42 | + -e wazuh_user_pass=$(uuidgen) \ |
| 43 | + -e wazuh_admin_pass=$(uuidgen) |
| 44 | + kayobe# ansible-vault encrypt --vault-password-file |vault_password_file_path| \ |
| 45 | + $KAYOBE_CONFIG_PATH/inventory/group_vars/wazuh-manager/wazuh-secrets.yml |
| 46 | +
|
| 47 | +Once generated, run ``kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-manager.yml`` which copies the secrets into place. |
| 48 | + |
| 49 | +.. note:: Use ``ansible-vault`` to view the secrets: |
| 50 | + |
| 51 | + ``ansible-vault view --vault-password-file ~/vault.password $KAYOBE_CONFIG_PATH/inventory/group_vars/wazuh-manager/wazuh-secrets.yml`` |
| 52 | + |
| 53 | +Adding a New Agent |
| 54 | +------------------ |
| 55 | +The Wazuh Agent is deployed to all hosts in the ``wazuh-agent`` |
| 56 | +inventory group, comprising the ``seed`` group (containing |seed_name|) |
| 57 | +plus the ``overcloud`` group (containing all hosts in the |
| 58 | +OpenStack control plane). |
| 59 | + |
| 60 | +.. code-block:: ini |
| 61 | +
|
| 62 | + [wazuh-agent:children] |
| 63 | + seed |
| 64 | + overcloud |
| 65 | +
|
| 66 | +The following playbook deploys the Wazuh Agent to all hosts in the |
| 67 | +``wazuh-agent`` group: |
| 68 | + |
| 69 | +.. code-block:: shell |
| 70 | +
|
| 71 | + kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-agent.yml |
| 72 | +
|
| 73 | +The hosts running Wazuh Agent should automatically be registered |
| 74 | +and visible within the Wazuh Manager dashboard. |
| 75 | + |
| 76 | +.. note:: It is good practice to use a `Kayobe deploy hook |
| 77 | + <https://docs.openstack.org/kayobe/wallaby/custom-ansible-playbooks.html#hooks>`_ |
| 78 | + to automate deployment and configuration of the Wazuh Agent |
| 79 | + following a run of ``kayobe overcloud host configure``. |
| 80 | + |
| 81 | +Accessing Wazuh Manager |
| 82 | +----------------------- |
| 83 | + |
| 84 | +To access the Wazuh Manager dashboard, navigate to the ip address |
| 85 | +of |wazuh_manager_name| (|wazuh_manager_url|). |
| 86 | + |
| 87 | +You can login to the dashboard with the username ``admin``. The |
| 88 | +password for ``admin`` is defined in the secret |
| 89 | +``opendistro_admin_password`` which can be found within |
| 90 | +``etc/kayobe/inventory/group_vars/wazuh-manager/wazuh-secrets.yml``. |
| 91 | + |
| 92 | +.. note:: Use ``ansible-vault`` to view Wazuh secrets: |
| 93 | + |
| 94 | + ``ansible-vault view --vault-password-file ~/vault.password $KAYOBE_CONFIG_PATH/inventory/group_vars/wazuh-manager/wazuh-secrets.yml`` |
0 commit comments