Skip to content
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

no API calls to pull decisions list after startup #26

Closed
doums opened this issue Nov 11, 2023 · 2 comments
Closed

no API calls to pull decisions list after startup #26

doums opened this issue Nov 11, 2023 · 2 comments

Comments

@doums
Copy link

doums commented Nov 11, 2023

Hi, I just spotted that caddy bouncer only makes one API call to pull decisions list (GET /v1/decisions/stream?startup=true), during startup sequence and that's it. After that initial call, there is no other calls made to the API. I'm wondering if this is the intended behavior?
In comparison, cs-firewall-bouncer is calling to /v1/decisions/stream at the regular interval set in its config.

It's like ticker_interval value is not used at all.

image

This is the crowdsec block I use in Caddyfile

  crowdsec {
    api_url http://host.docker.internal:8080
    api_key xxx
    ticker_interval 15s
    # disable_streaming
    # enable_hard_fails
  }
  order crowdsec first

Note: If I run in no-streaming mode (enabling disable_streaming) caddy calls the API as expected for each received request.

@doums doums changed the title (question) no API calls to pull decisions list after startup no API calls to pull decisions list after startup Nov 11, 2023
@hslatman
Copy link
Owner

hslatman commented Nov 11, 2023

Hey @doums, thank you for reporting this! Apparently the context for the background retrieval was cancelled too early, resulting in only the first retrieval working. I think I may have introduced that bug in the previous release, when I also upgraded the https://github.com/crowdsecurity/go-cs-bouncer library, and failed to properly check the runtime to continue running with the new logic.

I've fixed the issue as part of #23. I've also created a new release with the fix: https://github.com/hslatman/caddy-crowdsec-bouncer/releases/tag/v0.5.0.

I've tested the new upgrades and the fix more extensively, and am working on some proper end-to-end tests to prevent this issue from happening in the future.

@doums
Copy link
Author

doums commented Nov 11, 2023

Happy helping to find bugs, and thanks for the quick fix ;)

edit yup works well now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants