요점을 바로 말하자면, NGINX는 XML-RPC를 사용한 DDoS 공격 중에 HTTP 요청을 처리하지 않는 것 같습니다.
서버는 XML-RPC DDoS 공격 중에 CPU의 약 1%만 사용합니다.
서버는 12개의 코어를 사용하고 NGINX는 12개의 작업자 프로세스를 사용하도록 설정됩니다.
내 현재 구성은 다음과 같습니다.
nginx.conf:
user nginx;
worker_processes 12;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 12288;
}
http {
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;
limit_conn_zone $binary_remote_addr zone=one:10m;
limit_req_zone $binary_remote_addr zone=two:10m rate=5r/s;
sendfile on;
#tcp_nopush on;
keepalive_timeout 30;
server_tokens off;
include /etc/nginx/conf.d/*;
}
default.conf:
server {
listen 80 default_server;
server_name _;
include /etc/nginx/default.d/*.conf;
limit_conn one 10;
limit_req zone=two burst=10 nodelay;
if ($http_user_agent ~* (wordpress))
{
return 444;
}
if ($http_user_agent = "")
{
return 444;
}
client_body_buffer_size 1K;
client_header_buffer_size 1k;
client_max_body_size 1k;
large_client_header_buffers 2 1k;
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 5 5;
send_timeout 10;
access_log off;
location / {
root /var/www/html;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location ~ \.php$ {
root /var/www/html;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /status/ {
stub_status on;
}
}
sysctl.conf:
net.ipv4.ip_forward = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.tcp_syncookies = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
나는 NGINX가 요청을 수신하지 못할 정도로 공격을 차단할 생각이 없으며 공격 중에 초당 요청을 모니터링하기 위해 NGINX를 계속 유지하려고 합니다.
많은 감사를 드립니다.
답변1
즉, DDos 공격의 핵심은 모든 리소스를 완전히 사용하는 것입니다. 누군가가 이 옵션을 설정하면 nginx가 응답할 것이라고 말할 수 있는 마법 구성은 없습니다. 인바운드 트래픽을 차단해야 합니다.
그런 다음 웹 서버에서 인바운드 트래픽을 차단하면 다운스트림이 포화되어 실제 요청이 통과할 수 없는 지점까지 도달하게 됩니다. 따라서 업링크를 사용하여 차단하도록 해야 합니다.