Add acquis docker start script and add inside readme

This commit is contained in:
Laurence 2023-08-12 16:42:35 +01:00
parent afeb541eac
commit 363a32934e
No known key found for this signature in database
GPG key ID: B053BEE3478E8FEF
2 changed files with 10 additions and 0 deletions

View file

@ -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="<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_<name>` | | Create a file within `acquis.d` with `<name>` as filename and value as a base64 encoded string (base64 -e -w0) which is decoded on startup to be file contents |
| | | |
| __Bouncers__ | | |
| `BOUNCER_KEY_<name>` | | Register a bouncer with the name `<name>` and a key equal to the value of the environment variable. |

View file

@ -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)'