+ Add a simple sed in the Wazuh manager configuration script to replace "to_be_replaced_by_hostname" by the hostname in ossec.conf

This commit is contained in:
Jean-Philippe Lachance
2019-10-03 10:00:37 -04:00
parent 2c31757953
commit 8cdfca24cf

View File

@@ -104,6 +104,17 @@ function ossec_shutdown(){
${WAZUH_INSTALL_PATH}/bin/ossec-control stop;
}
##############################################################################
# Allow users to set the container hostname as <node_name> 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_hostname as your node_name
# 3. Mount your custom ossec.conf file at $WAZUH_CONFIG_MOUNT/etc/ossec.conf
##############################################################################
sed -i 's/<node_name>to_be_replaced_by_hostname<\/node_name>/<node_name>'"${HOSTNAME}"'<\/node_name>/g' /var/ossec/etc/ossec.conf
# Trap exit signals and do a proper shutdown
trap "ossec_shutdown; exit" SIGINT SIGTERM