-
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
Cloudflare (continuously) rate limiting API calls #121
Comments
Hi, what is your update_frequency for cloudflare on your bouncer ? |
It's at 10 seconds... The default. I'll try 120s and see what happens. Thanks. |
Happy to report that changing the update_frequency to 3600 seconds finally solved the problem. 3 hourly calls were rate limited and the 4th was successful. Please note that the first 3 failed hourly calls only peaked at a few Kb/s instead of a perpetual 1+ Mb/s: don't understand why. Since I use both my box local firewall and Cloudflare (Cloudflare alone can only block port 80 and 443 and I use it mainly to reduce the stress on the local firewall), the (very) low frequency is not much of a problem. Thank you for a very simple fix. |
Hi, |
You will need to use that for now if you want to ban on Cloudflare side : https://docs.crowdsec.net/u/bouncers/cloudflare-workers/ |
Thanks for letting me know. Unfortunately, I am on the free Cloudflare plan, so based on the first banner in the page you linked I guess I'll need to wait.. |
Hello @marcogiorgio, You can technically use the new cloudflare bouncer on the free plan, but with some limitations (including a very big one, hence the warning in the documentation):
|
Hi @blotus, Bouncer config# Config generated by using /etc/crowdsec/bouncers/crowdsec-cloudflare-worker-bouncer.yaml as base
cloudflare_config:
accounts:
- id: <id>
ban_template: "" # template to use for ban action, set empty to use default
zones:
- zone_id: <id>
actions: # supported actions for this zone. eg value ["ban", "captcha"]
- ban
default_action: captcha
routes_to_protect:
- '*<my_domain>/*'
turnstile: # Turnstile must be enabled if captcha action is used.
enabled: true
rotate_secret_key: true
rotate_secret_key_every: 168h0m0s
mode: managed
- zone_id: <id>
actions: # supported actions for this zone. eg value ["ban", "captcha"]
- ban
default_action: ban
routes_to_protect:
- '*<my_domain>/*'
turnstile: # Turnstile must be enabled if captcha action is used.
enabled: true
rotate_secret_key: true
rotate_secret_key_every: 168h0m0s
mode: managed
- zone_id: <id>
actions: # supported actions for this zone. eg value ["ban", "captcha"]
- ban
default_action: ban
routes_to_protect:
- '*<my_domain>/*'
turnstile: # Turnstile must be enabled if captcha action is used.
enabled: true
rotate_secret_key: true
rotate_secret_key_every: 168h0m0s
mode: managed
- zone_id: <id>
actions: # supported actions for this zone. eg value ["ban", "captcha"]
- ban
default_action: ban
routes_to_protect:
- '*<my_domain>/*'
turnstile: # Turnstile must be enabled if captcha action is used.
enabled: true
rotate_secret_key: true
rotate_secret_key_every: 168h0m0s
mode: managed
token: <my_token>
account_name: <my_account_name>
crowdsec_config:
lapi_url: http://crowdsec-engine:8080/
lapi_key: <my_lapi_key>
update_frequency: 10s
include_scenarios_containing: [] # ignore IPs banned for triggering scenarios not containing either of provided word
exclude_scenarios_containing: [] # ignore IPs banned for triggering scenarios containing either of provided word
only_include_decisions_from: ["cscli"] # only include IPs banned due to decisions orginating from provided sources. eg value ["cscli", "crowdsec"]
key_path: ""
cert_path: ""
ca_cert_path: ""
daemon: false
log_level: info
log_mode: ""
log_dir: /var/log/
prometheus:
enabled: true
listen_addr: 127.0.0.1
listen_port: "2112" Am I missing something obvious? EDIT: Yes, I missed |
Hi,
It seems the Cloudflare API is over solicited by the bouncer. One of the multiple log lines:
level=error msg="you have been ratelimited please wait and try again (10040)"
That would be fine if it would be occasional; but on the contrary each and every single call made is rate limited without a single call being successful, for multiple succeeding days. That is rather not sustainable, especially since data is transferred continuously (1 Mb/s, all day, every day -- please see below a screen grab of my Linode IPv6 transfer)
The only way to give the API a rest:
systemctl stop crowdsec-cloudflare-bouncer
After restarting it, an hour or so of peace and quiet. Then, back to the 10040 error code.
I'd suggest some sort of exponential backoff. I would try to tackle the issue myself but I'm barely a script kiddie in Go.
Thanks.
The text was updated successfully, but these errors were encountered: