From 329fe43c3d89ba94301d19b55ea2991b904ca09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Thu, 14 Dec 2023 11:31:54 +0000 Subject: [PATCH 1/6] fix: create handler for macOS agent service --- .../roles/wazuh/ansible-wazuh-agent/handlers/main.yml | 3 +++ provisioning/roles/wazuh/ansible-wazuh-agent/tasks/MacOS.yml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/provisioning/roles/wazuh/ansible-wazuh-agent/handlers/main.yml b/provisioning/roles/wazuh/ansible-wazuh-agent/handlers/main.yml index 84f3ff4553..d54184f29a 100644 --- a/provisioning/roles/wazuh/ansible-wazuh-agent/handlers/main.yml +++ b/provisioning/roles/wazuh/ansible-wazuh-agent/handlers/main.yml @@ -4,3 +4,6 @@ - name: Windows | Restart Wazuh Agent win_service: name=WazuhSvc start_mode=auto state=restarted + +- name: macOS | Restart Wazuh Agent + command: /Library/Ossec/bin/wazuh-control restart diff --git a/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/MacOS.yml b/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/MacOS.yml index 7ad4242218..525ce8fc16 100644 --- a/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/MacOS.yml +++ b/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/MacOS.yml @@ -14,7 +14,7 @@ owner: root group: wazuh mode: 0644 - notify: restart wazuh-agent + notify: macOS | Restart Wazuh Agent tags: - init - config @@ -33,7 +33,7 @@ owner: root group: wazuh mode: 0640 - notify: restart wazuh-agent + notify: macOS | Restart Wazuh Agent tags: - init - config From 4bed386314ad31a84b62600795038c98b66676b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Fri, 15 Dec 2023 13:40:40 +0000 Subject: [PATCH 2/6] fix: removed repeat wazuh-agent role provision --- provisioning/playbooks/wazuh_environment.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/provisioning/playbooks/wazuh_environment.yaml b/provisioning/playbooks/wazuh_environment.yaml index 69270a0f36..dac1a9f2c8 100644 --- a/provisioning/playbooks/wazuh_environment.yaml +++ b/provisioning/playbooks/wazuh_environment.yaml @@ -64,8 +64,3 @@ import_role: name: "../roles/wazuh/ansible-wazuh-agent" when: ansible_os_family != "Windows" - - - name: Install Windows based agents - import_role: - name: "../roles/wazuh/ansible-wazuh-agent" - when: ansible_os_family == "Windows" From ac3b658368767f5097e642d27531e9bce9dfc191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Mon, 18 Dec 2023 10:14:30 +0000 Subject: [PATCH 3/6] fix: windows provisioning --- provisioning/playbooks/wazuh_environment.yaml | 3 --- provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/provisioning/playbooks/wazuh_environment.yaml b/provisioning/playbooks/wazuh_environment.yaml index dac1a9f2c8..371ad36306 100644 --- a/provisioning/playbooks/wazuh_environment.yaml +++ b/provisioning/playbooks/wazuh_environment.yaml @@ -59,8 +59,5 @@ - name: Agents block: - name: Install UNIX based agents - become: true - become_user: root import_role: name: "../roles/wazuh/ansible-wazuh-agent" - when: ansible_os_family != "Windows" diff --git a/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml b/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml index 6eddb1ce65..09bc2c6819 100644 --- a/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml +++ b/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml @@ -22,10 +22,13 @@ when: ansible_os_family == "Windows" - include_tasks: "Linux.yml" + become: true when: ansible_system == "Linux" - include_tasks: "MacOS.yml" + become: true when: ansible_system == "Darwin" - include_tasks: "Solaris.yml" + become: true when: ansible_os_family == "Solaris" From 4edf665bfcc1883942d2c7888243e2579ce60954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Mon, 18 Dec 2023 18:07:31 +0000 Subject: [PATCH 4/6] fix: wazuh environment agent provision --- provisioning/playbooks/wazuh_environment.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/provisioning/playbooks/wazuh_environment.yaml b/provisioning/playbooks/wazuh_environment.yaml index 371ad36306..49f56e44d3 100644 --- a/provisioning/playbooks/wazuh_environment.yaml +++ b/provisioning/playbooks/wazuh_environment.yaml @@ -53,11 +53,8 @@ username: wazuh password: wazuh -# Agent - hosts: agent - tasks: - - name: Agents - block: - - name: Install UNIX based agents - import_role: - name: "../roles/wazuh/ansible-wazuh-agent" + roles: + - role: "../roles/wazuh/ansible-wazuh-agent" + become: "{{ ansible_os_family != 'Windows' }}" + become_user: root From c62986baf718b6285a524b6ecc4b152178059a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Tue, 19 Dec 2023 12:23:37 +0000 Subject: [PATCH 5/6] fix: remove become in agent include_tasks --- provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml b/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml index 09bc2c6819..6eddb1ce65 100644 --- a/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml +++ b/provisioning/roles/wazuh/ansible-wazuh-agent/tasks/main.yml @@ -22,13 +22,10 @@ when: ansible_os_family == "Windows" - include_tasks: "Linux.yml" - become: true when: ansible_system == "Linux" - include_tasks: "MacOS.yml" - become: true when: ansible_system == "Darwin" - include_tasks: "Solaris.yml" - become: true when: ansible_os_family == "Solaris" From fb9b3ddf205f25cc20fba2da108f260952b7464f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Tue, 19 Dec 2023 14:43:55 +0000 Subject: [PATCH 6/6] docs: include 4770 changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99a000be11..6696228ba2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file. ### Fixed +- Fix macOS agents provision to enable registration and connection with managers. ([#4770](https://github.com/wazuh/wazuh-qa/pull/4770/)) \- (Framework) - Fix hardcoded python interpreter in qa_framework role. ([#4658](https://github.com/wazuh/wazuh-qa/pull/4658)) \- (Framework) - Fix duplicated jq dependency ([#4678](https://github.com/wazuh/wazuh-qa/pull/4678)) \- (Framework)