Ravindra BagaleCourses & study guides English Track your progress

AWS WAF Explained: Web ACLs, Rules, Managed Rule Groups आणि Actions

Arjun Mehta (मुंबई fintech) व Lucas Meyer (Berlin ecommerce): Web ACL मध्ये नक्की काय? ACL, rules, managed rules, priority, actions. CDN/HTTPS साठी CloudFront+WAF survey ला link — duplicate नाही.

या chapter मध्ये तुम्ही काय शिकाल

  • WAF L7 का — Shield/SG शेजारी
  • Web ACL / rules / groups / managed
  • Priority + actions
  • Evaluation path
  • MNC interview

1. रोजचे उदाहरण

Priya Deshmukh (पुणे) /login वर 40k hits. SG = HTTP समजत नाही. Shield Standard = volumetric. WAF = URI rate + CAPTCHA + SQLi Block — Layer 7.

CDN/HTTPS: CloudFront आणि WAF survey. इथे WAF deep-dive.

2. AWS WAF का?

हे का लागतं?

Attackers HTTP बोलतात — SQLi, XSS, stuffing, scrapers, unwanted geo. Network = packets; WAF = abusive requests.

  • OWASP-style आधी थांबवा
  • App rewrite न करता rate-limit
  • एक ACL → अनेक resources
  • Count → Block
  • Logs → SIEM

3. Web ACL काय आहे?

हे काय आहे?

Web ACL = default action + ordered rules + visibility. Scope: REGIONAL किंवा CLOUDFRONT (us-east-1).

Client HTTPS → WAF Web ACL → Allow/Block → ResourcePriority चढत्या क्रमाने
Terminating जिंकतो; Count चालू

Building blocks

PieceRole
Web ACLContainer + default + scope
RuleStatement + action + priority
Rule groupReusable bundle
IP / Regex setNamed lists
Managed rule groupAWS/marketplace signatures
Labelनंतरच्या rules साठी tag

4. Rules आणि statements

Rule = name + priority + action + statement. Match, rate-based, AND/OR/NOT, rule-group ref.

  • ByteMatch — URI/header/body/query
  • GeoMatch — country
  • IP set
  • SQLi / XSS
  • Rate-based 5-min
  • Label match

5. Rule groups आणि AWS Managed Rules

Rule groups = bundle. AWS Managed: CRS, Bad Inputs, SQLi, OS, WordPress, Bot Control, ATP… Marketplace ही.

Managed वर आधी Count

नवीन managed group = Count 24–72 तास → sampled पहा → Block किंवा exclusion.

6. Priority क्रम

छोटा number आधी. Terminating (Allow/Block/CAPTCHA/Challenge) थांबवतो. Count चालू ठेवतो. Default = काही terminate न झाल्यास.

# Example priority map (document this in every PR)
# 10  - Block office-banned IP set
# 100 - Allow /health from ALB health checkers
# 200 - Allow partner webhook IPs on /hooks/*
# 500 - AWSManagedRulesCommonRuleSet (Count→Block)
# 510 - AWSManagedRulesSQLiRuleSet
# 900 - Rate-based 2000 req/5min per IP on /login
# default - Allow

7. Actions

Actionकधी
AllowTrusted; terminate allow
BlockKnown bad; custom response
Countफक्त observe
CAPTCHAHuman puzzle
ChallengeSilent JS challenge

CAPTCHA/Challenge = tokens. Pure API = Block/rate — SDK CAPTCHA नसेल तर break.

8. Custom responses

Block वर custom code/body (429 HTML/JSON). Flash sale branded page.

9. Multi-industry

  • Fintech: CAPTCHA + /otp rate
  • Healthcare: CRS + geo
  • EdTech: Challenge
  • Gov: CRS + CAPTCHA
  • Gaming: Bot + rate

10. Lab: Web ACL वाचा आणि explain करा

कसं करायचं (step by step)

  1. Console → Web ACL.
  2. Default + priorities.
  3. CRS in Count.
  4. Sampled.
  5. PR blurb.

Cleanup

  1. Remove managed.
  2. Delete ACL.

11. सामान्य errors आणि fixes

प्रत्येक row = खरी चूक. Panic करण्याआधी fix वाचा.

Error / लक्षणFix
No blocksScope + Count.
False positiveCount + Allow.
Rate silentThreshold + IP source.
Health 403Allow health IPs.
CAPTCHA on APIAPI = Block/rate.
Empty logsARN + bucket policy.
CF associate failus-east-1.
Shield costConfirm pricing.
Allow hidesNarrow Allow.
CAPTCHA vs ChallengePuzzle vs silent.

12. Troubleshooting checklist

  1. Scope check.
  2. Sampled requests.
  3. Priority order.
  4. curl -v.
  5. Log ruleId.
  6. CF region.
  7. ALB ARN.
  8. Shield health.

13. FAQ

प्र. WAF = network firewall?

नाही — WAF = L7 HTTP.

प्र. CF असताना WAF?

CF ≠ WAF; L7 rules साठी WAF.

प्र. Count vs Block?

Count शिकण्यासाठी; Block नंतर.

प्र. Standard vs Advanced?

Free L3/L4 vs paid extras.

प्र. एक ACL CF+ALB?

नाही — scopes वेगळे.

प्र. HTTPS decrypt?

TLS terminate नंतर.

प्र. Label?

Tag for later rules.

प्र. v2 vs Classic?

v2 वापरा.

14. Interview Q&A

प्र. ACL vs rule vs group?

Container / unit / bundle.

प्र. CF ACL region?

us-east-1.

प्र. Count stop?

नाही.

प्र. 5 managed?

CRS, Bad Inputs, SQLi, Anon IP, Bot…

प्र. CAPTCHA wrong?

Pure API.

प्र. Risky rollout?

Count then Block.

प्र. MNC priority?

Bands as taught.

प्र. WAF/Shield/SG?

L7 / DDoS / ports.

15. Tips — English, मराठी आणि हिंदी

Ravindra Bagale's Tip (EN)

Draw the priority table before you click Create. Count is your seatbelt for managed rules.

Ravindra Bagale's Tip (MR)

Create आधी priority table काढा. Managed साठी Count = seatbelt.

Tip (HI)

Create से पहले priority table बनाएं। Managed rules पर पहले Count लगाएं.

घरी करून बघा

  1. ≥6 statement types.
  2. Hospital bands.
  3. Survey vs this.

थोडक्यात सांगायचं तर

  1. ACL anatomy.
  2. Evaluation.
  3. Count first.
  4. 5 actions.
  5. Survey link.

16. Publish करण्याआधी WAF checklist

  1. Threat एका वाक्यात.
  2. Global vs regional scope.
  3. Default action.
  4. Priority bands.
  5. Count first.
  6. CAPTCHA for humans.
  7. Logging first.
  8. Allow + 403 tests.
  9. On-call owner.
  10. CF+WAF survey link.

17. Copy-paste WAF CLI runbook

# Region for REGIONAL Web ACL (ALB / API GW). Use --scope CLOUDFRONT + us-east-1 for CDN.
export AWS_REGION=ap-south-1
export NAME=rb-waf-lab-$(date +%s)

# IP set (office allowlist example)
aws wafv2 create-ip-set --name $NAME-office --scope REGIONAL --region $AWS_REGION \
  --ip-address-version IPV4 --addresses 203.0.113.10/32

# Web ACL skeleton (default Allow; add rules in console or JSON)
aws wafv2 create-web-acl --name $NAME --scope REGIONAL --region $AWS_REGION \
  --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=$NAME \
  --rules file://rules.json

# Associate to ALB
aws wafv2 associate-web-acl --web-acl-arn $WEB_ACL_ARN --resource-arn $ALB_ARN --region $AWS_REGION

# Logging
aws wafv2 put-logging-configuration --logging-configuration \
  ResourceArn=$WEB_ACL_ARN,LogDestinationConfigs=$LOG_BUCKET_ARN

# Test
curl -s -o /dev/null -w "%{http_code}\n" https://app.example.com/
# expect 200 for allow path; 403 for blocked path

18. Interview-friendly priority bands

  • 0–99: emergency Block
  • 100–199: Allow exceptions
  • 200–499: geo/bot
  • 500–799: Managed Rules
  • 800–899: custom
  • 900–999: rate-based

छोटा number = उच्च priority. पहिला terminating action जिंकतो. Count terminate होत नाही.

19. Industry story bank

एकच WAF pattern; फक्त IP/geo/URI/rate बदला.

  • Fintech: /login /otp rate + CAPTCHA.
  • Healthcare: geo + SQLi.
  • EdTech: Challenge scrapers.
  • Ecommerce: Bot + 429.
  • Media: search rate.
  • SaaS: webhook allowlist.
  • Logistics: geo + rate.
  • Gov: CRS + CAPTCHA.
  • Gaming: Shield + rate.
  • Travel: geo + card-test block.

20. False-positive unlock runbook

  1. Sampled / logs → rule id.
  2. curl -v reproduce.
  3. Block→Count.
  4. Narrow Allow above.
  5. Label exclusions.
  6. Retest + ticket.
  7. Default Allow + empty नको.

21. PR review checklist

  • Correct scope.
  • Priority table.
  • Count → Block date.
  • Logs encrypted.
  • 200 + 403 proofs.
  • Survey link.
  • Shield decision.
  • CF+WAF survey: chapter
  • Well-Architected — पुढचा.
  • S3 policy projects.

23. Metric आणि alarm starter pack

Day-one alarms. Thresholds = starting points.

  • BlockedRequests spike
  • CountedRequests review
  • ALB 5xx
  • ASG at max
  • DDoSDetected
  • CF error rate
  • R53 unhealthy
  • Log delivery

24. Sampled requests वाचन

  1. Sampled → rule.
  2. Action/URI/country.
  3. TP/FP/CAPTCHA.
  4. Request ids → ticket.
  5. Samples+logs.

25. Glossary

TermMeaning
Web ACLRules + default
ScopeREGIONAL / CLOUDFRONT
Managed rule groupAWS/marketplace
LabelDownstream tag
Rate-based5-min threshold
SRTAdvanced humans
Protection groupShield bundle
Firewall ManagerOrg policies
Cost protectionAttack bill relief
ChallengeSilent JS

26. 15-minute tabletop

  1. Scenario inject.
  2. Classify.
  3. First clicks + page.
  4. Comms.
  5. Gap note.

27. Cost notes

WAF = ACL+rules+requests; Bot/ATP जास्त. Shield Advanced = monthly+usage. Logs = storage. Budgets ठेवा.

28. WAF पलीकडे hygiene

  • No CF bypass.
  • IAM least privilege.
  • Log bucket BPA.
  • Quarterly IP/geo.
  • Redact secrets.
  • Break-glass doc.

29. इतर chapters शी pairing

Origin OAC = S3 projects. Security pillar = Well-Architected. CDN/HTTPS = CF+WAF survey.

30. Request flow deep dive

Browser → R53 → CF → WAF → (ALB WAF) → app. Shield पहातो. Logs → SOC.

  1. DNS+TLS (Shield).
  2. Edge WAF.
  3. Cache.
  4. Origin + regional WAF.
  5. ASG serve.
  6. Metrics/logs/SRT.

31. Rule JSON anatomy

{
  "Name": "RateLogin1000",
  "Priority": 900,
  "Action": {"Block": {"CustomResponse": {"ResponseCode": 429}}},
  "VisibilityConfig": {
    "SampledRequestsEnabled": true,
    "CloudWatchMetricsEnabled": true,
    "MetricName": "RateLogin1000"
  },
  "Statement": {
    "RateBasedStatement": {
      "Limit": 1000,
      "AggregateKeyType": "IP",
      "ScopeDownStatement": {
        "ByteMatchStatement": {
          "SearchString": "/login",
          "FieldToMatch": {"UriPath": {}},
          "TextTransformations": [{"Priority": 0, "Type": "LOWERCASE"}],
          "PositionalConstraint": "STARTS_WITH"
        }
      }
    }
  }
}

32. Text transformations

  • LOWERCASE
  • URL_DECODE
  • HTML_ENTITY_DECODE
  • CMD_LINE
  • Compress/Strip
  • Ordered transforms

33. Office-hours drills

  1. Drill 1 Count.
  2. Drill 2 priority.
  3. Drill 3 curl.
  4. Drill 4 Shield.
  5. Drill 5 runbook.
  6. Drill 6 region.
  7. Drill 7 order.
  8. Drill 8 redact.

34. Change calendar

  • Day 0
  • Day 1
  • Day 2–3
  • Day 4
  • Day 5
  • Day 7
  • Day 14
  • Day 30

उजळणी, मुलाखत आणि तुलना cards

हा lesson काही मिनिटांत revise करा. Cards phone वर save करा किंवा PNG download करा. प्रत्येक card वरचा QR हा lesson उघडतो.

उजळणी card: Web ACL building blocks. L7 controls needed. ACL = default + rules + scope. Threats → scope → priority → Count → Block. Sketch before attach.
उजळणी card: Web ACL building blocks · PNG download करा · Card page उघडा
उजळणी card: Actions Allow Block Count CAPTCHA. Wrong action = pain. Count non-terminating. CAPTCHA humans; Block APIs. Challenge browsers.
उजळणी card: Actions Allow Block Count CAPTCHA · PNG download करा · Card page उघडा
तुलना: Count action vs Block action. Count action: Count continues. Block action: Block terminates.
तुलना: Count action vs Block action · PNG download करा · Card page उघडा
तुलना: CAPTCHA vs Challenge. CAPTCHA: Visible puzzle. Challenge: Silent JS.
तुलना: CAPTCHA vs Challenge · PNG download करा · Card page उघडा
मुलाखत card: Web ACL काय?. Interview opener. Default + rules + scope. Mention us-east-1 for CF.
मुलाखत card: Web ACL काय? · PNG download करा · Card page उघडा
मुलाखत card: Priority कशी?. Order. Lower first; Count continues. Give bands.
मुलाखत card: Priority कशी? · PNG download करा · Card page उघडा
मुलाखत card: Managed rules rollout?. FP fear. Count then Block. No ACL delete.
मुलाखत card: Managed rules rollout? · PNG download करा · Card page उघडा
मुलाखत card: CAPTCHA vs Challenge?. Nuance. Puzzle vs silent JS. APIs → Block/rate.
मुलाखत card: CAPTCHA vs Challenge? · PNG download करा · Card page उघडा

अजून cards: Ravi Sir's Cards.

सराव Tasks

या scenario बद्दल

Maple Leaf Books हा टोरांटो मधला पुस्तक विक्री व्यवसाय आहे. Emily Tremblay त्यांचं IT व cloud काम पाहतात. त्यांचे पैसे CAD मध्ये मोजले जातात आणि AWS resources ca-central-1 Region मध्ये चालतात. खालच्या tasks मध्ये तुम्ही या lesson मध्ये शिकलेलं वापरून त्यांची खरी कामं करता. सगळी नावं, account IDs, IP addresses व numbers सरावासाठी काल्पनिक आहेत.

0 / 16

सोपं Count

का: Evaluation.

काय करायचं: Count चालू तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं us-east-1

का: Scope.

काय करायचं: us-east-1 तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं L7

का: HTTP.

काय करायचं: L7 तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं Default

का: Allow.

काय करायचं: default Allow.

कसं करायचं:
  1. Task मधल्या top-level keys पासून सुरू करा.
  2. Child keys 2 spaces ने indent करा (tabs नकोत).
  3. प्रत्येक property मध्ये task मधली value भरा.
  4. Check answer दाबा. Keys चा क्रम महत्त्वाचा नाही.

सोपं List ACLs

का: Inventory.

काय करायचं: List REGIONAL ACLs.

कसं करायचं:
  1. Task वाचा आणि ते कोणत्या AWS service बद्दल आहे ते ठरवा.
  2. aws लिहा, मग service चं नाव, मग operation (action शब्द).
  3. प्रत्येक आवश्यक flag (--name) व त्यापुढे task मधली value लिहा.
  4. Flags कोणत्याही क्रमाने चालतात. Check answer दाबा.

मध्यम Priority

का: Order.

काय करायचं: Lower first तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम CAPTCHA

का: Clients.

काय करायचं: API CAPTCHA bad तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Allow

का: Stop.

काय करायचं: Allow terminate तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Scope

का: ALB.

काय करायचं: REGIONAL.

कसं करायचं:
  1. Task मधल्या top-level keys पासून सुरू करा.
  2. Child keys 2 spaces ने indent करा (tabs नकोत).
  3. प्रत्येक property मध्ये task मधली value भरा.
  4. Check answer दाबा. Keys चा क्रम महत्त्वाचा नाही.

मध्यम IP sets

का: Lists.

काय करायचं: List IP sets.

कसं करायचं:
  1. Task वाचा आणि ते कोणत्या AWS service बद्दल आहे ते ठरवा.
  2. aws लिहा, मग service चं नाव, मग operation (action शब्द).
  3. प्रत्येक आवश्यक flag (--name) व त्यापुढे task मधली value लिहा.
  4. Flags कोणत्याही क्रमाने चालतात. Check answer दाबा.

मध्यम Rule groups

का: Reusable.

काय करायचं: List rule groups.

कसं करायचं:
  1. Task वाचा आणि ते कोणत्या AWS service बद्दल आहे ते ठरवा.
  2. aws लिहा, मग service चं नाव, मग operation (action शब्द).
  3. प्रत्येक आवश्यक flag (--name) व त्यापुढे task मधली value लिहा.
  4. Flags कोणत्याही क्रमाने चालतात. Check answer दाबा.

अवघड Managed

का: FP.

काय करायचं: Count first तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

अवघड Challenge

का: Bots.

काय करायचं: Challenge silent तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

अवघड Block

का: Terminate.

काय करायचं: Block.

कसं करायचं:
  1. Task मधल्या top-level keys पासून सुरू करा.
  2. Child keys 2 spaces ने indent करा (tabs नकोत).
  3. प्रत्येक property मध्ये task मधली value भरा.
  4. Check answer दाबा. Keys चा क्रम महत्त्वाचा नाही.

अवघड Label

का: Tags.

काय करायचं: label.

कसं करायचं:
  1. Task मधल्या top-level keys पासून सुरू करा.
  2. Child keys 2 spaces ने indent करा (tabs नकोत).
  3. प्रत्येक property मध्ये task मधली value भरा.
  4. Check answer दाबा. Keys चा क्रम महत्त्वाचा नाही.

अवघड CF ACLs

का: us-east-1.

काय करायचं: List CLOUDFRONT ACLs.

कसं करायचं:
  1. Task वाचा आणि ते कोणत्या AWS service बद्दल आहे ते ठरवा.
  2. aws लिहा, मग service चं नाव, मग operation (action शब्द).
  3. प्रत्येक आवश्यक flag (--name) व त्यापुढे task मधली value लिहा.
  4. Flags कोणत्याही क्रमाने चालतात. Check answer दाबा.