Share Your AWS re:Post Experience - Quick 3 Question Survey
Help us improve AWS re:Post! We're interested in understanding how you use re:Post and its impact on your AWS journey. Please take a moment to complete our brief 3-question survey.
AWS WAF에서 복잡한 사용자 지정 JSON 규칙을 어떻게 생성하나요?
AWS WAF에서 복잡한 사용자 지정 JSON 규칙을 생성하려고 합니다.
해결 방법
Rule JSON editor의 Web ACLs 및 AWS WAF 콘솔의 Rule groups에서 복잡한 사용자 지정 규칙을 생성합니다. 규칙 그룹 또는 규칙이 정의된 웹 액세스 제어 목록(웹 ACL)을 통해 규칙에 액세스합니다.
중첩된 구문을 사용하는 사용자 지정 규칙을 생성하려면 JSON 편집기를 사용해야 합니다. 중첩된 구문은 AND, OR 또는 NOT 로직을 결합합니다. 자세한 내용은 규칙 구문 기본 사항을 참조하세요.
규칙 구문을 생성하려면 AWS WAF 콘솔의 Rule visual editor를 사용하세요. 그런 다음 Rule JSON editor를 선택하여 JSON 구문을 확인하고 JSON 편집기에서 필요한 사항을 변경합니다.
다음 예시를 참고하여 사용자 지정 규칙 로직을 생성하세요.
예시 1
United States - US에서 시작되고 /wp-admin/ 또는 /wp-login/ URI가 있는 요청을 허용하려면 다음 사용자 지정 규칙 구문을 사용하세요.
{ "Name": "test", "Priority": 100, "Statement": { "AndStatement": { "Statements": [ { "GeoMatchStatement": { "CountryCodes": [ "US" ] } }, { "OrStatement": { "Statements": [ { "ByteMatchStatement": { "SearchString": "/wp-admin/", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "CONTAINS" } }, { "ByteMatchStatement": { "SearchString": "/wp-login/", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "CONTAINS" } } ] } } ] } }, "Action": { "Allow": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "test" } }
규칙 로직: 요청이 (from US) AND URI는 ( /a OR /b ) ).
예시 2
본문에 XSS 서명이 있는 요청을 차단하려면 다음 사용자 지정 규칙 구문을 사용하세요. 이 규칙은 /test, /login 및 /admin URI를 검사에서 제외합니다.
{ "Name": "XSS_Block_Allow_Uploads", "Priority": 100, "Statement": { "AndStatement": { "Statements": [ { "XssMatchStatement": { "FieldToMatch": { "Body": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ] } }, { "NotStatement": { "Statement": { "OrStatement": { "Statements": [ { "ByteMatchStatement": { "SearchString": "/test", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "EXACTLY" } }, { "ByteMatchStatement": { "SearchString": "/admin", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "EXACTLY" } }, { "ByteMatchStatement": { "SearchString": "/login", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "EXACTLY" } } ] } } } } ] } }, "Action": { "Block": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "XSS_Block_Allow_Uploads" } }
규칙 로직: 요청에 (XSS signature in the body) AND URI는 NOT ( /a OR /b, OR /c ).
예시 3
internal 사용자 지정 레이블이 포함된 요청을 차단하려면 다음 사용자 지정 규칙 구문을 사용하세요. 또한 요청에는 호스트, IP 주소 및 URI에 대한 특정 조합이 있을 수 없습니다.
{ "Name": "Block_internal_unauthorized", "Priority": 100, "Statement": { "AndStatement": { "Statements": [ { "LabelMatchStatement": { "Scope": "LABEL", "Key": "internal" } }, { "NotStatement": { "Statement": { "AndStatement": { "Statements": [ { "ByteMatchStatement": { "FieldToMatch": { "UriPath": {} }, "PositionalConstraint": "EXACTLY", "SearchString": "/test", "TextTransformations": [{ "Type": "NONE", "Priority": 0 }] } }, { "IPSetReferenceStatement": { "ARN": "arn:aws:wafv2:us-east-1:xxxxxxxxxxxx:regional/ipset/internal_IPs/xxx-xx-xxx" } }, { "ByteMatchStatement": { "FieldToMatch": { "SingleHeader": { "Name": "host" } }, "PositionalConstraint": "EXACTLY", "SearchString": "example.com", "TextTransformations": [{ "Type": "NONE", "Priority": 0 }] } } ] } } } } ] } }, "Action": { "Block": {} }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "Block_internal_unauthorized" } }
규칙 로직: 요청이 (contains the labe) AND not (URI and IP and host)인 경우 차단합니다.

관련 콘텐츠
- 질문됨 2달 전lg...
- 질문됨 2달 전lg...
- 질문됨 한 달 전lg...
- AWS 공식업데이트됨 9달 전
- AWS 공식업데이트됨 9달 전
- AWS 공식업데이트됨 9달 전
- AWS 공식업데이트됨 3년 전