28 lines
647 B
Bash
28 lines
647 B
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
set -o pipefail
|
|
|
|
# Generate ossec configuration
|
|
TEMPLATE_CONF_FILES=$(find /var/ossec/etc -name '*.gotmpl')
|
|
|
|
for TEMPLATE_FILE in $TEMPLATE_CONF_FILES; do
|
|
DEST_FILE=${TEMPLATE_FILE%'.gotmpl'}
|
|
echo 'Generating file '$DEST_FILE'...'
|
|
gomplate -f $TEMPLATE_FILE > $DEST_FILE
|
|
chown --reference=$TEMPLATE_FILE $DEST_FILE
|
|
chmod --reference=$TEMPLATE_FILE $DEST_FILE
|
|
done
|
|
|
|
# Add agent to Wazuh manager server
|
|
wazuh-agent-autoadd
|
|
#wazuh-agent-supervisor
|
|
# TODO: rename autoadd -> supervisor + remove following lines
|
|
|
|
while true; do
|
|
sleep 10
|
|
done
|
|
|
|
echo "ERROR: program exited. Container will stop in 5s."
|
|
sleep 5
|