From cd590b894a4c633f04f2291c89eff8c4ba5ebb27 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Thu, 6 Jan 2022 12:39:48 -0500 Subject: [PATCH] check that ossec.conf exists --- salt/common/tools/sbin/soup | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index de7614561..c9ba0fa1f 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -872,13 +872,17 @@ apply_hotfix() { fix_wazuh() { FILE="/nsm/wazuh/etc/ossec.conf" - echo "Detecting if ossec.conf needs corrected..." - if head -1 $FILE | grep -q "xml version"; then - echo "$FILE has an XML header; removing" - sed -i 1d $FILE - so-wazuh-restart - else - echo "$FILE does not have an XML header, so no changes are necessary." + echo "Detecting if $FILE needs corrected..." + if [ -f "$FILE" ]; then + if head -1 $FILE | grep -q "xml version"; then + echo "$FILE has an XML header; removing" + sed -i 1d $FILE + so-wazuh-restart + else + echo "$FILE does not have an XML header, so no changes are necessary." + fi + else + echo "$FILE does not exist, so no changes are necessary." fi }