Giter Site home page Giter Site logo

crowdsecurity / cs-cloudflare-worker-bouncer Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 6.0 419 KB

A CrowdSec Bouncer that syncs the decisions made by CrowdSec with CloudFlare's firewall using cloudflare workers. Manages multi user, multi account, multi zone setup. Supports IP, Country and AS scoped decisions.

Home Page: https://doc.crowdsec.net/docs/next/bouncers/cloudflare-workers

License: MIT License

Makefile 5.72% Go 71.22% JavaScript 11.67% Shell 10.97% Python 0.43%

cs-cloudflare-worker-bouncer's People

Contributors

alteredcoder avatar dependabot[bot] avatar laurencejjones avatar mmetc avatar rr404 avatar sabban avatar sbs2001 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cs-cloudflare-worker-bouncer's Issues

Bouncer gets LAPI delete decisions but doesn't actually delete them from Cloudflare

I've been running the bouncer for about a week and every ban is successfully initiated but only about 1/3 of them are actually deleted once the ban expires.

My log is filled with "Received x deleted decisions" but most are not followed up with "Deleted x decisions" account=xx

When I restart the bouncer, all the expired bans are deleted.

Any ideas? Screenshot of log below... there are no errors.

screenshot

Bouncer generates/deletes workers & routes on a loop

Hi,

I am on a paid Workers plan. I followed the setup guide last night and installed the bouncer.

If I run crowdsec-cloudflare-worker-bouncer -s, it does everything correctly. I log in, my worker is there as are all my routes.

If I run systemctl start crowdsec-cloudflare-worker-bouncer, the bouncer turns on, deletes the worker and routes, creates them again, and then 10 seconds later does it all over. It's on an endless loop of creating and deleting the worker & routes.

Here's the loop from the bouncer's log โ€” there are no errors.

time="02-05-2024 08:00:13" level=info msg="Done cleaning up existing workers" account=redacted
time="02-05-2024 07:59:48" level=info msg="Cleaning up existing workers" account=redacted
time="02-05-2024 07:59:46" level=info msg="Done creating turnstile widget" account=redacted zone=redacted
time="02-05-2024 07:59:44" level=info msg="Adding 24731 decisions" account=redacted
time="02-05-2024 07:59:44" level=info msg="Received 24731 new decisions"
time="02-05-2024 07:59:44" level=info msg="Received 3 deleted decisions"
time="02-05-2024 07:59:44" level=info msg="Done creating turnstile widget" account=redacted zone=redacted
time="02-05-2024 07:59:44" level=info msg="Creating turnstile widget" account=redacted zone=redacted
time="02-05-2024 07:59:44" level=info msg="Successfully deployed infra for all accounts"
time="02-05-2024 07:59:44" level=info msg="Successfully deployed infra for account redacted"
time="02-05-2024 07:59:44" level=info msg="Binded worker to route *redacted.com/" account=redacted zone=redacted
time="02-05-2024 07:59:40" level=info msg="Binding worker to route *redacted.com/
" account=redacted zone=redacted
time="02-05-2024 07:59:38" level=info msg="Creating worker crowdsec-cloudflare-worker-bouncer" account=redacted
time="02-05-2024 07:59:37" level=info msg="Creating KVNS CROWDSECCFBOUNCERNS" account=redacted
time="02-05-2024 07:59:37" level=info msg="Done cleaning up existing workers" account=redacted
time="02-05-2024 07:59:30" level=info msg="Cleaning up existing workers" account=redacted
time="02-05-2024 07:59:29" level=info msg="Using API key auth"
time="02-05-2024 07:59:29" level=info msg="config is valid"
time="02-05-2024 07:59:29" level=info msg="Using API key auth"

Worker re-deployment at service restart causes worker settings to revert to defaults

I set up CloudFlare Logpush on the worker and was ingesting the worker logs to my local Elastic instance for statistics and log analysis. Was working great.

Restarted the system the worker was on, the worker re-deployed, CloudFlare Logpush is now disabled.

Looks like the worker re-deploys its infrastructure every time the service starts. Because of this, worker settings do not persist across service restarts.

Proposing one of the following solutions:

  1. Workers only re-deploy when necessary (would have to figure out how to tell that?) and can use existing deployments, so customizations to the workers (and workers themselves?) persist across service restarts
  2. Service reads existing worker settings prior to cleanup and sets them back after re-deployment
  3. Service provides worker options management in config yml

I'm sure there are other ways to tackle this, these were just the first things that came to mind.

This impacted me for Logpush settings, but this probably impacts other worker settings: CPU limit, usage model, placement, etc.

Setup integration tests

The bouncer includes tests which need a real cf account. We need a separate CF account for it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.