ป้องกันการโจมตีด้วย mod_qos

ปกติแล้ว เรามักจะคุ้นเคยและได้ยินการโจมตีแบบ DDoS กันมาบ้างครับ mod_qos จะช่วยป้องกันเรื่องนี้ได้ เพราะเราจะสามารถจัดการจำนวน connection ที่เข้าถึง server ของเราผ่าน apache ได้ครับ

cd /usr/local/directadmin/custombuild

wget http://jaist.dl.sourceforge.net/project/mod-qos/mod_qos-11.19.tar.gz

tar -zxvf mod_qos-11.19.tar.gz

cd mod_qos-11.19/apache2

apxs -cia mod_qos.c

เพิ่ม config เข้าไปในไฟล์ /etc/httpd/conf/extra/httpd-includes.conf ดังนี้
(สามารถปรับแต่งได้เองครับ)

## QoS Configure
# handles connections from up to 50000 different IPs
QS_ClientEntries 50000

# will allow only 8 connections per IP
QS_SrvMaxConnPerIP 8

# maximum number of active TCP connections is limited to 256
MaxClients 100

# disables keep-alive when 70% of the TCP connections are occupied:
QS_SrvMaxConnClose 50

# minimum request/response speed (deny slow clients blocking the server,
# ie. slowloris keeping connections open without requesting anything):
QS_SrvMinDataRate 10 600

# and limit request header and body (carefull, that limits uploads and post requests too):
# LimitRequestFields 30
# QS_LimitRequestBody 102400

Was this article helpful?

Related Articles