Skip to content

Commit

Permalink
Merge pull request #509 from wazuh/fix-4.2-upgrade
Browse files Browse the repository at this point in the history
Fix 4.2 upgrade
  • Loading branch information
José Fernández Aguilera authored Sep 3, 2021
2 parents 750fe5f + 413dd71 commit 6ed7999
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
22 changes: 21 additions & 1 deletion wazuh-odfe/config/etc/cont-init.d/0-wazuh-init
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ apply_exclusion_data() {
done
}

##############################################################################
# This function will rename in the permanent data volume every file
# contained in PERMANENT_DATA_MOVE
##############################################################################

move_data_files() {
for mov_file in "${PERMANENT_DATA_MOVE[@]}"; do
file_split=( $mov_file )
if [ -e ${file_split[0]} ]
then
print "moving ${mov_file}"
exec_cmd "mv -f ${mov_file}"
fi
done
}


##############################################################################
# This function will delete from the permanent data volume every file
# contained in PERMANENT_DATA_DEL
Expand All @@ -84,7 +101,7 @@ remove_data_files() {
if [ -e ${del_file} ]
then
print "Removing ${del_file}"
exec_cmd "rm ${del_file}"
exec_cmd "rm -f ${del_file}"
fi
done
}
Expand Down Expand Up @@ -158,6 +175,9 @@ main() {
# Restore files stored in permanent data that are not permanent (i.e. internal_options.conf)
apply_exclusion_data

# Rename files stored in permanent data (i.e. queue/ossec)
move_data_files

# Remove some files in permanent_data (i.e. .template.db)
remove_data_files

Expand Down
6 changes: 6 additions & 0 deletions wazuh-odfe/config/permanent_data.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PERMANENT_DATA[((i++))]="/var/ossec/api/configuration"
PERMANENT_DATA[((i++))]="/var/ossec/etc"
PERMANENT_DATA[((i++))]="/var/ossec/logs"
PERMANENT_DATA[((i++))]="/var/ossec/queue"
PERMANENT_DATA[((i++))]="/var/ossec/queue/logcollector"
PERMANENT_DATA[((i++))]="/var/ossec/agentless"
PERMANENT_DATA[((i++))]="/var/ossec/var/multigroups"
PERMANENT_DATA[((i++))]="/var/ossec/integrations"
Expand Down Expand Up @@ -63,3 +64,8 @@ export PERMANENT_DATA_EXCP
i=0
PERMANENT_DATA_DEL[((i++))]="/var/ossec/queue/db/.template.db"
export PERMANENT_DATA_DEL

i=0
PERMANENT_DATA_MOVE[((i++))]="/var/ossec/logs/ossec /var/ossec/logs/wazuh"
PERMANENT_DATA_MOVE[((i++))]="/var/ossec/queue/ossec /var/ossec/queue/sockets"
export PERMANENT_DATA_MOVE

0 comments on commit 6ed7999

Please sign in to comment.