56 lines
1.9 KiB
YAML
56 lines
1.9 KiB
YAML
---
|
|
# Remontee des logs web vers Wazuh : HAProxy (load-balancer) + WAF ModSecurity/CRS
|
|
# (conteneur gestion-waf, prod-uber et replica-prod-uber). Deploie la config
|
|
# centralisee (files/wazuh-manager/agent.conf) sur le manager, puis autorise et
|
|
# redemarre la collecte "command" (docker logs) sur les agents qui en ont besoin.
|
|
#
|
|
# IMPORTANT : par securite, Wazuh ignore les localfile de type <command> pousses
|
|
# depuis le manager tant que logcollector.remote_commands=1 n'est pas active
|
|
# localement sur l'agent (sinon : "Remote commands are not accepted from the
|
|
# manager" dans ossec.log). prod-uber/pre-prod-uber l'avaient deja ; ce playbook
|
|
# le garantit aussi pour replica-prod-uber.
|
|
|
|
- name: Déployer la config agent.conf centralisée sur le manager Wazuh
|
|
hosts: monitoring-uber
|
|
become: true
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
- name: Copier agent.conf dans le groupe "default"
|
|
ansible.builtin.copy:
|
|
src: ../files/wazuh-manager/agent.conf
|
|
dest: /var/lib/docker/volumes/docker_wazuh_etc/_data/shared/default/agent.conf
|
|
owner: lxd
|
|
group: docker
|
|
mode: "0660"
|
|
|
|
- name: Activer la collecte de commandes distantes (WAF, docker logs)
|
|
hosts: prod,replica-prod
|
|
become: true
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
- name: Autoriser les localfile de type "command" poussés par le manager
|
|
ansible.builtin.lineinfile:
|
|
path: /var/ossec/etc/local_internal_options.conf
|
|
line: "logcollector.remote_commands=1"
|
|
create: true
|
|
notify: restart wazuh-agent
|
|
|
|
handlers:
|
|
- name: restart wazuh-agent
|
|
ansible.builtin.systemd:
|
|
name: wazuh-agent
|
|
state: restarted
|
|
|
|
- name: Redémarrer l'agent load-balancer (recuperation du localfile haproxy.log)
|
|
hosts: load-balancer
|
|
become: true
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
- name: Redémarrer wazuh-agent
|
|
ansible.builtin.systemd:
|
|
name: wazuh-agent
|
|
state: restarted
|