cloudflare repository
I want to check when a ddos attack is sent to my website, and when it is sent, block all traffic carried by the sent country until the attack stops. To do this, I need to know which repository (to maven) is to integrate my project with cloudflare, but I can't find it. Can someone help me?
2 Replies
That's really not a good idea, someone could attack you from the US and you'd be blocking the entire US. Cloudflare has built in DDoS Protection that will handle big attacks for you.
The Cloudflare API Docs are at: https://developers.cloudflare.com/api/
There's API SDKs for a few languages like Go (https://github.com/cloudflare/cloudflare-go) and a depecrated php one (https://github.com/cloudflare/cloudflare-php). The API Docs themselves generate semi-usable code snippets for each language, it's nothing too hard though even without the SDK, it's just REST API Stuff.
You can get DDoS Alerts either via the DDoS Alert Notification (Notifications tab in CF), or polling firewall events, you could then enable I am under attack mode, or just challenge all traffic from the specific country until it stops. It would take a fair bit of work though, I've heard of people doing this but not sure if they ever open sourced it or released something prebuilt for it. I wouldn't waste time on this unless you already have an occassional DDoS Issue that is frequent enough that you can't just manually mitigate each one, and that you can't use something else to block automagically.
The community has some firewall rules you could try using to block or challenge some bad traffic: https://gist.github.com/Le0Developer/4c68f9a878a4cc2db88755ae06191dbc
You get unmetered rate limiting even on free as well, which you can configure. I would try to go for a more dynamic solution if you can.
Ok thank you