diff --git a/docker/README.md b/docker/README.md index e1c7b517e..eae0814f4 100644 --- a/docker/README.md +++ b/docker/README.md @@ -285,6 +285,7 @@ config.yaml) each time the container is run. | __Agent__ | | (these don't work with DISABLE_AGENT) | | `TYPE` | | [`Labels.type`](https://docs.crowdsec.net/Crowdsec/v1/references/acquisition/) for file in time-machine: `-e TYPE=""` | | `DSN` | | Process a single source in time-machine: `-e DSN="file:///var/log/toto.log"` or `-e DSN="cloudwatch:///your/group/path:stream_name?profile=dev&backlog=16h"` or `-e DSN="journalctl://filters=_SYSTEMD_UNIT=ssh.service"` | +| `ACQUIS_` | | Create a file within `acquis.d` with `` as filename and value as a base64 encoded string (base64 -e -w0) which is decoded on startup to be file contents | | | | | | __Bouncers__ | | | | `BOUNCER_KEY_` | | Register a bouncer with the name `` and a key equal to the value of the environment variable. | diff --git a/docker/docker_start.sh b/docker/docker_start.sh index d328cff1a..91429c022 100755 --- a/docker/docker_start.sh +++ b/docker/docker_start.sh @@ -365,6 +365,15 @@ for BOUNCER in /run/secrets/@(bouncer_key|BOUNCER_KEY)* ; do done shopt -u nullglob extglob +## Create acquisition files +for ACQUIS in $(compgen -A variable | grep -i ACQUIS); do + CONTENT=$(printf '%s' "${!ACQUIS}" | base64 -d) + NAME=$(printf '%s' "$ACQUIS" | cut -d_ -f2-) + if [[ -n $CONTENT ]] && [[ -n $NAME ]]; then + echo "$CONTENT" > "/etc/crowdsec/acquis.d/$NAME.yaml" + fi +done + # set all options before validating the configuration conf_set_if "$CAPI_WHITELISTS_PATH" '.api.server.capi_whitelists_path = strenv(CAPI_WHITELISTS_PATH)'