NGINX App Protect DoS 설치 및 구성 튜토리얼
NGINX App Protect DoS 는 SYN 플러드, UDP 플러드 및 HTTP 플러드와 같은 다양한 유형의 DoS 공격을 감지하고 완화할 수 있습니다. 또한 Slowloris 및 RUDY 공격과 같은 보다 정교한 공격으로부터 보호할 수 있습니다.
이 포스트에서는 NGINX App Protect DoS 를 배포하고 App Protect DoS를 업그레이드하는 방법을 설명합니다.
목차
1. 전제 조건
1-1. 설치 및 구성 환경
2. NGINX App Protect DoS 설치
3. NGINX App Protect DoS 구성
3-1. 실시간 활동 모니터링 대시보드 구성
3-2. 실시간 활동 모니터링 대시보드 액세스
4. NGINX App Protect DoS 구성 테스트
4-1. 트래픽 발생
1. 전제 조건
NGINX App Protect DoS는 추가 비용을 지불하고 다운로드 가능한 동적 모듈로 고객에게 제공됩니다.
기존 NGINX Plus 구독에 NGINX App Protect DoS를 구입하거나 추가하려면 NGINX STORE에 문의하십시오.
NGINX App Protect DoS는 다음 운영 체제를 지원합니다.
- CentOS 7.4.x 이상
- RHEL 7.4.x / UBI 7.6.x 이상
- RHEL 8 / UBI 8 이상
- Debian 10(Buster)
- Debian 11(Bullsete)
- Ubuntu 18.04(Bionic)
- Ubuntu 20.04(Focal)
- Alpine 3.15.x
2023년 1월 31일 NGINX App Protect DoS 릴리즈 노트 4.0 기준 Ubuntu 20.04 이상 버전을 지원하고 있지 않기 때문에 해당 포스트에서는 Ubuntu 20.04 버전을 이용해 설치하고 구성합니다.
NGINX App Protect DoS는 NGINX App Protect WAF가 있는 NGINX Plus 시스템에 설치할 수 있습니다.
1-1. 설치 및 구성 환경
- Ubuntu 20.04 LTS Focal Fossa
- NGINX 1.23.2 (NGINX Plus R28)
2. NGINX App Protect DoS 설치
※ 모든 설치 과정은 Root 권한을 가진 사용자로 진행합니다.
※ 시스템에 이미 NGINX 패키지가 존재하는 경우 구성 및 로그를 백업하십시오.
sudo cp -a /etc/nginx /etc/nginx-plus-backup
sudo cp -a /var/log/nginx /var/log/nginx-plus-backup
1. /etc/ssl/nginx
디렉터리를 생성합니다.
mkdir /etc/ssl/nginx

2. 고객 포털, 혹은 이메일로 받은 NGINX Plus 인증키를 /etc/ssl/nginx
디렉터리에 복사합니다.

3. 전제 조건 패키지를 설치합니다.
apt-get update && apt-get install apt-transport-https lsb-release ca-certificates wget gnupg2

4. NGINX 서명 키를 다운로드하고 추가합니다.
wget https://cs.nginx.com/static/keys/nginx_signing.key && sudo apt-key add nginx_signing.key
wget https://cs.nginx.com/static/keys/app-protect-security-updates.key && sudo apt-key add app-protect-security-updates.key


5. 이전 NGINX Plus 리포지토리 및 apt 구성 파일이 존재한다면 제거합니다.
rm /etc/apt/sources.list.d/nginx-plus.list
rm /etc/apt/sources.list.d/*app-protect*.list
rm /etc/apt/apt.conf.d/90pkgs-nginx
6. NGINX Plus 리포지토리를 추가합니다.
printf "deb https://pkgs.nginx.com/plus/ubuntu `lsb_release -cs` nginx-plus\n" | tee /etc/apt/sources.list.d/nginx-plus.list

7. DoS 리포지토리를 추가합니다.
printf "deb https://pkgs.nginx.com/app-protect/ubuntu `lsb_release -cs` nginx-plus\n" | tee /etc/apt/sources.list.d/nginx-app-protect.list
printf "deb https://pkgs.nginx.com/app-protect-security-updates/ubuntu `lsb_release -cs` nginx-plus\n" | tee /etc/apt/sources.list.d/app-protect-security-updates.list

8. apt 구성을 /etc/apt/apt.conf.d
위치에 다운로드 합니다.
wget -P /etc/apt/apt.conf.d https://cs.nginx.com/static/files/90pkgs-nginx

9. 리포지토리를 업데이트하고 최신 버전의 DoS 패키지(NGINX Plus 포함)를 설치합니다.
apt-get update
apt-get install app-protect-dos


10. NGINX 바이너리 버전을 확인하여 NGINX Plus가 올바르게 설치되었는지 확인하십시오,
nginx -v

11. App Protect DoS 바이너리 버전을 확인하여 올바른 버전이 올바르게 설치되었는지 확인하십시오.
admd -v

12. nginx.conf
파일 메인 컨텍스트에 NGINX App Protect DoS모듈을 로드합니다.nginx.conf
파일은 /etc/nginx/
디렉터리에 있습니다,
load_module modules/ngx_http_app_protect_dos_module.so;

13. /etc/nginx/conf.d
디렉터리에 있는 .conf
파일의 location 블록에 NGINX App Protect DoS를 활성화 하는 구문을 작성합니다.
app_protect_dos_enable on;
app_protect_dos_name "vs-example";
app_protect_dos_policy_file "/etc/app_protect_dos/BADOSDefaultPolicy.json";
app_protect_dos_monitor "example.com/";

3. NGINX App Protect DoS 구성

내장된 실시간 활동 모니터링 대시보드 에서 NGINX App Protect DoS가 정상적으로 구동 되는지 확인할 수 있습니다.
3-1. 실시간 활동 모니터링 대시보드 구성
1. /etc/nginx/conf.d
디렉터리에 있는 .conf
파일에 location 블록을 하나 추가하여 대시보드 api 를 생성합니다.
allow
구문과 deny
구문을 사용하여 모니터링 대시보드에 액세스 할 수 있는 IP를 제한할 수 있습니다.
그 후, 대시보드의 내용이 모니터링 될 웹 애플리케이션의 root 경로를 새 location 블록에 생성합니다.
server {
listen 443 ssl;
server_name devops2.nginxstore.kr;
# ...
location /api {
app_protect_dos_api;
allow 175.196.235.27;
deny all;
}
location = /dashboard-dos.html {
root /usr/share/nginx/html;
}
}

2. 편집한 내용을 저장하고 NGINX를 재시작 하여 편집내용을 적용하십시오.
3-2. 실시간 활동 모니터링 대시보드 액세스
브라우저의 주소 표시줄에 대시보드 페이지에 해당하는 주소를 입력하십시오.
(해당 예에서는 https://devops2.nginxstore.kr/dashboard-dos.html)



4. NGINX App Protect DoS 구성 테스트
NGINX App Protect DoS가 잘 구성 되었는지 확인하기 위해 간단한 트래픽 발생으로 테스트를 진행합니다.
4-1. 트래픽 발생
테스트를 위해 트래픽을 발생시키는 간단한 툴로 300명의 사용자가 무한정으로 새로고침을 하여 트래픽을 발생 시키도록 구성하고, 그 결과를 실시간 활동 모니터링 대시보드에서 확인합니다.

NGINX App Protect DoS에서 트래픽을 감지하고 이를 대시보드에 그래프로 표시합니다.
NGINX App Protect DoS를 직접 사용해 볼 준비가 되셨습니까? 지금 무료 30일 평가판을 시작하거나 사용 사례에 대해 논의하려면 NGINX STORE 에 문의하십시오.
댓글을 달려면 로그인해야 합니다.