ITSkillsCenter
Cybersécurité

Déployer agents Wazuh sur multi-VPS Linux/Windows : tutoriel 2026

4 دقائق للقراءة

📍 Article principal du cluster : Wazuh 2026 : guide complet.

Manager Wazuh installé, étape suivante : déployer agents sur tous les endpoints. Ce tutoriel détaille le déploiement bulk via Ansible et script bash, validé sur 10-50 VPS chez plusieurs PME ouest-africaines.

Prérequis

  • Wazuh Manager en production (voir tutoriel installation).
  • SSH key access vers VPS cibles.
  • Ansible 2.14+ ou bash + sshpass.
  • Niveau attendu : intermédiaire.
  • Temps estimé : 30-60 minutes.

Méthode 1 — Script bash simple

Sur le Manager : générer authd password

cat /var/ossec/etc/authd.pass
# Note la passphrase (ou en générer une)

Script deploy.sh

#!/bin/bash
WAZUH_MANAGER="siem.votre-entreprise.com"
WAZUH_AGENT_PASSWORD="passphrase-from-manager"

# Détection OS
if [ -f /etc/debian_version ]; then
  curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
  echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
  apt-get update
  apt-get install -y wazuh-agent
fi

# Configurer Manager
sed -i "s/MANAGER_IP/${WAZUH_MANAGER}/g" /var/ossec/etc/ossec.conf

# Enregistrer auto
WAZUH_REGISTRATION_PASSWORD="${WAZUH_AGENT_PASSWORD}" \
  /var/ossec/bin/agent-auth -m "${WAZUH_MANAGER}" -P

systemctl daemon-reload
systemctl enable --now wazuh-agent

Boucle SSH sur 10 VPS

for vps in vps1.fqdn vps2.fqdn vps3.fqdn; do
  ssh root@$vps 'bash -s' < deploy.sh
done

Méthode 2 — Ansible (recommandé > 5 VPS)

Inventory hosts.ini

[wazuh_agents]
vps1.fqdn ansible_user=root
vps2.fqdn ansible_user=root
vps3.fqdn ansible_user=root

Playbook wazuh-agent.yml

---
- hosts: wazuh_agents
  vars:
    wazuh_manager: siem.votre-entreprise.com
    wazuh_agent_password: "{{ lookup('env','WAZUH_REG_PASSWORD') }}"
  tasks:
    - name: Add Wazuh repo key
      apt_key:
        url: https://packages.wazuh.com/key/GPG-KEY-WAZUH
        state: present

    - name: Add Wazuh repo
      apt_repository:
        repo: deb https://packages.wazuh.com/4.x/apt/ stable main
        state: present

    - name: Install Wazuh agent
      apt:
        name: wazuh-agent
        state: latest
        update_cache: yes

    - name: Configure Manager IP
      replace:
        path: /var/ossec/etc/ossec.conf
        regexp: 'MANAGER_IP'
        replace: '{{ wazuh_manager }}'

    - name: Register agent
      shell: |
        WAZUH_REGISTRATION_PASSWORD={{ wazuh_agent_password }}         /var/ossec/bin/agent-auth -m {{ wazuh_manager }} -P
      args:
        creates: /var/ossec/etc/client.keys

    - name: Start service
      systemd:
        name: wazuh-agent
        enabled: yes
        state: restarted

Run

export WAZUH_REG_PASSWORD="passphrase"
ansible-playbook -i hosts.ini wazuh-agent.yml

Windows Server agent

PowerShell sur chaque Windows :

Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-4.10.0-1.msi -OutFile \$env:tmp\wazuh-agent.msi
msiexec /i \$env:tmp\wazuh-agent.msi /q WAZUH_MANAGER="siem.votre-entreprise.com" WAZUH_REGISTRATION_PASSWORD="passphrase"
Start-Service WazuhSvc

Vérification post-deploy

# Sur Manager
/var/ossec/bin/agent_control -l
# Liste tous agents avec status

Dashboard → Agents : voir tous, status « Active », OS détecté.

Erreurs fréquentes

Erreur Cause Solution
« Connection refused » Port 1514/1515 firewall Manager UFW allow from agents IPs
« Auth password incorrect » authd.pass mal copié Régénérer + redéployer
Agent « Disconnected » Manager redémarré Restart agent côté VPS
Hostname duplicate Plusieurs agents même nom Force unique hostname
Latence agent reports Bandwidth limité Réduire frequency send

Adaptation au contexte ouest-africain

Trois précisions. VPS chez plusieurs hébergeurs : Hetzner + OVH + Africa Data Centres. Wazuh agnostique, juste DNS Manager accessible. Tailscale recommandé : agents et Manager sur tailnet, ports privés, pas exposition publique. Auto-renaming : nommer agents par hostname + datacenter (ex : vps-prod-fsn1).

Tutoriels frères

FAQ

Capacité agents par Manager ? 1 000 par Manager standard. Cluster pour plus.

Mises à jour agents ? apt upgrade wazuh-agent automatique.

Container Docker ? Image agent existe pour environnements containerisés.

macOS ? Oui, .pkg installer.

Désinstallation ? apt purge wazuh-agent + remove from Manager.

Pour aller plus loin

Besoin d'un site web ?

Confiez-nous la Création de Votre Site Web

Site vitrine, e-commerce ou application web — nous transformons votre vision en réalité digitale. Accompagnement personnalisé de A à Z.

À partir de 250.000 FCFA
Parlons de Votre Projet
Publicité