What's new

Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to protect your site from dDos

Joined
Apr 26, 2019
Messages
11
Likes
3
#1
I propose to read one of the ways to protect your project from DD0S attacks.

To be more confident in the security of the project, I advise you to use the nginx server with the correct config. Below, read one of the versions of your server settings to reduce the risk of DD0S.

1. Build a bunch of nginx + httpd .
2. Include caching of the main page for guests in nginx (those who do not have cookies)
3. Add restrictions to nginx.conf :

Code:
limit_req_zone $ binary_remote_addr zone = two: 20m rate = 2r / s;
server {
location / {
limit_req zone = two burst = 5;
}
}
}
4. Next, use tail and awk :

tail -f /var/log/nginx/access.log | grep GET / HTTP / 1.1 \ "503

5. Parsim log:

tail -f /var/log/nginx/access.log | grep GET / HTTP / 1.1 \ "503 | awk '{print $ 1}'

6. We get out IP ddos machines:

iptables -A INPUT -p tcp -j DROP -s $ IP

7. Add IP in Firewall:

tail -f /var/log/nginx/access.log | grep GET / HTTP / 1.1 \ "503 | awk '{print $ 1}' | xargs -t -l iptables -A INPUT -p tcp -j DROP -s

8. Next, you can set up connlimit for iptables to limit the bots connections:
set the rules for 5 connections from one IP and 25 connections from the class C subnet.

DD0S from 16000 bots - Load average: 1.4 1.9 2.0
 
Top Bottom