crowdsecurity / cs-cloudflare-bouncer

A CrowdSec Bouncer that syncs the decisions made by CrowdSec with CloudFlare's firewall. Manages multi user, multi account, multi zone setup. Supports IP, Country and AS scoped decisions.
MIT License
50 stars 7 forks source link

Can't read config from env #146

Closed Dudoleitor closed 1 year ago

Dudoleitor commented 1 year ago

Hi, I was recently cleaning up my crowdsec configs and I noticed an unexpected behaviour. I'm running the bouncer inside kubernetes using the image crowdsecurity/cloudflare-bouncer:latest and I can't read a configuration parameter from an environment variable. In the file /etc/crowdsec/bouncers/crowdsec-cloudflare-bouncer.yaml I set config_lapi_key to ${API_KEY} and I flled the env API_KEY with the proper value, but the container crashes immediately with an authentication error in the logs.

I tried setting config_lapi_url to ${API_URL} and this is what the log outputs

time="03-07-2023 15:30:31" level=info msg="Starting crowdsec-cloudflare-bouncer v0.2.1-6b30687c25027607083926cb2112dd06e04dae59"
time="03-07-2023 15:30:31" level=info msg="Using API key auth"
time="03-07-2023 15:30:31" level=error msg="BaseURL must have a trailing slash, but \"$%!B(MISSING)API_URL%!D(MISSING)\" does not"
time="03-07-2023 15:30:31" level=fatal msg="LAPI can't be reached"
time="03-07-2023 15:30:31" level=fatal msg="LAPI can't be reached"

I tried to exec into the container and with echo I see that the environment variable is correctly set. By manually entering configurations in the file everything works.

Is there something I'm doing wrong? Can I be of more help to troubleshoot this issue?

LaurenceJJones commented 1 year ago

The reason it doesn't work because we haven't done a release since the feature was introduced. So to use this you would have to build the image from source within the repository or wait til we do a release which is overdue anyways.

Update: I didn't realise there is a RC so you can update your image to use crowdsecurity/cloudflare-bouncer:v0.3.0-rc1 as the version to get configuration merge

Dudoleitor commented 1 year ago

Understood, thanks for the quick response