From 6f8b6cdb4293bd04169e5ff2c68d54309e735d9c Mon Sep 17 00:00:00 2001 From: "Thibault \"bui\" Koechlin" Date: Thu, 25 Feb 2021 11:29:39 +0100 Subject: [PATCH] fix the perms of SQLite DB for metabase (#647) --- docker/docker_start.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docker/docker_start.sh b/docker/docker_start.sh index b9fe225d1..f7061548b 100644 --- a/docker/docker_start.sh +++ b/docker/docker_start.sh @@ -16,6 +16,15 @@ if [ "$DISABLE_ONLINE_API" == "" ] && [ "$CONFIG_FILE" == "" ] ; then fi fi +# crowdsec sqlite database permissions +if [ "$GID" != "" ]; then + IS_SQLITE=$(yq eval '.db_config.type == "sqlite"' /etc/crowdsec/config.yaml) + DB_PATH=$(yq eval '.db_config.db_path' /etc/crowdsec/config.yaml) + if [ "$IS_SQLITE" == "true" ]; then + chown :$GID $DB_PATH + fi +fi + ## Install collections, parsers & scenarios cscli hub update cscli collections upgrade crowdsecurity/linux @@ -64,4 +73,4 @@ if [ "$LEVEL_INFO" == "true" ] || [ "$LEVEL_INFO" == "TRUE" ]; then ARGS="$ARGS -info" fi -exec crowdsec $ARGS \ No newline at end of file +exec crowdsec $ARGS