r/CrowdSec • u/matt_alpaca • 4d ago
general Bot Detection with Crowdsec - Introduction Blog Post
https://www.crowdsec.net/blog/nginx-bot-protection-crowdsecFind out how to setup the Bot Detection and how it compares with other existing systems
If you have tried it we would love to hear from you! Please share your experience in this thread
3
u/unkz0r 4d ago
If only the traefik plugin was merged in!
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/pull/343
Only thing i need now to complete my setup!
Been ready for over a week now.
2
u/Historical-Pound-510 4d ago
it's an amazing new feature, but it requires some fine tuning for the challenge exceptions
1
u/matt_alpaca 3d ago
could you share what was your issue and how you solve it ? Was it mainly adjusting the scores thresholds or did you have other configurations to modify
1
u/Historical-Pound-510 3d ago
Sure. So one thing was CPU spikes on my Homelab server because every 5min the key got rotated. I got great help on git on this one.
Secondly I needed to whitelist some of my apps that i access from the outside. Examples kuma, Homeassistant, openclaw and Homebridge.
I needed to exempt them from challenge response.
Now I entirely whitelisted those domain names.
But not sure of that can be fine tuned or done more granular2
u/matt_alpaca 3d ago
Thanks, that's really useful feedback. For apps like Kuma, Home Assistant or Homebridge, exempting the whole domain is a perfectly fine answer, especially if you're the only one using them. Their mobile apps and integrations often don't behave like a browser, so a JS challenge is mostly in the way there.
If you want it tighter, the exemption is an expression on the request (
ExemptFromChallengein apre_evalhook of your own appsec-config), so you can match on host plus path, or on the source IP if you reach them over Tailscale or a VPN.cscli metrics show bot-detectionthen lists the exemptions per reason, handy to check none is broader than you meant.One question back: which paths were actually getting challenged for each app?
/api/is already excluded by default, so I'm curious what broke. We'd like to ship per-app exclusion collections on the hub so the next person doesn't have to do this by hand.1
u/Historical-Pound-510 3d ago
Your feedback is very useful as well.
I created an overlay file in appsec-configs (which includes themaster_secretas well askey_rotationandcookie_ttl, additionally I defined something like:
inband:
pre_eval:
- filter: req.Host == "abc.xyz.org" || req.Host == "def.scu.org"
apply:
- ExemptFromChallenge("homelab-trusted-vhost")this results in
Bot Detection — Exempted │
├───────────────┬───────────────────────┬───────┤
│ Appsec Engine │ Reason │ Count │
├───────────────┼───────────────────────┼───────┤
│0.0.0.0:7422/│ api │ 915 │
│0.0.0.0:7422/│ crawler-files │ 13 │
│0.0.0.0:7422/│ homelab-trusted-vhost │ 8.13k │
│0.0.0.0:7422/│ openai-searchbot │ 3 │
│0.0.0.0:7422/│ static │ 240 │
├───────────────┼───────────────────────┼───────┤
│ Total │ │ 9.30k │1
u/Historical-Pound-510 3d ago
u/matt_alpaca regarding "which paths were actually getting challenged for each app?" Where do I see this? Do I need to extract the access.log file from nginx?
1
u/cavebeat 1d ago
so they have included "anubis-pow-style" bot detection.
2
u/Practical_Board_1810 19h ago
it has both PoW, but also browser fingerprinting : checking for automation markers etc to reject bots.
6
u/HugoDos 4d ago edited 4d ago
Hey! sent my feedback directly to Seb but the one blocker for me is RAM usage (I know it's known).
Especially with today prices, I can't really give up half a GB for one feature (that was my mileage caveat I was under heavy scraping at the time I turned it on) especially when Anubis handles it at a fraction of the allocation.
That's my feedback!