Waf

作者 aws188af2f810ce无许可证2.8K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

Configures AWS WAF to filter web traffic: creating web access control lists (web ACLs) on CloudFront, Application Load Balancers, API Gateway, and AppSync; AWS Managed Rules tuned in Count mode; rate-based rules for HTTP floods; IP set and geographic match rules; Bot Control (Common and Targeted); turning bot labels into a confidence signal; stripping spoofed inbound x-amzn-waf-* headers; recovering the real client IP behind a CDN; Fraud Control (account takeover and account creation fraud prevention); and logging and request sampling. Use when the user wants to protect a web application or API from common exploits, bots, credential stuffing, fake-account creation, or HTTP floods at the application layer (layer 7). Routes to the right per-task procedure in references. Do NOT use for L3/L4 DDoS protection (shieldadvanced skill), multi-account WAF rollout (firewallmanager skill), CloudFront configuration (cloudfront skill), or Route 53 health checks or records (route53 skill).

AI 生成的概览

将 AWS WAF 配置任务路由到按任务划分的参考流程,用于过滤 Web 流量。

功能
该技能是配置 AWS WAF(第 7 层 Web 应用防火墙)的路由器。它把用户目标映射到十三个参考流程之一,涵盖 Web ACL 创建与关联、以 Count 模式调优的托管规则、基于速率的规则、IP 集与地理匹配规则、Bot Control、信号转发、请求头剥离、真实客户端 IP 还原、Fraud Control、AI 爬虫管理,以及日志与请求采样。它产出的是构建和调优 WAF 规则的指导与命令序列,而不是被保护的资源本身。
适用场景
当用户希望在应用层保护 Web 应用或 API,防御常见漏洞利用、机器人、撞库、虚假账号注册或 HTTP 洪水攻击时使用。也适用于调优误报、将机器人信号转发到源站,或设置 WAF 日志。不适用于 L3/L4 DDoS 防护、多账号 WAF 部署,或 CloudFront 与负载均衡器配置。
运行要求
需要 AWS WAF 访问权限,最好通过 AWS MCP 服务器,并以 AWS CLI 作为回退;还需要最小权限的 wafv2 IAM 权限和临时凭证。日志流程需要 CloudWatch Logs、S3 或 Firehose 等日志目标。不附带脚本,仅为说明文档与参考文档。

AWS WAF

Overview

Domain expertise for configuring AWS WAF, the web application firewall that filters HTTP and HTTPS traffic to CloudFront distributions, Application Load Balancers, API Gateway REST APIs, and AppSync GraphQL APIs. Covers web ACL creation and association, AWS Managed Rules, rate-based rules, match rules (IP set and geographic), Bot Control and the signal-forwarding workflows built on top of it, Fraud Control for logins and signups, AI and LLM crawler management, and the logging that every tuning workflow depends on.

This skill is a router. Each customer task maps to a procedure file under references/. Read the matching reference in full before acting, then follow its constraints and steps. The reference files are self-contained: each carries its own decision tables, constraints, procedure, and troubleshooting.

Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging, observability). Fall back to the AWS CLI otherwise. A web ACL's scope is fixed at creation: a CloudFront web ACL must be created in us-east-1 with CLOUDFRONT scope, while a regional web ACL (Application Load Balancer, API Gateway, AppSync) is created in the resource's Region with REGIONAL scope.

Which WAF task do you need?

GoalReference
Create a web ACL and attach it to a resourcecreating a web ACL and associating it with a resource [blocked]
Set up logging and sampling before tuning anythingsetting up logging and request sampling [blocked]
Add AWS Managed Rules and tune false positivesadding managed rules and tuning with count mode [blocked]
Throttle HTTP floods and brute forceadding rate-based rules [blocked]
Allow or block by IP range or countryusing ip sets and geographic match rules [blocked]
Detect and control bots (the on-ramp)protecting against bots with bot control [blocked]
Collapse bot labels into one confidence signalturning bot control labels into a confidence signal [blocked]
Forward all signals to the origin with one ruleforwarding signals with dynamic label interpolation [blocked]
Decide what the app does with the forwarded signaladaptive mitigation playbook for forwarded signals [blocked]
Stop attackers from spoofing forwarded headersstripping inbound waf headers before trusting them [blocked]
Recover the real client IP behind a CDNrecovering the real client ip behind a cdn [blocked]
Protect logins and signups from fraudprotecting logins and signups with fraud control [blocked]
See and manage AI and LLM crawler trafficseeing and managing ai crawler traffic [blocked]

Routing notes

  • Logging comes before tuning. Every Count-mode tuning workflow assumes logging and request sampling are on. If the customer has not set up logging, run that reference first; otherwise Count-mode tuning has nothing to read.
  • Web ACL scope is fixed at creation. A CloudFront web ACL is CLOUDFRONT scope in us-east-1; a regional resource needs a REGIONAL web ACL in its own Region. Scope cannot be changed later, so the creating reference settles it before anything is built.
  • Bot Control is a chain, not one task. Protecting against bots is the on-ramp (turn on, choose Common vs Targeted, observe). Turning labels into a confidence signal, forwarding that signal, and deciding what the application does with it are three separate references that build on it in that order. The header-stripping reference is the mandatory safety companion whenever a signal is forwarded to the origin.
  • Common vs Targeted is not a soft choice. Common only catches self-identifying bots and known-bad IPs. For login, checkout, or any high-value endpoint facing evasive bots, Targeted with the application integration SDK is required. The bots reference pushes Targeted for real bot threats rather than presenting it as optional.
  • Rate limiting vs Fraud Control. Rate-based rules blunt volumetric HTTP floods. Credential stuffing and fake-account creation are account-based abuse that rate limiting misses; those go to the Fraud Control reference (ATP and ACFP), not the rate-based reference.
  • Forwarded headers need the strip rule. Any time the customer forwards a signal or the client IP to the origin in x-amzn-waf-* headers, the inbound-header-stripping reference is required to prevent spoofing. The confidence-signal, interpolation, and client-IP references all point at it.
  • What lives in other skills. L3/L4 DDoS protection and Shield cost-protection credits are the shieldadvanced skill. Multi-account WAF rollout is the firewallmanager skill. CloudFront and Application Load Balancer configuration are their own skills. This skill builds the WAF rules; it does not configure the resources it protects.

Security Considerations

AWS WAF is itself a security control, so misconfiguration directly weakens an application's defenses. Apply these across every reference:

  • Least-privilege IAM. You MUST grant only the specific wafv2: actions a task needs (for example wafv2:CreateWebACL, wafv2:GetWebACL, wafv2:UpdateWebACL, wafv2:AssociateWebACL, wafv2:PutLoggingConfiguration) rather than wafv2:* or the AWSWAFFullAccess managed policy.
  • Ephemeral credentials. You MUST use IAM roles with temporary credentials (such as an EC2 instance profile, SSO session, or aws sts assume-role) rather than long-lived IAM user access keys when running these WAF CLI commands.
  • Monitor configuration changes. You SHOULD enable AWS CloudTrail on wafv2 management events and set CloudWatch alarms on critical web ACL configuration changes (such as DeleteWebACL and UpdateWebACL rule removals) and on the web ACL's BlockedRequests and CountedRequests metrics, so rule changes and sudden spikes in blocked or counted traffic are detected.
  • Misconfiguration opens access. A web ACL that is created but never associated, or one whose default action is left at Allow with no enforcing rules, filters nothing. You MUST confirm the web ACL is associated and that its posture matches the intended default (block vs allow) before reporting setup complete.
  • Protect log destinations. Logs can capture credentials and session data. You MUST redact sensitive fields (such as the authorization header and cookie) and MUST enable encryption at rest on the log destination (CloudWatch Logs, Amazon S3, or Amazon Data Firehose).
  • Header-spoofing risk. Any x-amzn-waf-* signal forwarded to the origin can be forged inbound. You MUST add the inbound-header-stripping rule whenever a signal or client IP is forwarded (see stripping-inbound-waf-headers-before-trusting-them).

Additional Resources

来源与署名

来源:aws/agent-toolkit-for-aws位于skills/specialized-skills/networking-and-content-delivery-skills/waf提交188af2f

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架