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 55 tasks :
66 - import_role :
77 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 3232 delegate_to : localhost
3333 register : custom_sca_policies
3434 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
4536
4637 - name : Copy custom SCA policy files to Wazuh manager
4738 copy :
112103 - name : Perform health check against filebeat
113104 command : filebeat test output
114105 changed_when : false
115- become : true
116106 retries : 2
117107
118108 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"
2424# Ansible control host custom certificates directory
2525local_custom_certs_path: "{{ playbook_dir }}/wazuh/custom_certificates"
2626
27- # Ansible custom SCA policies directory
28- local_custom_sca_policies_path: "{{ kayobe_env_config_path }}/wazuh/custom_sca_policies"
29-
3027# Indexer variables
3128indexer_node_name: "{{ inventory_hostname }}"
3229
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