다루는 내용
-
WAF(Web Application Firewall) 컨셉 이해하기
-
콘솔에서 WAF 설정하기
-
CloudFront에 WAF 적용하기
실습
WAF 컨셉 이해하기
AWS WAF(Web Application Filewall)은 CloudFront 앞 단에서 HTTP, HTTPS 요청을 필터링한다.
CloudFront Distribution에는 하나의 Web ACL을 적용할 수 있으며, 하나의 Web ACL은 다수의 Rule을 포함한다. 또한 하나의 Rule에는 여러 Condition을 적용할 수 있다. Condition으로는 IP match, String match, SQL Injection match가 있다.
콘솔에서 WAF 설정하기
-
콘솔에서 WAF 클릭
-
Get started 클릭
-
Concepts overview 페이지에서1) Next 클릭
-
Name web ACL 페이지에서1) Web ACL name : labWebACL 입력2) Next 클릭
-
Create conditions 페이지에서
IP match condition1) Create IP match condition 클릭2) Name : BadIP 입력3) Add an IP address or range 클릭4) IP address or range : xxx.xxx.xxx.xxx/32 입력 (차단할 IP address)5) Create 클릭
String match condition1) Create string match condition 클릭2) Name : BadReferer 입력3) Create 클릭4) Next 클릭 -
Create rules 페이지에서1) Create rule 클릭2) Name : DenyBadIP 입력3) Add conditions : When a request does originate from an IP address in BadIP4) Create 클릭5) Create rule 클릭6) Name : DenyBadString 입력7) Add conditions : When a request does match at least one of the filters in the string match condition BadReferer8) Create 클릭9) Action 수정
조건에 맞는 경우 Block하고, 나머지의 경우 Allow 한다.10) Next 클릭 -
Review and create 페이지에서1) Confirm and create 클릭
-
Web ACLs 수정
현재 하나의 Web ACL을 만들고, 두 개의 Rule을 만들었다. DenyBadIP 룰에는 value를 입력하였지만, DenyBadString rule에는 value를 입력하지 않았다.
String matching 수정-
왼쪽 메뉴에서 String matching 클릭
-
BadReferer 클릭
-
Add filter 클릭
-
Part of the request to filter on : Header 선택
-
Header : Referer 선택
-
Match type : Contains 선택
-
Value to match : arang.com 입력
-
Add 클릭
SQL injection 추가
-
왼쪽 메뉴에서 SQL injection 클릭 → Create condition 클릭
-
Name : BadSQL 입력
-
Part of the request to filter on : Header 선택
-
Header : User-Agent 선택
-
Add another filter 클릭
-
Create 클릭
-
왼쪽 메뉴에서 Rules 클릭 → Create rule 클릭
-
Name : DenySQL 입력
-
Add conditions : When a request does match at least one of the filters in the SQL injection match condition BadSQL
-
Create 클릭
-
왼쪽 메뉴에서 Web ACLs 클릭 → labWebACL 클릭 → Edit web ACL 클릭
-
DenySQL 선택 → Add rule to web ACL 클릭
-
Action : Block 수정
-
Save changes 클릭
-
CloudFront에 WAF 적용하기
CloudFront Distribution의 General 설정에 AWS WAF Web ACL 항목이 추가되어 있다.
-
AWS WAF Web ACL : labWebACL 선택
-
Yes, Edit 클릭
테스트(결과 확인)
-
정상 요청
-
BadIP 요청
-
BadReferer 요청
-
BadSQL 요청
참고
※ http://docs.aws.amazon.com/ko_kr/waf/latest/developerguide/what-is-aws-waf.html
'Cloud AWS' 카테고리의 다른 글
CloudFront와 Route53 기반 콘텐츠 배포 전략 (0) | 2015.11.16 |
---|---|
Amazon AWS MOBILE HUB 사용 (0) | 2015.11.15 |
Amazon AWS :: KMS로 S3와 EBS 데이터 암호화 (0) | 2015.11.15 |
Amazon AWS :: COGNITO소개 (0) | 2015.11.15 |
Amazon AWS :: Elastic Block Store(EBS) 소개 (0) | 2015.11.14 |