소규모 DDoS 공격의 경우 Mod Security 및 Mod Evasive와 같은 WAF(웹 응용 프로그램 방화벽)가 DDoS 공격을 완화합니다. 

대규모 DDoS 공격의 경우 전문 DDoS 완화 서비스 제공업체에 문의해야 할 수 있습니다. 

1. Mod Security Apache 모듈을 설치합니다.
   
# 모드 시큐리티 설치
yum install mod_security
# 아래 사이트에서 최신 OWASP 룰셋을 다운로드합니다.
# http://spiderlabs.github.io/owasp-modsecurity-crs/
tar xfz SpiderLabs-owasp-modsecurity-crs-2.2.8-0-g0f07cbb.tar.gz
# 바이너리 mod_security 패키지에 의해 설치된 것을 제거합니다.
rm -rf /etc/httpd/modsecurity.d
mv SpiderLabs-owasp-modsecurity-crs-2.2.8-0-g0f07cbb /etc/httpd/modsecurity.d
# /etc/httpd/conf.d/mod_security.conf를 편집합니다.

2. mod_evasive Apache 모듈을 설치합니다.
   
# 소스에서 mod_evasive 바이너리를 빌드합니다.
yum install gcc make libxml2 libxml2-devel httpd-devel pcre-devel curl-devel

# mod_evasive를 설치합니다.
CD /usr/src
wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz
tar xzf mod_evasive_1.10.1.tar.gz
cd mod_evasive

# 이제 pxs가 설치된 위치를 찾아야 합니다.
rpm -ql httpd-devel |grep apxs
# /usr/sbin/apxs // 위 명령의 출력
/usr/sbin/apxs -cia mod_evasive20.c
#라이브러리가 다음 위치에 설치되었습니다.
# /usr/lib64/httpd/modules
# /etc/httpd/conf/httpd.conf에 다음 블록을 추가합니다.
# mod_evasive
<IfModule mod_evasive20.c>
DOSHashTableSize    3097
DOSPageCount        2 
DOSSiteCount        50
DOSPageInterval     1 
DOSSiteInterval     1
DOSBlockingPeriod   60
# 이메일 알림 수신을 원하시면 아래 수정&댓글을 삭제해주세요.
# DOSEmailNotify notify@mydomain.com
</If 모듈>

# 아파치 재시작
service httpd restart

출처: http://www.webtrafficexchange.com/how-mitigate-ddos-modsecurity-and-modevasive-centos-6

0 댓글