Skip to content

[BUG] swag-crowdsec: error in the logs with missing optionnal envvar #1124

@XPlantefeve

Description

@XPlantefeve

Is there an existing issue for this?

  • I have searched the existing issues

Name of mod

swag-crowdsec

Name of base container

swag

Current Behavior

When adding the Crowdsec plugin to swagm the startup logs contains this error:

error loading captcha plugin: no recaptcha site key provided, can't use recaptcha

With or without the CROWDSEC_CAPTCHA_PROVIDER env var, and whatever I put in it, that error is displayed. The only way to get rid of it is to set dummy CROWDSEC_SITE_KEY and CROWDSEC_SECRET_KEY variables. Is the mod trying to use reCaptcha whatever the config is?

Expected Behavior

No error message. And not trying to use recaptcha when the CROWDSEC_CAPTCHA_PROVIDER is not set, even less when it is set to another captcha provider.

Steps To Reproduce

Add the crowdsec mod to the Swag container.

Environment

Error found on three different system with different flavours of Linux and different versions of Docker.

CPU architecture

x86-64

Docker creation

services:
  swag:
    image: linuxserver/swag
    container_name: swag
    cap_add:
      - NET_ADMIN
    depends_on:
      - authelia
    ports:
      - ${SWAG_BIND_HTTP}:80/tcp
      - ${SWAG_BIND_HTTPS}:443/tcp
    networks:
      - default
      - swag
    environment:
      - PUID=${PUID:?PUID}
      - PGID=${PGID:?PGID}
      - TZ=${TZ}
      - URL=${SWAG_URL:?SWAG_URL}
      - MAXMINDDB_USER_ID=${SWAG_MAXMINDDB_USER_ID}
      - MAXMINDDB_LICENSE_KEY=${SWAG_MAXMINDDB_LICENSE_KEY}
      - SUBDOMAINS=${SWAG_SUBDOMAINS}
      - EXTRA_DOMAINS=${SWAG_EXTRA_DOMAINS}
      - CERTPROVIDER=${SWAG_CERTPROVIDER:-letsencrypt}
      - VALIDATION=${SWAG_VALIDATION}
      - DNSPLUGIN=${SWAG_DNSPLUGIN}
      - EMAIL=${SWAG_EMAIL}
      - DOCKER_MODS=${SWAG_DOCKER_MODS}
      - CROWDSEC_API_KEY=${SWAG_CROWDSEC_API_KEY}
      - CROWDSEC_LAPI_URL=${SWAG_CROWDSEC_LAPI_URL}
      - CROWDSEC_CAPTCHA_PROVIDER=turnstile
      - CROWDSEC_SITE_KEY=dummy
      - CROWDSEC_SECRET_KEY=dummy
      - SWAG_AUTORELOAD=true

Container logs

swag  | [mod-init] Running Docker Modification Logic
swag  | [mod-init] Adding linuxserver/mods:swag-dashboard to container
swag  | [mod-init] Downloading linuxserver/mods:swag-dashboard from lscr.io
swag  | [mod-init] Installing linuxserver/mods:swag-dashboard
swag  | [mod-init] linuxserver/mods:swag-dashboard applied to container
swag  | [mod-init] Adding linuxserver/mods:swag-maxmind to container
swag  | [mod-init] Downloading linuxserver/mods:swag-maxmind from lscr.io
swag  | [mod-init] Installing linuxserver/mods:swag-maxmind
swag  | [mod-init] linuxserver/mods:swag-maxmind applied to container
swag  | [mod-init] Adding linuxserver/mods:swag-crowdsec to container
swag  | [mod-init] Downloading linuxserver/mods:swag-crowdsec from lscr.io
swag  | [mod-init] Installing linuxserver/mods:swag-crowdsec
swag  | [mod-init] linuxserver/mods:swag-crowdsec applied to container
swag  | [migrations] started
swag  | [migrations] 01-nginx-site-confs-default: skipped
swag  | [migrations] 02-swag-old-certbot-paths: skipped
swag  | [migrations] done
swag  | ───────────────────────────────────────
swag  |
swag  |       ██╗     ███████╗██╗ ██████╗
swag  |       ██║     ██╔════╝██║██╔═══██╗
swag  |       ██║     ███████╗██║██║   ██║
swag  |       ██║     ╚════██║██║██║   ██║
swag  |       ███████╗███████║██║╚██████╔╝
swag  |       ╚══════╝╚══════╝╚═╝ ╚═════╝
swag  |
swag  |    Brought to you by linuxserver.io
swag  | ───────────────────────────────────────
swag  |
swag  | To support the app dev(s) visit:
swag  | Certbot: https://supporters.eff.org/donate/support-work-on-certbot
swag  |
swag  | To support LSIO projects visit:
swag  | https://www.linuxserver.io/donate/
swag  |
swag  | ───────────────────────────────────────
swag  | GID/UID
swag  | ───────────────────────────────────────
swag  |
swag  | User UID:    XXXX
swag  | User GID:    XXXX
swag  | ───────────────────────────────────────
swag  | Linuxserver.io version: 5.2.2-ls431
swag  | Build-date: 2026-01-17T04:00:37+00:00
swag  | ───────────────────────────────────────
swag  |
swag  | using keys found in /config/keys
swag  | Variables set:
swag  | PUID=XXXX
swag  | PGID=XXXX
swag  | TZ=XXXX
swag  | URL=XXXX
swag  | SUBDOMAINS=XXXX
swag  | EXTRA_DOMAINS=XXXX
swag  | ONLY_SUBDOMAINS=false
swag  | VALIDATION=dns
swag  | CERTPROVIDER=XXXX
swag  | DNSPLUGIN=XXXX
swag  | EMAIL=XXXX
swag  | STAGING=
swag  |
swag  | Using Let's Encrypt as the cert provider
swag  | SUBDOMAINS entered, processing
swag  | Wildcard cert for XXXX will be requested
swag  | EXTRA_DOMAINS entered, processing
swag  | Extra domains processed are: XXXX
swag  | E-mail address entered: XXXX
swag  | dns validation via XXXX plugin is selected
swag  | Certificate exists; parameters unchanged; starting nginx
swag  | The cert does not expire within the next day. Letting the cron script handle the renewal attempts overnight (2:08am).
swag  | **** Configuring CrowdSec nginx Bouncer ****
swag  | **** Applying the SWAG dashboard mod... ****
swag  | **** adding libmaxminddb to package install list ****
swag  | **** Adding goaccess to package install list ****
swag  | **** libmaxminddb already installed, skipping ****
swag  | **** The swag-dashboard conf has been updated ****
swag  | **** Compare the changes using the sample file: /config/nginx/proxy-confs/dashboard.subdomain.conf.sample
swag  | **** Applied the SWAG dashboard mod ****
swag  | **** Successfully configured CrowdSec nginx Bouncer  ****
swag  | [pkg-install-init] **** Installing all mod packages ****
swag  | fetch http://dl-cdn.alpinelinux.org/alpine/v3.22/main/aarch64/APKINDEX.tar.gz
swag  | fetch http://dl-cdn.alpinelinux.org/alpine/v3.22/community/aarch64/APKINDEX.tar.gz
swag  | (1/18) Installing gettext-envsubst (0.24.1-r0)
swag  | (2/18) Installing libgomp (14.2.0-r6)
swag  | (3/18) Installing gettext-libs (0.24.1-r0)
swag  | (4/18) Installing gettext (0.24.1-r0)
swag  | (5/18) Installing goaccess (1.9.4-r0)
swag  | (6/18) Installing libmaxminddb (1.9.1-r0)
swag  | (7/18) Installing lua5.1-libs (5.1.5-r13)
swag  | (8/18) Installing lua5.1 (5.1.5-r13)
swag  | (9/18) Installing lua-resty-http (0.17.2-r0)
swag  | (10/18) Installing luajit (2.1_p20240815-r1)
swag  | (11/18) Installing lua-resty-lrucache (0.13-r1)
swag  | (12/18) Installing lua-resty-core (0.1.31-r0)
swag  | (13/18) Installing nginx-mod-http-lua (1.28.0-r3)
swag  | (14/18) Installing lua-resty-string (0.15-r0)
swag  | (15/18) Installing lua-sec (1.3.2-r0)
swag  | (16/18) Installing lua5.1-socket (3.1.0-r1)
swag  | (17/18) Installing lua5.1-sec (1.3.2-r0)
swag  | (18/18) Installing lua5.1-cjson (2.1.0-r11)
swag  | Executing busybox-1.37.0-r20.trigger
swag  | OK: 212 MiB in 239 packages
swag  | Applying the maxmind mod...
swag  | Applied the maxmind mod
swag  | [custom-init] No custom files found, skipping...
swag  | Auto-reload: Watching the following folders for changes to .conf files:
swag  | /config/nginx
swag  | [ls.io-init] done.
swag  | nginx: [error] [lua] crowdsec.lua:119: init(): error loading captcha plugin: no recaptcha site key provided, can't use recaptcha
swag  | nginx: [alert] [lua] crowdsec_nginx.conf:4):8: [Crowdsec] Initialisation done
swag  | Server ready

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions