Merge pull request #58 from forana/custom-hooks

Allow custom scripts or commands before service start
This commit is contained in:
AlfonsoRBJ
2018-10-30 13:00:00 +01:00
committed by GitHub
3 changed files with 29 additions and 0 deletions
+15
View File
@@ -54,6 +54,21 @@ Identified Wazuh configuration files to mount...
'/wazuh-config-mount/etc/shared/default/agent.conf' -> '/var/ossec/data/etc/shared/default/agent.conf'
```
## Custom commands/scripts
To execute commands in the Wazuh manager container after configuration is placed but _before_ the
Wazuh API and manager are started, pass the commands as the docker commands/arguments:
```sh
docker run -it --rm wazuh/wazuh:latest "echo 'hello world'" "uname -m" "ls /var/ossec"
```
A more real-world example:
```sh
docker run -it --rm wazuh/wazuh:latest "/var/ossec/bin/ossec-control enable debug"
```
## More documentation
* [Wazuh full documentation](http://documentation.wazuh.com)
+1
View File
@@ -19,6 +19,7 @@ services:
# - my-path:/etc/postfix:Z
# - my-path:/etc/filebeat
# - my-custom-config-path/ossec.conf:/wazuh-config-mount/etc/ossec.conf
# command: ["echo 'hello world'"]
depends_on:
- logstash
logstash:
+13
View File
@@ -113,4 +113,17 @@ trap "ossec_shutdown; exit" SIGINT SIGTERM
chmod -R g+rw ${DATA_PATH}
##############################################################################
# Interpret any passed arguments (via docker command to this entrypoint) as
# paths or commands, and execute them.
#
# This can be useful for actions that need to be run before the services are
# started, such as "/var/ossec/bin/ossec-control enable agentless".
##############################################################################
for CUSTOM_COMMAND in "$@"
do
echo "Executing command \`${CUSTOM_COMMAND}\`"
exec_cmd_stdout "${CUSTOM_COMMAND}"
done
/sbin/my_init