From 7f8d0ccb8e0a5054220ba961f421f3f110c01067 Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Tue, 20 Oct 2020 13:17:20 +0200 Subject: [PATCH] Move set_custom_hostname to function --- wazuh-opendistro/config/etc/cont-init.d/0-wazuh-init | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wazuh-opendistro/config/etc/cont-init.d/0-wazuh-init b/wazuh-opendistro/config/etc/cont-init.d/0-wazuh-init index 36f69247..916ff482 100644 --- a/wazuh-opendistro/config/etc/cont-init.d/0-wazuh-init +++ b/wazuh-opendistro/config/etc/cont-init.d/0-wazuh-init @@ -128,7 +128,10 @@ mount_files() { # 2. In your ossec.conf file, set to_be_replaced_by_hostname as your node_name # 3. Mount your custom ossec.conf file at $WAZUH_CONFIG_MOUNT/etc/ossec.conf ############################################################################## -sed -i 's/to_be_replaced_by_hostname<\/node_name>/'"${HOSTNAME}"'<\/node_name>/g' ${WAZUH_INSTALL_PATH}/etc/ossec.conf + +set_custom_hostname() { + sed -i 's/to_be_replaced_by_hostname<\/node_name>/'"${HOSTNAME}"'<\/node_name>/g' ${WAZUH_INSTALL_PATH}/etc/ossec.conf +} ############################################################################## @@ -156,6 +159,7 @@ main() { # Mount selected files (WAZUH_CONFIG_MOUNT) to container mount_files + set_custom_hostname # Delete temporary data folder rm -rf ${WAZUH_INSTALL_PATH}/data_tmp