AWS WAF: lọc request độc hại trước khi tới ứng dụng
Một phần traffic tới website là traffic độc hại; một web application firewall đặt trước ứng dụng có thể chặn các request này trước khi chúng tới ứng dụng.
Sáu loại request đang được gửi tới MFTECH, trong đó có một đối tác vận chuyển hợp lệ gọi từ nước ngoài bằng IP cố định. Kích hoạt từng rule, chọn tài nguyên liên kết với AWS WAF, sau đó gửi request.
AWS WAF đánh giá các rule trong web ACL theo priority từ số nhỏ nhất trở lên, cho tới khi gặp một rule khớp có terminating action (Allow hoặc Block) hoặc đã xét hết rule. Vì vậy, khi chặn theo quốc gia bằng geo match nhưng vẫn cần cho phép một số IP của đối tác, MFTECH đặt rule IP set chứa các IP đó với action Allow ở priority nhỏ hơn rule geo match: request của đối tác được cho phép ngay và không còn được đánh giá bởi rule geo match.
- SQL injection, XSS: managed rule.
- Giới hạn theo quốc gia: geo match.
- Một IP độc hại: IP set với action Block.
- Ngoại lệ cho IP đối tác trong một quốc gia bị chặn: IP set với action Allow, priority nhỏ hơn rule geo match.
- Request với tần suất bất thường: rate-based rule (evaluation window 1, 2, 5 hoặc 10 phút, mặc định 5 phút; ngưỡng tối thiểu 10 request).
- AWS WAF được liên kết với CloudFront, ALB, API Gateway REST API và một số dịch vụ khác (AppSync, Cognito, App Runner, Verified Access, Amplify), không gắn trực tiếp vào EC2.
- AWS WAF chỉ kiểm tra request HTTP và HTTPS; traffic SFTP (SSH) tới endpoint AWS Transfer Family không đi qua AWS WAF, nên giới hạn IP nguồn cho SFTP được thực hiện bằng security group của VPC hosted endpoint.
AWS WAF: filtering malicious requests before they reach the application
Part of the traffic reaching a website is malicious; a web application firewall placed in front of the application can block those requests before they reach the application.
Six kinds of requests are being sent to MFTECH, including a legitimate shipping partner calling from abroad with a fixed IP address. Turn on each rule, choose the resource associated with AWS WAF, then send the requests.
AWS WAF evaluates the rules in a web ACL by priority, from the lowest numeric setting up, until it finds a matching rule with a terminating action (Allow or Block) or exhausts all rules. So when MFTECH blocks countries with a geo match rule but must still allow some partner IP addresses, it places an IP set rule with those addresses and the Allow action at a lower priority number than the geo match rule: the partner’s request is allowed immediately and is never evaluated by the geo match rule.
- SQL injection, XSS: managed rule.
- Restricting by country: geo match.
- One malicious IP: IP set with the Block action.
- An exception for partner IP addresses in a blocked country: IP set with the Allow action at a lower priority number than the geo match rule.
- Requests at an unusual rate: rate-based rule (evaluation window of 1, 2, 5 or 10 minutes, 5 minutes by default; minimum threshold of 10 requests).
- AWS WAF is associated with CloudFront, ALB, API Gateway REST APIs and some other services (AppSync, Cognito, App Runner, Verified Access, Amplify); it is not attached directly to EC2.
- AWS WAF inspects only HTTP and HTTPS requests; SFTP (SSH) traffic to an AWS Transfer Family endpoint does not pass through AWS WAF, so source IPs for SFTP are restricted with the security group of a VPC hosted endpoint.