Skip to content

Commit

Permalink
Add USER_ENABLE_UPDATE_CHECK preloaded var
Browse files Browse the repository at this point in the history
  • Loading branch information
Selutario committed Apr 3, 2024
1 parent c2bc114 commit 99e7ca8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
11 changes: 11 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ UseSSLCert()
fi
}

UseUpdateCheck()
{
# Update_check config predefined (is overwritten by the preload-vars file)
if [ "X${USER_ENABLE_UPDATE_CHECK}" = "Xn" ]; then
UPDATE_CHECK="no"
else
UPDATE_CHECK="yes"
fi
}

##########
# EnableAuthd()
##########
Expand Down Expand Up @@ -543,6 +553,7 @@ ConfigureServer()
EnableAuthd "3.7"
ConfigureBoot "3.8"
SetupLogs "3.9"
UseUpdateCheck
WriteManager
else
ConfigureBoot "3.6"
Expand Down
12 changes: 9 additions & 3 deletions src/init/inst-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,19 @@ WriteManager()
echo "<ossec_config>" >> $NEWCONFIG

if [ "$EMAILNOTIFY" = "yes" ]; then
sed -e "s|<email_notification>no</email_notification>|<email_notification>yes</email_notification>|g; \
GLOBAL_CONTENT=$(sed -e "s|<email_notification>no</email_notification>|<email_notification>yes</email_notification>|g; \
s|<smtp_server>smtp.example.wazuh.com</smtp_server>|<smtp_server>${SMTP}</smtp_server>|g; \
s|<email_from>[email protected]</email_from>|<email_from>wazuh@${HOST}</email_from>|g; \
s|<email_to>[email protected]</email_to>|<email_to>${EMAIL}</email_to>|g;" "${GLOBAL_TEMPLATE}" >> $NEWCONFIG
s|<email_to>[email protected]</email_to>|<email_to>${EMAIL}</email_to>|g;" "${GLOBAL_TEMPLATE}")
else
cat ${GLOBAL_TEMPLATE} >> $NEWCONFIG
GLOBAL_CONTENT=$(cat ${GLOBAL_TEMPLATE})
fi

if [ "$UPDATE_CHECK" = "no" ]; then
GLOBAL_CONTENT=$(echo "$GLOBAL_CONTENT" | sed "s|<update_check>yes</update_check>|<update_check>no</update_check>|g")
fi

echo "$GLOBAL_CONTENT" >> $NEWCONFIG
echo "" >> $NEWCONFIG

# Alerts level
Expand Down

0 comments on commit 99e7ca8

Please sign in to comment.