maxlerebourg/crowdsec-bouncer-traefik-plugin

[HELP] invalid middleware type or middleware does not exist

Jikeh opened this issue · 5 comments

Hello, I've been trying to setup the crowdsec bouncer plugin but traefik is unable to load the middleware apparently. It's probably some misconfiguration problem but I went over it multiple times and I can't figure it out.

This is part of my static traefik.yaml

entryPoints:
  websecure:
    address: :443
    http:
      middlewares:
        - crowdsec@file

experimental:
  plugins:
    enabled: true
    bouncer:
      moduleName: github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin
      version: v1.2.1-rc1

This is my middleware rule, in a dynamic configuration file:

http:
  middlewares:
    crowdsec:
      plugin:
        bouncer:
          enabled: true
          crowdsecMode: "live"
          crowdsecLapiHost: "crowdsec:8080"
          crowdsecLapiKey: /

From the logs it looks like the configuration is correctly loaded:
level=debug msg="Configuration received: {"http":{"middlewares":{"crowdsec":{"plugin":{"bouncer":{"crowdsecLapiHost":"crowdsec:8080","crowdsecLapiKey":/,"crowdsecMode":"live","enabled":"true"}}}

though traefik fails to apply the middleware to any host:
level=error msg="invalid middleware \"crowdsec@file\" configuration: invalid middleware type or middleware does not exist" entryPointName=websecure routerName=websecure-service@docker

What am I missing? The only difference with the suggested configuration is that I put the middleware in the static configuration as a global one for my entry point, as I do with many other middlewares. Is that not supposed to be supported?

experimental:
  plugins:
    enabled: true
    bouncer:
      moduleName: github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin
      version: v1.2.1-rc1

IDK if it will solve your issue but you added an extra enabled: true here.
https://plugins.traefik.io/install

Thank you for the quick reply. The extra enabled: true was an attempt to fix the issue, unfortunately it doesn't make any difference whether I add it or not.

Are you sure that your dynamic conf is loaded ? Your CrowdsecLapiKey is not just / ?
Show me log from your crowdsec instance and put our plugin in debug mode, maybe you will have further info.

And to respond at your question: Yes, it supports global conf, I do it myself on my instance.

I figured it out: everything was set correctly, it's just that traefik couldn't create /plugins-storage directory and I missed it from the logs before:
level=error msg="Plugins are disabled because an error has occurred." error="unable to create plugins client: unable to create directory /plugins-storage/sources: mkdir plugins-storage: permission denied"

Fixed it by removing user and group ids set in the traefik compose file for now, as it seems that having plugins-storage created in / as root rather than /etc/traefik is a security choice. Thank you for your support!

Perfect, I close the issue :)
Don't hesitate to Star the project, to gain visibility and support the project