File tree Expand file tree Collapse file tree 5 files changed +41
-14
lines changed Expand file tree Collapse file tree 5 files changed +41
-14
lines changed Original file line number Diff line number Diff line change 5
5
tasks :
6
6
- import_role :
7
7
name : " wazuh-ansible/wazuh-ansible/roles/wazuh/ansible-wazuh-agent"
8
+ post_tasks :
9
+ - name : Check if custom SCA policies directory exists
10
+ stat :
11
+ path : " {{ local_custom_sca_policies_path }}"
12
+ register : custom_sca_policies_folder
13
+ delegate_to : localhost
14
+
15
+ - name : Gather list of custom SCA policies
16
+ find :
17
+ paths : " {{ local_custom_sca_policies_path }}"
18
+ patterns : ' *.yml'
19
+ delegate_to : localhost
20
+ register : custom_sca_policies
21
+ when : custom_sca_policies_folder.stat.exists
22
+
23
+ - name : Allow Wazuh agents to execute commands in SCA policies sent from the Wazuh manager
24
+ become : yes
25
+ blockinfile :
26
+ path : " /var/ossec/etc/local_internal_options.conf"
27
+ state : present
28
+ owner : wazuh
29
+ group : wazuh
30
+ block : sca.remote_commands=1
31
+ when : custom_sca_policies.files | length > 0
32
+ notify :
33
+ - Restart wazuh-agent
34
+
35
+ handlers :
36
+ - name : Restart wazuh-agent
37
+ service :
38
+ name : wazuh-agent
39
+ state : restarted
Original file line number Diff line number Diff line change 32
32
delegate_to : localhost
33
33
register : custom_sca_policies
34
34
when : custom_sca_policies_folder.stat.exists
35
-
36
- - name : Allow Wazuh agents to execute commands in SCA policies sent from the Wazuh manager
37
- blockinfile :
38
- path : " /var/ossec/etc/local_internal_options.conf"
39
- state : present
40
- owner : wazuh
41
- group : wazuh
42
- block : |
43
- sca.remote_commands=1
44
- when : custom_sca_policies.files | length > 0
35
+ become : no
45
36
46
37
- name : Copy custom SCA policy files to Wazuh manager
47
38
copy :
112
103
- name : Perform health check against filebeat
113
104
command : filebeat test output
114
105
changed_when : false
115
- become : true
116
106
retries : 2
117
107
118
108
handlers :
Original file line number Diff line number Diff line change
1
+ ---
2
+ # Ansible custom SCA policies directory
3
+ local_custom_sca_policies_path: "{{ kayobe_env_config_path }}/wazuh/custom_sca_policies"
Original file line number Diff line number Diff line change @@ -24,9 +24,6 @@ local_certs_path: "{{ playbook_dir }}/wazuh/certificates"
24
24
# Ansible control host custom certificates directory
25
25
local_custom_certs_path: "{{ playbook_dir }}/wazuh/custom_certificates"
26
26
27
- # Ansible custom SCA policies directory
28
- local_custom_sca_policies_path: "{{ kayobe_env_config_path }}/wazuh/custom_sca_policies"
29
-
30
27
# Indexer variables
31
28
indexer_node_name: "{{ inventory_hostname }}"
32
29
Original file line number Diff line number Diff line change
1
+ ---
2
+ fixes :
3
+ - |
4
+ When using custom SCA policies for Wazuh, the agents are now correctly
5
+ configured to allow commands to be executed from the manager.
You can’t perform that action at this time.
0 commit comments