check that ossec.conf exists

This commit is contained in:
m0duspwnens
2022-01-06 12:39:48 -05:00
parent 7bb9b6efa9
commit cd590b894a

View File

@@ -872,13 +872,17 @@ apply_hotfix() {
fix_wazuh() { fix_wazuh() {
FILE="/nsm/wazuh/etc/ossec.conf" FILE="/nsm/wazuh/etc/ossec.conf"
echo "Detecting if ossec.conf needs corrected..." echo "Detecting if $FILE needs corrected..."
if head -1 $FILE | grep -q "xml version"; then if [ -f "$FILE" ]; then
echo "$FILE has an XML header; removing" if head -1 $FILE | grep -q "xml version"; then
sed -i 1d $FILE echo "$FILE has an XML header; removing"
so-wazuh-restart sed -i 1d $FILE
so-wazuh-restart
else
echo "$FILE does not have an XML header, so no changes are necessary."
fi
else else
echo "$FILE does not have an XML header, so no changes are necessary." echo "$FILE does not exist, so no changes are necessary."
fi fi
} }