DoS 구성

이 문서는 NGINX App Protect DoS 모듈을 구성하는 방법을 설명합니다.

전체 NGINX Ingress Controller(Virtual Server의 App Protect DoS 예제 포함)NGINX Ingress Controller(App Protect DoS 예제 포함)를 확인하십시오.

목차

1. App Protect DoS 구성
2. DoS 정책 구성
3. App Protect DoS Log
4. Global Configuration

1. App Protect DoS 구성

DosProtectedResource는 보호된 리소스 모음의 구성을 보유하는 Custom Resource입니다. Ingress, VirtualServer 및 VirtualServerRoute는 DosProtectedResource에 대한 참조를 지정하여 보호할 수 있습니다.

1. DosProtectedResource 사용자 정의 리소스 Manifest를 만듭니다.

apiVersion: appprotectdos.f5.com/v1beta1
kind: DosProtectedResource
metadata:
 name: dos-protected
spec:
 enable: true
 name: "webapp.example.com"
 apDosMonitor:
    uri: "webapp.example.com"
    protocol: "http1"
    timeout: 5

2. Ingress에 Annotation을 추가하여 Ingress에서 App Protect DoS를 활성화합니다. Annotation 값을 DosProtectedResource의 정규화된 식별자(namespace/name)로 설정합니다.

 apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
    name: webapp-ingress
    annotations:
       appprotectdos.f5.com/app-protect-dos-resource: "default/dos-protected"

3. dos 필드 값을 DosProtectedResource의 정규화된 식별자(namespace/name)로 설정하여 VirtualServer에서 App Protect DoS를 활성화합니다.

apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
 name: webapp
spec:
 host: webapp.example.com
 upstreams:
    - name: webapp
      service: webapp-svc
      port: 80
 routes:
    - path: /
      dos: dos-protected
      action:
         pass: webapp

2. DoS 정책 구성

APDosPolicy Custom Resource를 만들고 DosProtectedResource에서 ApDosPolicy의 정규화된 식별자(namespace/name)를 지정하여 DoS에 대한 정책을 구성할 수 있습니다.

예를 들어 아래와 같이 DoS 정책을 사용한다고 가정해 보겠습니다.

{
 mitigation_mode: "standard",
 signatures: "on",
 bad_actors: "on",
 automation_tools_detection: "on",
 tls_fingerprint: "on",
}

아래와 같이 spec에 정의된 정책을 사용하여 APDosPolicy 리소스를 생성합니다.

 apiVersion: appprotectdos.f5.com/v1beta1
 kind: APDosPolicy
 metadata:
    name: dospolicy
 spec:
    mitigation_mode: "standard"
    signatures: "on"
    bad_actors: "on"
    automation_tools_detection: "on"
    tls_fingerprint: "on"

그런 다음 DosProtectedResource의 참조를 ApDosPolicy에 추가합니다.

 apiVersion: appprotectdos.f5.com/v1beta1
 kind: DosProtectedResource
 metadata:
    name: dos-protected
 spec:
    enable: true
    name: "my-dos"
    apDosMonitor:
       uri: "webapp.example.com"
    apDosPolicy: "default/dospolicy"

3. App Protect DoS Log

APDosLogConf Custom Resource를 생성하고 DosProtectedResource에서 ApDosLogConf의 정규화된 식별자(namespace/name)를 지정하여 App Protect DoS Log 구성을 설정할 수 있습니다.

예를 들어 App Protect DoS를 사용하여 Ingress 리소스에 대한 상태 변경 요청을 기록한다고 가정합니다. App Protect DoS Log 구성은 다음과 같습니다.

{
    "filter": {
        "traffic-mitigation-stats": "all",
        "bad-actors": "top 10",
        "attack-signatures": "top 10"
    }
}

다음과 같이 APDosLogConf 리소스의 spec에 해당 구성을 추가합니다.

apiVersion: appprotectdos.f5.com/v1beta1
kind: APDosLogConf
metadata:
   name: doslogconf
spec:
   filter:
      traffic-mitigation-stats: all
      bad-actors: top 10
      attack-signatures: top 10

그런 다음 DosProtectedResource의 참조를 APDosLogConf에 추가합니다.

 apiVersion: appprotectdos.f5.com/v1beta1
 kind: DosProtectedResource
 metadata:
    name: dos-protected
 spec:
    enable: true
    name: "my-dos"
    apDosMonitor:
       uri: "webapp.example.com"
    dosSecurityLog:
       enable: true
       apDosLogConf: "doslogconf"
       dosLogDest: "syslog-svc.default.svc.cluster.local:514"

4. Global Configuration

NGINX Ingress Controller에는 NGINX App Protect DoS 모듈에서 사용할 수 있는 것과 일치하는 일련의 글로벌 구성 매개변수가 있습니다. 전체 목록은 ConfigMap Key를 참조하세요. App Protect 매개변수는 app-protect-dos* 접두사를 사용합니다.