A WAF (web application firewall) inspects each request to a load balancer’s
http and https listeners before it reaches a target. It runs EZGH-managed rule sets, such as the
OWASP Core Rule Set, and simple rules of your own: IP ranges, countries, autonomous systems, regular
expressions and rate limits. A WAF can block what it matches, or only log it.
The same WAF can also protect a CDN distribution: see Protect a distribution with a WAF.
Concepts
Modes, evaluation order and attaching to a load balancer.
Managed rule sets
The Core Rule Set and EZGH's CVE rule sets, paranoia levels and rule overrides.
Custom rules
Conditions on IP, ASN, country, path, query, headers, cookies and body.
Rate limits
Limit each client IP's matching requests over a window.
Logging
Request logs in Observability: what's in a record and where it lands.
Pricing
Per load balancer or distribution with a WAF attached.
The WAF API is at https://waf-api.ezghcloud.com. In the console, open WAF.
Create a WAF and attach it
-
Write the WAF. This one runs the Core Rule Set and the PHP rule set, in log-only mode while you check what it would block:
waf.jsonjson { "name": "storefront", "mode": "log", "managedRuleSets": [ { "name": "ezgh/core" }, { "name": "ezgh/php" } ], "logging": { "scope": "matched", "environment": "production" } } -
Create it:
ezgh waf create --from-file waf.json -
Attach it to a load balancer:
ezgh lb load-balancers update lbr_4k2m9x0a7qpe --waf waf_8m2k4q6t9x1c -
Find what it matched in Observability. When it only matches attacks, set
modetoblock.
In the API, CreateWaf creates a WAF, and wafId on
UpdateLoadBalancer attaches it.
Limits
| Limit | Value |
|---|---|
| WAFs per project | 10 by default, up to 50 |
| Custom rules per WAF | 100 |
| Conditions per rule | 1 to 5 |
| Addresses and CIDR blocks per IP set condition | 1,000 |
| ASNs per condition | 100 |
| Countries per condition | 250 |
| Value or regular expression | 1,024 bytes |
| Rule overrides per managed rule set | 100 |
| Request body inspected | The first 16 KB of a request body |
A create over a quota is refused with 409 quota_exceeded. Request an
increase on the console’s Service quotas page.
IAM
| Policy | Allows |
|---|---|
WafFullAccess |
Create, change, attach and delete WAFs. |
WafReadOnlyAccess |
View WAFs and the managed rule sets. ReadOnlyAccess includes the same. |
| Action | Allows |
|---|---|
waf.wafs.list |
List a project’s WAFs |
waf.wafs.get |
View a WAF and its rules |
waf.wafs.create |
Create WAFs |
waf.wafs.update |
Change a WAF and its rules |
waf.wafs.delete |
Delete a WAF |
waf.wafs.attach |
Attach a WAF to a load balancer, and detach it |
waf.managedRuleSets.list |
List the managed rule sets |
waf.managedRuleSets.get |
View a managed rule set |
Attaching also needs lb.loadBalancers.update on the load balancer. Creating or changing a
WAF with logging on needs obs.logs.ingest on its project.
Trails
Trails records every change, with the caller and the WAF:
| Kind | Events |
|---|---|
| Changes | CreateWaf, UpdateWaf, DeleteWaf |
| Attachments | AttachWaf, DetachWaf, when a load balancer’s wafId attaches or detaches the WAF, beside the load balancer’s UpdateLoadBalancer |
- A change that’s refused is recorded too, with
errorCode. - Reads, such as
GetWaf,ListWafs,GetManagedRuleSetandListManagedRuleSets, aren’t recorded, allowed or refused. - Rule values (regular expressions, addresses) and individual requests are never recorded.