-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crowdsec unrecognized directive in Caddyfile #45
Comments
Hi @AlpenFlizzer, The automatically generated Caddy documentation shows the docs for The usage of two modules in the custom build is shown and explained in https://github.com/hslatman/caddy-crowdsec-bouncer?tab=readme-ov-file#usage. In fact, importing just You're not the first one to hit this case; this one was relatively recent: #44. I'll see if I can improve the docs by 1) showing a full |
#47 is part of the new release. Modules that have not been added to the Caddy build will show up in the logs now. |
I have Caddy running in Docker and originally installed the crowdsec plugin using
(note that this is the snippet provided at the caddy documentation for modules - and also it should have sufficed my use case since I only use reverse_proxy handlers, no L4)
Then I added the Crowdsec Config in the global block of my Caddyfile as given in your and crowdsec's guides. The communication between LAPI on my Firewall and the caddy-crowdsec-bouncer worked and I could verify that I got decisions from the LAPI to the bouncer. However, in order to make Caddy execute the decisions i.e. by blocking a banned IP, it is necessary to add the crowdsec directive inside a route block for a specific site configuration.
At this point, when adding the crowdsec directive inside a route block, Caddy would not start, but give me an error that crowdsec is an unrecognized directive.
After one day of troubleshooting, I decided to rebuild Caddy with the following snippet:
Long story short, after that, crowdsec was recognized as directive and I could verify, banned IPs were blocked by crowdsec before reverse proxying.
I wanted to ask, what is the reason it did not work with the first snippet, but with the second.
Furthermore I want to suggest to provide this information somehow to assist anyone else experiencing this issues.
Maybe your or Crowdsec's guides could be extended or adapted to include some further information about this specific behaviour.
Thank you for your nice work on the caddy bouncer!
All the best!
Btw. my working Dockerfile and Caddyfile:
Regarding the docker-compose.yaml the guide at https://github.com/crowdsecurity/example-docker-compose/tree/main/caddy works well. I just used environment variables to configure crowdsec on this machine as log processor only. Found the information about the variables at https://hub.docker.com/r/crowdsecurity/crowdsec
The text was updated successfully, but these errors were encountered: