Giter Club home page Giter Club logo

slowloris-defence's Introduction

Slowloris nginx defence example

How to run

docker-compose up -d --build

Access nginx default page locally at http://localhost:8080

What was done to mitigate the attack

  1. Limiting number of connections from single IP address: added following config to nginx default.conf file
    limit_conn_zone $binary_remote_addr zone=addr:10m;
    
    server {
        ...
        location / {
            limit_conn addr 10;
            ...
        }
        ...
    }
    
  2. Closing slow connections: added following config to nginx default.conf file
    server {
        ...
        
        client_body_timeout 5s;
        client_header_timeout 5s;
    
        ...
    }
    
  3. Increasing NGINX worker connections limit: added following config to nginx nginx.conf file
    events {
        worker_connections  100000;
    }
    
  4. Increasing user’s open file limit: added following config to nginx container in docker-compose.yml file
    ulimits:
      nofile:
        soft: "100000"
        hard: "100000"
  5. Increasing NGINX’s worker number of open files limit: added following config to nginx nginx.conf file
    worker_rlimit_nofile 102400;
    

Sources used

  1. Nginx blog article
  2. HEXADIX blog article

Slowloris implementation was forked from https://github.com/valyala/goloris and POST requests were replaced with GET in order to make requests to Nginx static page (Nginx forbids POST requests to static pages)

slowloris-defence's People

Contributors

dariakharlan 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.