havietduc91 / experience

0 stars 0 forks source link

Security #37

Open havietduc91 opened 6 years ago

havietduc91 commented 6 years ago

Vào view log apache thì thấy báo:

[mpm_prefork:error] [pid 1265] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

  1. Đầu tiên cần tăng MaxRequestWorkers vim /etc/apache2/mods-enabled/mpm_event.conf Tăng:
    
    MaxRequestWorkers 300

ServerLimit 300


2. Xác định IP DDOS attack bằng cách dùng:
1.

netstat -an | egrep ':80|:443' | grep ESTABLISHED | awk '{print $5}' | grep -o -E "([0-9]{1,3}[.]){3}[0-9]{1,3}" | sort -n | uniq -c | sort -nr

Kết quả sẽ đại khái như:

370 113.23.24.54 3 171.247.198.211 3 115.78.166.221 1 116.102.223.146


2. Tạo fail2ban
https://www.maketecheasier.com/fail2ban-protect-apache-ddos/

3. Ban ip:
sudo fail2ban-client set apache banip 192.168.1.20

 Ngoài ra có thể dùng ufw đề quản lý chặn IP cũng sẽ dễ hơn