From f35927b536fadf0266c0fccf199762b17b3ff576 Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Fri, 23 Oct 2020 17:27:19 +0200 Subject: [PATCH] Backport PR #393 --- .../config/etc/cont-init.d/0-wazuh-init | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 0a625354..68538c10 100644 --- a/wazuh-opendistro/config/etc/cont-init.d/0-wazuh-init +++ b/wazuh-opendistro/config/etc/cont-init.d/0-wazuh-init @@ -133,6 +133,19 @@ set_custom_hostname() { sed -i 's/to_be_replaced_by_hostname<\/node_name>/'"${HOSTNAME}"'<\/node_name>/g' ${WAZUH_INSTALL_PATH}/etc/ossec.conf } +############################################################################## +# Allow users to set the container cluster key dynamically on +# container start. +# +# To use this: +# 1. Create your own ossec.conf file +# 2. In your ossec.conf file, set to_be_replaced_by_cluster_key as your key +# 3. Mount your custom ossec.conf file at $WAZUH_CONFIG_MOUNT/etc/ossec.conf +############################################################################## + +set_custom_cluster_key() { + sed -i 's/to_be_replaced_by_cluster_key<\/key>/'"${WAZUH_CLUSTER_KEY}"'<\/key>/g' ${WAZUH_INSTALL_PATH}/etc/ossec.conf +} ############################################################################## # Main function @@ -163,6 +176,9 @@ main() { # Allow setting custom hostname set_custom_hostname + # Allow setting custom cluster key + set_custom_cluster_key + # Delete temporary data folder rm -rf ${WAZUH_INSTALL_PATH}/data_tmp