

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 에 대한 Amazon CloudWatch 알림 사용자 지정 AWS Network Firewall
<a name="customize-amazon-cloudwatch-alerts-for-aws-network-firewall"></a>

*Jason Owens, Amazon Web Services*

## 요약
<a name="customize-amazon-cloudwatch-alerts-for-aws-network-firewall-summary"></a>

이 패턴은에서 생성되는 Amazon CloudWatch 알림을 사용자 지정하는 데 도움이 됩니다 AWS Network Firewall. 사전 정의된 규칙을 사용하거나 알림의 메시지, 메타데이터 및 심각도를 결정하는 사용자 지정 규칙을 생성할 수 있습니다. 그런 다음 이러한 경고에 따라 조치를 취하거나 Amazon EventBridge와 같은 다른 Amazon 서비스를 이용해 응답을 자동화할 수 있습니다.

이 패턴에서는 Suricata와 호환되는 방화벽 규칙을 생성합니다. [Suricata](https://suricata.io/)는 오픈 소스 위협 탐지 엔진입니다. 먼저 간단한 규칙을 만든 다음 이를 테스트하여 CloudWatch 알림이 생성되고 로그되는지 확인합니다. 규칙을 성공적으로 테스트한 후에는 규칙을 수정하여 사용자 지정 메시지, 메타데이터 및 심각도를 정의한 다음 다시 한 번 테스트하여 업데이트를 확인합니다.

## 사전 조건 및 제한 사항
<a name="customize-amazon-cloudwatch-alerts-for-aws-network-firewall-prereqs"></a>

**사전 조건 **
+ 활성. AWS 계정
+ AWS Command Line Interface Linux, macOS 또는 Windows 워크스테이션에 설치 및 구성된 (AWS CLI) 자세한 내용은 [최신 버전의 AWS CLI설치 또는 업데이트](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)를 참조하세요.
+ AWS Network Firewall CloudWatch Logs를 사용하도록 설치 및 구성되었습니다. 자세한 내용은 [네트워크 트래픽 로깅을 참조하세요 AWS Network Firewall](https://docs.aws.amazon.com/network-firewall/latest/developerguide/firewall-logging.html).
+ Network Firewall을 통해 보호되는 Virtual Private Cloud(VPC)의 프라이빗 서브넷에 있는 Amazon Elastic Compute Cloud(Amazon EC2) 인스턴스입니다.

**제품 버전**
+ 버전 1의 경우 1.18.180 이상을 AWS CLI사용합니다. 버전 2의 경우 2.1.2 이상을 AWS CLI사용합니다.
+ Suricata 버전 5.0.2의 classification.config 파일입니다. 이 구성 파일의 사본은 [추가 정보](#customize-amazon-cloudwatch-alerts-for-aws-network-firewall-additional) 섹션을 참조하세요.

## 아키텍처
<a name="customize-amazon-cloudwatch-alerts-for-aws-network-firewall-architecture"></a>

![\[EC2 인스턴스 요청은 Network Firewall에서 알림을 생성하여 CloudWatch로 전달\]](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/images/pattern-img/da6087a9-e942-4cfe-85e3-3b08de6f3ba5/images/778d85cd-bc87-4ed0-a161-d35eb5daa694.png)


다이어그램은 다음 아키텍처를 보여줍니다.

1. 프라이빗 서브넷의 Amazon EC2 인스턴스는 [curl](https://curl.se/) 또는 [Wget](https://www.gnu.org/software/wget/)을 사용하여 요청을 보냅니다.

1. Network Firewall은 트래픽을 처리하고 알림을 생성합니다.

1. Network Firewall은 로그된 알림을 CloudWatch Logs에 전송합니다.

## 도구
<a name="customize-amazon-cloudwatch-alerts-for-aws-network-firewall-tools"></a>

**AWS 서비스**
+ [Amazon CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html)를 사용하면 AWS 리소스 및에서 실행되는 애플리케이션의 지표를 실시간으로 모니터링할 AWS 수 있습니다.
+ [Amazon CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html)를 사용하면 모든 시스템, 애플리케이션 및의 로그를 중앙 집중화 AWS 서비스 하여 모니터링하고 안전하게 보관할 수 있습니다.
+ [AWS Command Line Interface (AWS CLI)](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)는 명령줄 셸의 명령을 AWS 서비스 통해와 상호 작용하는 데 도움이 되는 오픈 소스 도구입니다.
+ [AWS Network Firewall](https://docs.aws.amazon.com/network-firewall/latest/developerguide/what-is-aws-network-firewall.html)은 AWS 클라우드에 있는 Virtual Private Cloud(VPC)를 위한 상태 저장형, 관리형, 네트워크 방화벽 및 침입 탐지 및 방지 서비스입니다. 

**기타 도구**
+ [curl](https://curl.se/)은 오픈 소스 명령줄 도구 및 라이브러리입니다.
+ [GNU Wget](https://www.gnu.org/software/wget/)은 무료 명령줄 도구입니다.

## 에픽
<a name="customize-amazon-cloudwatch-alerts-for-aws-network-firewall-epics"></a>

### 방화벽 규칙 및 규칙 그룹 생성
<a name="create-the-firewall-rules-and-rule-group"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
| 규칙을 생성합니다. | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/customize-amazon-cloudwatch-alerts-for-aws-network-firewall.html) | AWS 시스템 관리자, 네트워크 관리자 | 
| 규칙 그룹을 생성합니다. | 에 다음 명령을 AWS CLI입력합니다. 이렇게 하면 규칙 그룹이 생성됩니다.<pre>❯ aws network-firewall create-rule-group \<br />        --rule-group-name custom --type STATEFUL \<br />        --capacity 10 --rules file://custom.rules \<br />        --tags Key=environment,Value=development</pre>다음은 예시 출력입니다. 이후 단계에서 필요할 `RuleGroupArn`을 메모합니다.<pre>{<br />    "UpdateToken": "4f998d72-973c-490a-bed2-fc3460547e23",<br />    "RuleGroupResponse": {<br />        "RuleGroupArn": "arn:aws:network-firewall:us-east-2:1234567890:stateful-rulegroup/custom",<br />        "RuleGroupName": "custom",<br />        "RuleGroupId": "238a8259-9eaf-48bb-90af-5e690cf8c48b",<br />        "Type": "STATEFUL",<br />        "Capacity": 10,<br />        "RuleGroupStatus": "ACTIVE",<br />        "Tags": [<br />            {<br />                "Key": "environment",<br />                "Value": "development"<br />            }<br />        ]<br />    }</pre> | AWS 시스템 관리자 | 

### 방화벽 정책 업데이트
<a name="update-the-firewall-policy"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
| 방화벽 정책의 ARN 획득. | 에 다음 명령을 AWS CLI입력합니다. 이는 방화벽 정책의 Amazon 리소스 이름(ARN)을 반환합니다. 나중에 이 패턴에서 사용할 수 있도록 ARN을 기록합니다.<pre>❯ aws network-firewall describe-firewall \<br />    --firewall-name aws-network-firewall-anfw \<br />    --query 'Firewall.FirewallPolicyArn'</pre>다음은 이 명령을 통해 반환된 ARN 예시입니다.<pre>"arn:aws:network-firewall:us-east-2:1234567890:firewall-policy/firewall-policy-anfw"</pre> | AWS 시스템 관리자 | 
| 방화벽 정책을 업데이트합니다. | 텍스트 편집기에서 다음 코드를 붙여 넣습니다. `<RuleGroupArn>`을 이전 에픽에서 기록한 값으로 바꾸세요. 파일을 `firewall-policy-anfw.json`(으)로 저장합니다.<pre>{<br />    "StatelessDefaultActions": [<br />        "aws:forward_to_sfe"<br />    ],<br />    "StatelessFragmentDefaultActions": [<br />        "aws:forward_to_sfe"<br />    ],<br />    "StatefulRuleGroupReferences": [<br />        {<br />            "ResourceArn": "<RuleGroupArn>"<br />        }<br />    ]<br />}</pre> AWS CLI에서 다음 명령을 입력합니다. 이 명령을 사용해 새 규칙을 추가하려면 [업데이트 토큰](https://docs.aws.amazon.com/cli/latest/reference/network-firewall/update-firewall-policy.html)이 필요합니다. 토큰은 정책을 마지막으로 검색한 이후 정책이 변경되지 않았음을 확인하는 데 사용됩니다.<pre>UPDATETOKEN=(`aws network-firewall describe-firewall-policy \<br />              --firewall-policy-name firewall-policy-anfw \<br />              --output text --query UpdateToken`)<br /> <br /> aws network-firewall update-firewall-policy \<br /> --update-token $UPDATETOKEN \<br /> --firewall-policy-name firewall-policy-anfw \<br /> --firewall-policy file://firewall-policy-anfw.json</pre> | AWS 시스템 관리자 | 
| 정책 업데이트를 확인합니다. | (선택 사항) 규칙이 추가되었는지 확인하고 정책 형식을 보려면 AWS CLI에서 다음 명령을 입력합니다.<pre>❯ aws network-firewall describe-firewall-policy \<br />  --firewall-policy-name firewall-policy-anfw \<br />  --query FirewallPolicy</pre>다음은 예시 출력입니다.<pre>{<br />    "StatelessDefaultActions": [<br />        "aws:forward_to_sfe"<br />    ],<br />    "StatelessFragmentDefaultActions": [<br />        "aws:forward_to_sfe"<br />    ],<br />    "StatefulRuleGroupReferences": [<br />        {<br />            "ResourceArn": "arn:aws:network-firewall:us-east-2:1234567890:stateful-rulegroup/custom"<br />        }<br />    ]<br />}</pre> | AWS 시스템 관리자 | 

### 테스트 경고 기능
<a name="test-alert-functionality"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
| 테스트용 경고 생성. | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/customize-amazon-cloudwatch-alerts-for-aws-network-firewall.html) | AWS 시스템 관리자 | 
| 경고가 로그되었는지 확인합니다. | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/customize-amazon-cloudwatch-alerts-for-aws-network-firewall.html) | AWS 시스템 관리자 | 

### 방화벽 규칙 및 규칙 그룹 업데이트
<a name="update-the-firewall-rules-and-rule-group"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
| 방화벽 규칙 업데이트. | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/customize-amazon-cloudwatch-alerts-for-aws-network-firewall.html) | AWS 시스템 관리자 | 
| 규칙 그룹을 업데이트합니다. | 에서 다음 명령을 AWS CLI실행합니다. 방화벽 정책의 ARN을 사용하세요. 이 명령은 업데이트 토큰을 얻고 규칙 그룹을 규칙 변경으로 업데이트합니다.<pre>❯ UPDATETOKEN=(`aws network-firewall \<br />                describe-rule-group \<br />--rule-group-arn arn:aws:network-firewall:us-east-2:123457890:stateful-rulegroup/custom \<br />--output text --query UpdateToken`)</pre><pre> ❯ aws network-firewall update-rule-group \<br />  --rule-group-arn arn:aws:network-firewall:us-east-2:1234567890:stateful-rulegroup/custom \<br />--rules file://custom.rules \<br />--update-token $UPDATETOKEN</pre>다음은 예시 출력입니다.<pre>{<br />    "UpdateToken": "7536939f-6a1d-414c-96d1-bb28110996ed",<br />    "RuleGroupResponse": {<br />        "RuleGroupArn": "arn:aws:network-firewall:us-east-2:1234567890:stateful-rulegroup/custom",<br />        "RuleGroupName": "custom",<br />        "RuleGroupId": "238a8259-9eaf-48bb-90af-5e690cf8c48b",<br />        "Type": "STATEFUL",<br />        "Capacity": 10,<br />        "RuleGroupStatus": "ACTIVE",<br />        "Tags": [<br />            {<br />                "Key": "environment",<br />                "Value": "development"<br />            }<br />        ]<br />    }<br />}</pre> | AWS 시스템 관리자 | 

### 업데이트된 경고 기능 테스트
<a name="test-the-updated-alert-functionality"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
| 테스트용 경고를 생성합니다. | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/customize-amazon-cloudwatch-alerts-for-aws-network-firewall.html) | AWS 시스템 관리자 | 
| 경고가 변경되었는지 확인합니다. | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/customize-amazon-cloudwatch-alerts-for-aws-network-firewall.html) | AWS 시스템 관리자 | 

## 관련 리소스
<a name="customize-amazon-cloudwatch-alerts-for-aws-network-firewall-resources"></a>

**참조**
+ [에서 Slack 채널 AWS Network Firewall 로 알림 전송](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/send-alerts-from-aws-network-firewall-to-a-slack-channel.html)(AWS 권고 가이드)
+ [Suricata를 AWS 사용하여에서 위협 방지 확장](https://aws.amazon.com/blogs/opensource/scaling-threat-prevention-on-aws-with-suricata/)(AWS 블로그 게시물)
+ [용 배포 모델 AWS Network Firewall](https://aws.amazon.com/blogs/networking-and-content-delivery/deployment-models-for-aws-network-firewall/)(AWS 블로그 게시물)
+ [Suricata 메타 키웍스](https://suricata.readthedocs.io/en/suricata-6.0.1/rules/meta.html)(Suricata 설명서)

**자습서 및 동영상**
+ [AWS Network Firewall 워크숍](https://networkfirewall.workshop.aws/)

## 추가 정보
<a name="customize-amazon-cloudwatch-alerts-for-aws-network-firewall-additional"></a>

다음은 Suricata 5.0.2의 분류 구성 파일입니다. 이러한 분류는 방화벽 규칙을 만들 때 사용됩니다.

```
# config classification:shortname,short description,priority
 
config classification: not-suspicious,Not Suspicious Traffic,3
config classification: unknown,Unknown Traffic,3
config classification: bad-unknown,Potentially Bad Traffic, 2
config classification: attempted-recon,Attempted Information Leak,2
config classification: successful-recon-limited,Information Leak,2
config classification: successful-recon-largescale,Large Scale Information Leak,2
config classification: attempted-dos,Attempted Denial of Service,2
config classification: successful-dos,Denial of Service,2
config classification: attempted-user,Attempted User Privilege Gain,1
config classification: unsuccessful-user,Unsuccessful User Privilege Gain,1
config classification: successful-user,Successful User Privilege Gain,1
config classification: attempted-admin,Attempted Administrator Privilege Gain,1
config classification: successful-admin,Successful Administrator Privilege Gain,1
 
# NEW CLASSIFICATIONS
config classification: rpc-portmap-decode,Decode of an RPC Query,2
config classification: shellcode-detect,Executable code was detected,1
config classification: string-detect,A suspicious string was detected,3
config classification: suspicious-filename-detect,A suspicious filename was detected,2
config classification: suspicious-login,An attempted login using a suspicious username was detected,2
config classification: system-call-detect,A system call was detected,2
config classification: tcp-connection,A TCP connection was detected,4
config classification: trojan-activity,A Network Trojan was detected, 1
config classification: unusual-client-port-connection,A client was using an unusual port,2
config classification: network-scan,Detection of a Network Scan,3
config classification: denial-of-service,Detection of a Denial of Service Attack,2
config classification: non-standard-protocol,Detection of a non-standard protocol or event,2
config classification: protocol-command-decode,Generic Protocol Command Decode,3
config classification: web-application-activity,access to a potentially vulnerable web application,2
config classification: web-application-attack,Web Application Attack,1
config classification: misc-activity,Misc activity,3
config classification: misc-attack,Misc Attack,2
config classification: icmp-event,Generic ICMP event,3
config classification: inappropriate-content,Inappropriate Content was Detected,1
config classification: policy-violation,Potential Corporate Privacy Violation,1
config classification: default-login-attempt,Attempt to login by a default username and password,2
 
# Update
config classification: targeted-activity,Targeted Malicious Activity was Detected,1
config classification: exploit-kit,Exploit Kit Activity Detected,1
config classification: external-ip-check,Device Retrieving External IP Address Detected,2
config classification: domain-c2,Domain Observed Used for C2 Detected,1
config classification: pup-activity,Possibly Unwanted Program Detected,2
config classification: credential-theft,Successful Credential Theft Detected,1
config classification: social-engineering,Possible Social Engineering Attempted,2
config classification: coin-mining,Crypto Currency Mining Activity Detected,2
config classification: command-and-control,Malware Command and Control Activity Detected,1
```