mirror of
				https://github.com/wazuh/wazuh-docker.git
				synced 2025-11-04 05:53:19 +00:00 
			
		
		
		
	@@ -74,6 +74,23 @@ apply_exclusion_data() {
 | 
				
			|||||||
  done
 | 
					  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
 | 
					# This function will delete from the permanent data volume every file
 | 
				
			||||||
# contained in PERMANENT_DATA_DEL
 | 
					# contained in PERMANENT_DATA_DEL
 | 
				
			||||||
@@ -84,7 +101,7 @@ remove_data_files() {
 | 
				
			|||||||
    if [ -e ${del_file} ]
 | 
					    if [ -e ${del_file} ]
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
      print "Removing ${del_file}"
 | 
					      print "Removing ${del_file}"
 | 
				
			||||||
      exec_cmd "rm ${del_file}"
 | 
					      exec_cmd "rm -f ${del_file}"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
  done
 | 
					  done
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -158,6 +175,9 @@ main() {
 | 
				
			|||||||
  # Restore files stored in permanent data that are not permanent  (i.e. internal_options.conf)
 | 
					  # Restore files stored in permanent data that are not permanent  (i.e. internal_options.conf)
 | 
				
			||||||
  apply_exclusion_data
 | 
					  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 some files in permanent_data (i.e. .template.db)
 | 
				
			||||||
  remove_data_files
 | 
					  remove_data_files
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ PERMANENT_DATA[((i++))]="/var/ossec/api/configuration"
 | 
				
			|||||||
PERMANENT_DATA[((i++))]="/var/ossec/etc"
 | 
					PERMANENT_DATA[((i++))]="/var/ossec/etc"
 | 
				
			||||||
PERMANENT_DATA[((i++))]="/var/ossec/logs"
 | 
					PERMANENT_DATA[((i++))]="/var/ossec/logs"
 | 
				
			||||||
PERMANENT_DATA[((i++))]="/var/ossec/queue"
 | 
					PERMANENT_DATA[((i++))]="/var/ossec/queue"
 | 
				
			||||||
 | 
					PERMANENT_DATA[((i++))]="/var/ossec/queue/logcollector"
 | 
				
			||||||
PERMANENT_DATA[((i++))]="/var/ossec/agentless"
 | 
					PERMANENT_DATA[((i++))]="/var/ossec/agentless"
 | 
				
			||||||
PERMANENT_DATA[((i++))]="/var/ossec/var/multigroups"
 | 
					PERMANENT_DATA[((i++))]="/var/ossec/var/multigroups"
 | 
				
			||||||
PERMANENT_DATA[((i++))]="/var/ossec/integrations"
 | 
					PERMANENT_DATA[((i++))]="/var/ossec/integrations"
 | 
				
			||||||
@@ -63,3 +64,8 @@ export PERMANENT_DATA_EXCP
 | 
				
			|||||||
i=0
 | 
					i=0
 | 
				
			||||||
PERMANENT_DATA_DEL[((i++))]="/var/ossec/queue/db/.template.db"
 | 
					PERMANENT_DATA_DEL[((i++))]="/var/ossec/queue/db/.template.db"
 | 
				
			||||||
export PERMANENT_DATA_DEL
 | 
					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
 | 
				
			||||||
		Reference in New Issue
	
	Block a user