From cfcfdc0e116e74f62264a62353ed1d5a27b26527 Mon Sep 17 00:00:00 2001 From: vcerenu Date: Thu, 12 Oct 2023 10:50:47 -0300 Subject: [PATCH 1/2] add path parameter add remove paths for commands --- manifests/filebeat_oss.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/manifests/filebeat_oss.pp b/manifests/filebeat_oss.pp index 63b317eb..c9b24c25 100644 --- a/manifests/filebeat_oss.pp +++ b/manifests/filebeat_oss.pp @@ -46,10 +46,12 @@ # Needed since GitHub can only ETAG and result in changes of the mtime everytime. # TODO: Include file into the wazuh/wazuh-puppet project or use file { checksum => '..' } for this instead of the exec construct. exec { 'cleanup /etc/filebeat/wazuh-template.json': - command => '/bin/rm -f /etc/filebeat/wazuh-template.json', - onlyif => '/bin/test -f /etc/filebeat/wazuh-template.json', - unless => "/bin/curl -s 'https://raw.githubusercontent.com/wazuh/wazuh/${wazuh_extensions_version}/extensions/elasticsearch/7.x/wazuh-template.json' | /bin/cmp -s '/etc/filebeat/wazuh-template.json'", + path => ['/usr/bin', '/bin', '/usr/sbin', '/sbin'], + command => 'rm -f /etc/filebeat/wazuh-template.json', + onlyif => 'test -f /etc/filebeat/wazuh-template.json', + unless => "curl -s 'https://raw.githubusercontent.com/wazuh/wazuh/${wazuh_extensions_version}/extensions/elasticsearch/7.x/wazuh-template.json' | cmp -s '/etc/filebeat/wazuh-template.json'", } + -> file { '/etc/filebeat/wazuh-template.json': owner => 'root', group => 'root', From 80c106e88f65f945d952bf7ca9597107764b7368 Mon Sep 17 00:00:00 2001 From: vcerenu Date: Thu, 12 Oct 2023 11:23:26 -0300 Subject: [PATCH 2/2] add path parameter add remove paths for commands --- manifests/agent.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/agent.pp b/manifests/agent.pp index fb302de4..403c2712 100644 --- a/manifests/agent.pp +++ b/manifests/agent.pp @@ -575,8 +575,9 @@ ${agent_auth_option_manager} ${agent_auth_option_agent} ${agent_auth_option_password} ${agent_auth_option_address}" exec { 'agent-auth-linux': + path => ['/usr/bin', '/bin', '/usr/sbin', '/sbin'], command => $agent_auth_command, - unless => "/bin/egrep -q '.' ${::wazuh::params_agent::keys_file}", + unless => "egrep -q '.' ${::wazuh::params_agent::keys_file}", require => Concat['agent_ossec.conf'], before => Service[$agent_service_name], notify => Service[$agent_service_name],