/olko-web-ops:cloudflare-block-countriesfrom olko-web-ops
Block specific countries via Cloudflare WAF Custom Rules using the Cloudflare API. Use when user wants to geo-block traffic, block countries in Cloudflare, set up WAF country rules, or mentions blocking regions. Handles both creating new rulesets and updating existing ones.
Ships in olko-web-ops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Block traffic from specific countries using Cloudflare WAF Custom Rules and the Cloudflare API.
Zone:Rulesets:Edit permissioncurl and jq installedcurl -s -X GET \
"https://api.cloudflare.com/client/v4/zones?account.id=YOUR_ACCOUNT_ID&status=active" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" | jq '.result[] | {name: .name, id: .id}'
curl -s -X GET \
"https://api.cloudflare.com/client/v4/zones/YOUR_ZONE_ID/rulesets" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" | \
jq '.result[] | select(.phase == "http_request_firewall_custom")'
If the output is empty: no existing ruleset. Go to 3a. If a ruleset exists, note its id and go to 3b.
curl -s -X POST \
"https://api.cloudflare.com/client/v4/zones/YOUR_ZONE_ID/rulesets" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"name": "default",
"description": "WAF Custom Rules",
"kind": "zone",
"phase": "http_request_firewall_custom",
"rules": [
{
"action": "block",
"description": "Block traffic from sanctioned countries",
"enabled": true,
"expression": "(ip.src.country in {\"RU\" \"BY\" \"IR\" \"KP\"})"
}
]
}' | jq '.success'
curl -s -X PUT \
"https://api.cloudflare.com/client/v4/zones/YOUR_ZONE_ID/rulesets/RULESET_ID" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"description": "WAF Custom Rules",
"rules": [
{
"action": "block",
"description": "Block traffic from sanctioned countries",
"enabled": true,
"expression": "(ip.src.country in {\"RU\" \"BY\" \"IR\" \"KP\"})"
}
]
}' | jq '.success'
curl -s -X GET \
"https://api.cloudflare.com/client/v4/zones/YOUR_ZONE_ID/rulesets/RULESET_ID" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" | jq '.result.rules'
| Code | Country |
|---|---|
RU | Russia |
BY | Belarus |
IR | Iran |
KP | North Korea |
CN | China |
CU | Cuba |
SY | Syria |
VE | Venezuela |
# Block multiple countries
(ip.src.country in {"RU" "BY" "IR" "KP"})
# Block country + specific ASN
(ip.src.country eq "RU") or (ip.geoip.asnum eq 12345)
# Block all except allowlisted IPs
(ip.src.country in {"RU" "BY"}) and not (ip.src in {1.2.3.4/32})
To apply the same block rule across multiple zones:
#!/usr/bin/env bash
API_TOKEN="YOUR_API_TOKEN"
ZONES=("ZONE_ID_1" "ZONE_ID_2" "ZONE_ID_3")
EXPRESSION='(ip.src.country in {"RU" "BY" "IR" "KP"})'
for ZONE_ID in "${ZONES[@]}"; do
EXISTING=$(curl -s -X GET \
"https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets" \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" | \
jq -r '.result[] | select(.phase == "http_request_firewall_custom") | .id')
if [ -z "$EXISTING" ]; then
METHOD="POST"
URL="https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets"
DATA=$(jq -n --arg expr "$EXPRESSION" '{
name: "default", description: "WAF Custom Rules",
kind: "zone", phase: "http_request_firewall_custom",
rules: [{action: "block", description: "Block sanctioned countries", enabled: true, expression: $expr}]
}')
else
METHOD="PUT"
URL="https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/$EXISTING"
DATA=$(jq -n --arg expr "$EXPRESSION" '{
description: "WAF Custom Rules",
rules: [{action: "block", description: "Block sanctioned countries", enabled: true, expression: $expr}]
}')
fi
RESULT=$(curl -s -X "$METHOD" "$URL" \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
--data "$DATA" | jq '.success')
echo "Zone $ZONE_ID: $RESULT"
done
PUT on an existing ruleset replaces all rules in it. Include all rules in the payload if the ruleset already has other rules.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/docs-index-keeperKeep a repository's Markdown docs index in sync with the files that actually exist, by installing and running docs-index-keeper in a pre-commit hook, in CI, or as a one-off sweep. Use when the user says "the docs index is stale", "update the docs index", "add a docs index check to CI", "our doc links are out of date", or when new docs were added without being linked anywhere.
/evidence-dashboardsDesign, implement, and verify evidence-focused Grafana dashboards with Tufte-inspired charts, honest data semantics, and reproducible provisioning. Use for operational dashboard redesigns, clearer monitoring, or Roazon-style catalog freshness and pipeline visibility./search-console-indexing-auditAnalyze Google Search Console Coverage or indexing CSV exports and correlate them with repo and live-site SEO signals. Use for Chart.csv, Metadata.csv, Critical issues.csv, Non-critical issues.csv, sitemap/robots/canonical indexing problems, "Discovered - currently not indexed", redirect indexing buckets, or requests to fix Google indexing coverage./website-analytics-bootstrapStand up a website's first SEO analytics loop end to end: persistent SerpBear rank tracking, Google Search Console, seeded keywords, read-only technical audits and Telegram alerts on a local host or NAS. Use when the user says "set up rank tracking", "this site has no analytics", "track my keywords", "bootstrap SEO monitoring", or wants to know how a site performs in search when no tracking exists yet. For diagnosing an existing indexing problem use search-console-indexing-audit.
npx claudepluginhub oleg-koval/agent-skills --plugin olko-web-ops