-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update wazuh.rst to better explain how to use TLS #1105
base: stackhpc/2023.1
Are you sure you want to change the base?
Conversation
Include the need to ``export KAYOBE_VAULT_PASSWORD`` before running the wazuh secrets playbook and state that wazuh-secrets.yml are encrypted post templating.
@MaxBed4d let's go through this together next week and update the wording a bit so we can get this merged |
@@ -11,8 +11,8 @@ The short version | |||
``etc/kayobe/inventory/group_vars/wazuh-manager/wazuh-manager``, in | |||
particular the defaults assume that the ``provision_oc_net`` network will be | |||
used. | |||
#. Ensure to export vault password: ``export KAYOBE_VAULT_PASSWORD={ansible_vault_password}`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#. Ensure to export vault password: ``export KAYOBE_VAULT_PASSWORD={ansible_vault_password}`` | |
#. Export the Ansible vault password e.g. : ``export KAYOBE_VAULT_PASSWORD=$(cat path/to/vault/password/file)`` |
@@ -241,16 +241,17 @@ Wazuh secrets playbook is located in ``etc/kayobe/ansible/wazuh-secrets.yml``. | |||
Running this playbook will generate and put pertinent security items into secrets | |||
vault file which will be placed in ``$KAYOBE_CONFIG_PATH/wazuh-secrets.yml``. | |||
If using environments it ends up in ``$KAYOBE_CONFIG_PATH/environments/<env_name>/wazuh-secrets.yml`` | |||
Remember to encrypt! | |||
The secrets will be encrypted after templating and so requires that ``KAYOBE_VAULT_PASSWORD`` is set and exported before running the playbook! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The secrets will be encrypted after templating and so requires that ``KAYOBE_VAULT_PASSWORD`` is set and exported before running the playbook! | |
The secrets will be encrypted after templating. Ensure that ``KAYOBE_VAULT_PASSWORD`` is set and exported before running the playbook! |
|
||
|
||
.. code-block:: console | ||
|
||
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-secrets.yml | ||
ansible-vault encrypt --vault-password-file ~/vault.pass $KAYOBE_CONFIG_PATH/wazuh-secrets.yml | ||
|
||
To view ``wazuh-secrets.yml`` simply ``ansible-vault view --vault-password-file ~/vault.pass $KAYOBE_CONFIG_PATH/wazuh-secrets.yml`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To view ``wazuh-secrets.yml`` simply ``ansible-vault view --vault-password-file ~/vault.pass $KAYOBE_CONFIG_PATH/wazuh-secrets.yml`` | |
To view ``wazuh-secrets.yml``: | |
..code-block:: console | |
ansible-vault view --vault-password-file path/to/vault/password/file $KAYOBE_CONFIG_PATH/wazuh-secrets.yml | |
In order to use externally generated certificates, you must first deploy Wazuh Ansible as normal in order to generate the base certificates. | ||
This is because Wazuh will require to deploy with some sort of certificates, as well as, not every Wazuh service needing a custom external certificate; | ||
for example the ``root`` and ``admin`` certificates. Therefore the ``<...>/wazuh/wazuh-certificates`` directory must be created and populated by ``wazuh-cert-tool.sh``, which it won't do if the ``<...>/wazuh/wazuh-certificates`` directory already exists. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the existing text is correct, the "why" section makes it much more confusing.
In order to use externally generated certificates, you must first deploy Wazuh Ansible as normal in order to generate the base certificates. | |
This is because Wazuh will require to deploy with some sort of certificates, as well as, not every Wazuh service needing a custom external certificate; | |
for example the ``root`` and ``admin`` certificates. Therefore the ``<...>/wazuh/wazuh-certificates`` directory must be created and populated by ``wazuh-cert-tool.sh``, which it won't do if the ``<...>/wazuh/wazuh-certificates`` directory already exists. | |
To use externally generated certificates, you must first deploy Wazuh Ansible as normal to generate the base certificates. The custom certificates can then be added to this bundle. |
Once the Wazuh generated certificates have been made, the desired custom external certificates need to be added in. | ||
To do so, must ``SSH`` into the ``infra VM`` which Wazuh services have been deployed to and, with ``sudo`` privileges, | ||
remove any of the 'base' certificates from ``/etc/wazuh-{dashboard | indexer}/certs/`` which are being replaced with custom ones. | ||
After this, return to the ``seed`` VM and drop the custom new ``pem`` certificates into ``$KAYOBE_CONFIG_PATH/environments/<environment>/wazuh/wazuh-certificates/`` if using a kayobe environment, or ``$KAYOBE_CONFIG_PATH/wazuh/wazuh-certificates/`` if not. | ||
Finally, rerun the Wazuh Ansible playbook and now the custom certificates should be copied over to their respective directories in the ``infra VM``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes here to wording, just to make it a bit clearer and more generic (e.g. not all wazuh-managers are infra VMs)
Once the Wazuh generated certificates have been made, the desired custom external certificates need to be added in. | |
To do so, must ``SSH`` into the ``infra VM`` which Wazuh services have been deployed to and, with ``sudo`` privileges, | |
remove any of the 'base' certificates from ``/etc/wazuh-{dashboard | indexer}/certs/`` which are being replaced with custom ones. | |
After this, return to the ``seed`` VM and drop the custom new ``pem`` certificates into ``$KAYOBE_CONFIG_PATH/environments/<environment>/wazuh/wazuh-certificates/`` if using a kayobe environment, or ``$KAYOBE_CONFIG_PATH/wazuh/wazuh-certificates/`` if not. | |
Finally, rerun the Wazuh Ansible playbook and now the custom certificates should be copied over to their respective directories in the ``infra VM``. | |
Once the Wazuh generated certificates have been made, the custom external certificates need to be added in. To do so, ssh into the Wazuh Manager and remove any of the 'base' certificates from ``/etc/wazuh-{dashboard | indexer}/certs/`` which are being replaced with custom ones. | |
Return to the ``seed`` and drop the custom ``pem`` certificates into ``$KAYOBE_CONFIG_PATH/environments/<environment>/wazuh/wazuh-certificates/`` if using a kayobe environment, or ``$KAYOBE_CONFIG_PATH/wazuh/wazuh-certificates/`` if not. | |
Finally, rerun the Wazuh Ansible playbook to deploy the custom certificates. |
After this, return to the ``seed`` VM and drop the custom new ``pem`` certificates into ``$KAYOBE_CONFIG_PATH/environments/<environment>/wazuh/wazuh-certificates/`` if using a kayobe environment, or ``$KAYOBE_CONFIG_PATH/wazuh/wazuh-certificates/`` if not. | ||
Finally, rerun the Wazuh Ansible playbook and now the custom certificates should be copied over to their respective directories in the ``infra VM``. | ||
|
||
Following this, the ``sudo systemctl status`` for the three Wazuh services should be checked to make sure they are up and running with no errors. Additionally, testing ``sudo filebeat test output`` and trying to ``curl`` the service's IP will also signify if the certificates are working correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following this, the ``sudo systemctl status`` for the three Wazuh services should be checked to make sure they are up and running with no errors. Additionally, testing ``sudo filebeat test output`` and trying to ``curl`` the service's IP will also signify if the certificates are working correctly. | |
Ensure the systemd units for the three Wazuh services are healthy. Additionally, testing ``sudo filebeat test output`` and trying to ``curl`` the service's IP will also signify if the certificates are working correctly. |
.. note:: | ||
|
||
If you find that your Wazuh playbook isn't generating some of the non custom 'base' certificates, | ||
such as the ``indexer`` or ``dashboard`` certificates, it is likely that those services aren't being | ||
templated correctly into the ``wazuh-cert-tool.sh`` which then creates the certificates. | ||
Therefore it is likely that a variable in ``$KAYOBE_CONFIG_PATH/inventory/group_vars/wazuh-manager/wazuh-manager`` | ||
is not matching the corresponding variable used to template ``wazuh-cert-tool.sh``. | ||
|
||
Below is the template for generating ``wazuh-cert-tool.sh``; make sure all the ``"{{ variables }}"`` have been defined: | ||
|
||
.. code-block:: bash | ||
|
||
instances: | ||
wazuh: | ||
name: "{{ inventory_hostname }}" | ||
ip: "{{ wazuh_manager_ip }}" | ||
role: indexer | ||
|
||
Where ``role`` defines the service which ``wazuh-cert-tool.sh`` will create a certificate for. | ||
This should be defined in ``$KAYOBE_CONFIG_PATH/environments/<environment>/inventory/group_vars/wazuh-manager/wazuh-manager.yml``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't work out what this is saying
No description provided.