Distributed deployment

Certificates creation and deployment

Use the root CA of the deployment to issue the certificate for the new node, so the certificates of the existing nodes remain valid. Perform the steps below on the host that holds the root CA private key, root-ca.key. In an assisted installation, it's in the wazuh-ca directory beside the installation assistant, on the host where you ran --generate-config-files. In a step-by-step installation, it's in /etc/wazuh-indexer/ca on the first Wazuh indexer node.

Note

If the root CA private key has been deleted or you can't access it, the existing nodes can't trust a certificate issued for the new node.

Restore the CA directory from your backup before you continue.

  1. Create a working directory for the new certificates, and a config.yml file in it. Use a new directory so that the config.yml and wazuh-certificates of the original installation are kept:

    # mkdir -p /root/new-indexer-node && cd /root/new-indexer-node
    # touch config.yml
    
  2. Edit the config.yml file to include only the node name and IP address of the new node:

    nodes:
      # Wazuh indexer nodes
      indexer:
        - name: <NEW_WAZUH_INDEXER_NODE_NAME>
          ip: "<NEW_WAZUH_INDEXER_IP>"
    
  3. Copy the certificate archive of the deployment to this directory, and extract it to obtain the existing certificates.

    • If the certificate archive is wazuh-certificates.tar, use this command:

      # mkdir wazuh-install-files && tar -xf ./wazuh-certificates.tar -C wazuh-install-files
      
    • If the certificate archive is wazuh-install-files.tar, use this command:

      # tar -xf ./wazuh-install-files.tar
      
  4. Download the certificates tool to this directory and run it to create the certificate for the new Wazuh indexer node. The tool reads config.yml from its own directory, and signs the certificate with the root CA in the directory set in WAZUH_CA_DIR. Replace <CA_DIRECTORY> with the absolute path of the directory that holds root-ca.key, for example, /etc/wazuh-indexer/ca. Without this variable, the tool creates a new root CA, and the certificate of the new node doesn't chain to the root CA of the cluster.

    # curl -sO https://packages-staging.xdrsiem.wazuh.info/pre-release/5.x/installation-assistant/wazuh-certs-tool-5.0.0-rc2.sh
    # WAZUH_CA_DIR=<CA_DIRECTORY> bash wazuh-certs-tool-5.0.0-rc2.sh -A
    
  5. Copy the newly created certificates to the wazuh-install-files folder, making sure not to replace the existing admin certificates:

    # cp wazuh-certificates/<NEW_WAZUH_INDEXER_NODE_NAME>* wazuh-install-files
    
  6. Compress the certificates that the new node requires and the passwords, taken from the complete set assembled in wazuh-install-files, and copy the archive to the new Wazuh indexer node. You can use the scp utility to copy the archive securely:

    # tar -cvf ./wazuh-certificates-<NEW_WAZUH_INDEXER_NODE_NAME>.tar -C ./wazuh-install-files/ ./<NEW_WAZUH_INDEXER_NODE_NAME>.pem ./<NEW_WAZUH_INDEXER_NODE_NAME>-key.pem ./admin.pem ./admin-key.pem ./root-ca.pem ./credentials.env
    # chmod 600 ./wazuh-certificates-<NEW_WAZUH_INDEXER_NODE_NAME>.tar
    # scp ./wazuh-certificates-<NEW_WAZUH_INDEXER_NODE_NAME>.tar <TARGET_USERNAME>@<TARGET_IP>:
    

    Note

    The new archive is named after the new node so that the original archive is not overwritten. It holds the private key of the new node and the Wazuh indexer passwords, so remove it from both hosts after the new node is installed. The root CA private key, root-ca.key, isn't in any archive. It stays in its CA directory. Keep a backup of that directory in secure storage. You need it to issue the certificate of every node added later.

Configuring existing components to connect with the new node

  1. Edit the configuration file at /etc/wazuh-indexer/opensearch.yml on all existing Wazuh indexer nodes. Add <NEW_WAZUH_INDEXER_IP> to the discovery.seed_hosts block, and the distinguished name of the new node to the plugins.security.nodes_dn block. Keep the entries that are already there, shown as <EXISTING_WAZUH_INDEXER_DN>:

    network.host: "<EXISTING_WAZUH_INDEXER_IP>"
    node.name: "<EXISTING_WAZUH_INDEXER_NODE_NAME>"
    cluster.name: "wazuh-cluster"
    
    cluster.initial_cluster_manager_nodes:
      - "<EXISTING_WAZUH_INDEXER_NODE_NAME>"
    
    discovery.seed_hosts:
      - "<EXISTING_WAZUH_INDEXER_IP>"
      - "<NEW_WAZUH_INDEXER_IP>"
    
    plugins.security.nodes_dn:
      - "<EXISTING_WAZUH_INDEXER_DN>"
      - "C=US,L=California,O=Wazuh,OU=Wazuh,CN=<NEW_WAZUH_INDEXER_NODE_NAME>"
    

    Note

    The cluster.initial_cluster_manager_nodes setting is only used the first time an indexer cluster starts. For consistency, keep it aligned with the list across all Wazuh indexer nodes. Still, the settings that allow the new node to join a running cluster are discovery.seed_hosts and plugins.security.nodes_dn.

  2. Restart the existing Wazuh indexer nodes one at a time to apply the changes. Restarting the nodes one by one keeps the cluster available while the change is applied:

    # systemctl restart wazuh-indexer
    
  3. Edit the <indexer> block of the Wazuh manager configuration file /etc/wazuh-manager/wazuh-manager.conf to add the new Wazuh indexer node, then restart the Wazuh manager:

    <hosts>
      <host>https://<EXISTING_WAZUH_INDEXER_IP>:9200</host>
      <host>https://<NEW_WAZUH_INDEXER_IP>:9200</host>
    </hosts>
    
    # systemctl restart wazuh-manager
    
  4. Edit the Wazuh dashboard configuration file /etc/wazuh-dashboard/opensearch_dashboards.yml to include the new Wazuh indexer node, then restart the Wazuh dashboard:

    opensearch.hosts: ["https://<EXISTING_WAZUH_INDEXER_IP>:9200", "https://<NEW_WAZUH_INDEXER_IP>:9200"]
    
    # systemctl restart wazuh-dashboard
    

Having completed the distributed deployment steps, proceed to the New Wazuh indexer node step.