Skip to content

Add GeoIP rules docs and DB-IP attribution to WAF page#2564

Open
electricjesus wants to merge 3 commits intotigera:mainfrom
electricjesus:waf-geoip-docs
Open

Add GeoIP rules docs and DB-IP attribution to WAF page#2564
electricjesus wants to merge 3 commits intotigera:mainfrom
electricjesus:waf-geoip-docs

Conversation

@electricjesus
Copy link
Member

Summary

  • Adds a new GeoIP-based rules subsection under WAF customization options, documenting how to use @geoLookup and GEO:COUNTRY_CODE in custom rules
  • Includes two practical examples: blocking traffic by country, and denying IPs not found in the GeoIP database
  • Adds the required Creative Commons Attribution 4.0 notice for the embedded DB-IP Lite database

Context

WAF ships with an embedded DB-IP Lite city-level geolocation database (bundled in the dikastes image), but this capability was previously undocumented. The DB-IP Lite license (CC BY 4.0) also requires attribution with a link back to db-ip.com, which was missing.

Test plan

  • Verify the page renders correctly on the docs site
  • Confirm the new section appears under "Customization options" in the WAF page
  • Verify links to DB-IP and CC BY 4.0 license resolve correctly

Document the GeoIP-based rule capability that WAF supports via the
embedded DB-IP Lite database, with practical examples for blocking
traffic by country and handling unknown IPs. Also adds the required
CC BY 4.0 attribution for the DB-IP database.
Copilot AI review requested due to automatic review settings March 4, 2026 18:14
@electricjesus electricjesus requested a review from a team as a code owner March 4, 2026 18:14
@netlify
Copy link

netlify bot commented Mar 4, 2026

Deploy Preview for calico-docs-preview-next ready!

Name Link
🔨 Latest commit cde6a51
🔍 Latest deploy log https://app.netlify.com/projects/calico-docs-preview-next/deploys/69aac37659a00500082d2e3d
😎 Deploy Preview https://deploy-preview-2564--calico-docs-preview-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Mar 4, 2026

Deploy Preview succeeded!

Built without sensitive environment variables

Name Link
🔨 Latest commit cde6a51
🔍 Latest deploy log https://app.netlify.com/projects/tigera/deploys/69aac376d9fdf1000806897f
😎 Deploy Preview https://deploy-preview-2564--tigera.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 71 (🟢 up 3 from production)
Accessibility: 98 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing documentation for WAF’s embedded GeoIP capability (via @geoLookup/GEO:*) and includes required attribution for the bundled DB-IP Lite database in the Calico Enterprise WAF docs.

Changes:

  • Documented GeoIP-based custom rules for WAF, including @geoLookup and GEO:COUNTRY_CODE.
  • Added two rule examples (country blocking; deny when GeoIP lookup fails).
  • Added DB-IP / CC BY 4.0 attribution notice on the WAF page.

**Example: Deny traffic from IPs not found in the GeoIP database (e.g. private IPs)**

```bash
SecRule REMOTE_ADDR "@geoLookup" "phase:1,id:155,nolog,pass"
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This @geoLookup example repeats id:155 which conflicts with the earlier example (and with the guidance to combine them). Adjust the IDs so they remain unique across the snippet(s), ideally showing one lookup rule followed by multiple checks.

Suggested change
SecRule REMOTE_ADDR "@geoLookup" "phase:1,id:155,nolog,pass"
SecRule REMOTE_ADDR "@geoLookup" "phase:1,id:158,nolog,pass"

Copilot uses AI. Check for mistakes.
SecRule REMOTE_ADDR "@geoLookup" "phase:1,id:155,nolog,pass"

# &GEO equals 0 when the IP was not found in the database
SecRule &GEO "@eq 0" "phase:1,id:156,deny,msg:'Failed to lookup IP'"
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The denial message uses "lookup" as a verb; consider "look up" for correct grammar in the user-facing message.

Suggested change
SecRule &GEO "@eq 0" "phase:1,id:156,deny,msg:'Failed to lookup IP'"
SecRule &GEO "@eq 0" "phase:1,id:156,deny,msg:'Failed to look up IP'"

Copilot uses AI. Check for mistakes.
Comment on lines +331 to +336
```bash
# Look up the geographic location of the client IP
SecRule REMOTE_ADDR "@geoLookup" "phase:1,id:155,nolog,pass"

# Deny the request if the country code matches
SecRule GEO:COUNTRY_CODE "@streq RU" "phase:1,id:157,deny,msg:'Access from this country is not allowed'"
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both examples use the same rule id (id:155) for the @geoLookup rule. The note below suggests combining these examples, but combining them as written would create duplicate rule IDs and can cause the WAF config to fail to load or behave unpredictably. Use a single @geoLookup rule and ensure all rule IDs are unique (and update the text about combining accordingly).

Copilot uses AI. Check for mistakes.
Address review feedback: use distinct SecRule IDs in the second example
to avoid conflicts if users combine them, and fix "lookup" to "look up"
in the denial message.
@ctauchen
Copy link
Collaborator

ctauchen commented Mar 5, 2026

We've got an active PR to sort out attributions, so we're okay to leave that part out of this page. As for the geo info, it looks good to me if that's something that people will actually be doing. I understood previously that this was just a background dependency, not something that was meant to be user facing.

Copy link
Member Author

@electricjesus electricjesus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay thanks @ctauchen! I added a "review" here so we can just apply suggestions and get rid of the attribution just on this PR 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants