Code Monkey home page Code Monkey logo

cloudflare-ddos-protection's Introduction

Cloudflare DDoS Protection Script

Cloudflare offers free DDoS protection and they have a cool API that you could use to enable and disable their DDoS protection easily.

You can use this CLI script to enable and disable the CloudFlare DDOS protection for your website automatically based on the CPU load of your server.

Prerequisites

  • A Cloudflare account
  • Cloudflare API key
  • Cloudflare Zone ID
  • Make sure curl is installed on your server: curl --version

If curl is not installed you need to run the following:

For RedHat/CentOs:

yum install curl

For Debian/Ubuntu

apt-get install curl

Setup

All you need to do is to download the script and save it on your server.

Make the script executable:

chmod +x ~/protection.sh

Setup 2 Cron jobs to run every 30 seconds. To edit your crontab run:

crontab -e

And add the following content:

* * * * * /path-to-the-script/cloudflare/protection.sh
* * * * * ( sleep 30 ; /path-to-the-script/cloudflare/protection.sh )

cloudflare-ddos-protection's People

Contributors

bobbyiliev avatar rpharrison avatar georgievalex avatar

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.