A web application for generating and deploying geographic IP blocking rules to Cradlepoint routers via the NetCloud Manager API. Select countries or entire regions to block, and the tool converts their IP address ranges into zone firewall (ZFW) filter policy rules that can be pushed directly to NCM groups.
-
Select Regions — Choose individual countries or entire geographic regions to block. IP address ranges are sourced from ipdeny.com aggregated zone files.
-
Review Rules — The tool generates a ZFW filter policy named
GeoBlock-Policycontaining deny rules for each selected country. Each country's IP blocks are stored as an IP identity, and the corresponding deny rule references that identity. The policy's default action isallow, so only traffic from the selected countries is blocked. The generated configuration can be copied to clipboard or downloaded as JSON. -
Push to Groups — Select one or more NCM groups and apply the configuration via PATCH. This merges the geo-blocking rules into the existing group configuration without removing any existing ZFW rules.
This tool creates the ZFW filter policy and associated IP identities, but does not automatically assign the policy to any zone forwarding rules. After pushing the configuration to a group, you must manually assign the GeoBlock-Policy to the appropriate forwarding rule(s) in the device or group configuration to activate enforcement.
To apply the policy:
- Navigate to the group or device configuration in NetCloud Manager
- Open Security > Zone Firewall > Forwarding Rules
- Edit the relevant forwarding rule (e.g., LAN-to-WAN or WAN-to-LAN)
- Assign
GeoBlock-Policyas the filter policy for that forwarding rule - Save the configuration
Without this step, the filter policy exists in the configuration but does not actively filter traffic.
.venv/bin/python web_apps/geo_ip_blocker/serve.pyOpen http://localhost:8065 in your browser.
- Python 3.12+ with the project virtual environment (
.venv) - FastAPI, uvicorn, httpx (included in project
requirements.txt) - NCM SDK (
ncmpackage in this repository) - Valid NCM API credentials (v2)
API credentials can be provided in two ways:
- Environment variables — Set
X_CP_API_ID,X_CP_API_KEY,X_ECM_API_ID, andX_ECM_API_KEYbefore starting the server. These load automatically on startup. - Settings panel — Click the gear icon in the application header to enter credentials directly. Credentials can be saved as named profiles for reuse.
The tool produces a configuration diff suitable for PATCH operations:
{
"configuration": [
{
"security": {
"zfw": {
"filter_policies": {
"<uuid>": {
"_id_": "<uuid>",
"name": "GeoBlock-Policy",
"default_action": "allow",
"rules": {
"0": {
"action": "deny",
"ip_version": "ip4",
"name": "Block <Country> (<CODE>)",
"src": { "ip": { "0": { "identity": "<identity-uuid>" } } }
}
}
}
}
}
},
"identities": {
"ip": {
"<identity-uuid>": {
"_id_": "<identity-uuid>",
"name": "GeoBlock-<CODE>-<Country>",
"members": [
{ "address": "x.x.x.x/xx" }
]
}
}
}
},
[]
]
}Country-level IP address ranges are fetched in real time from ipdeny.com aggregated zone files. These are CIDR-notation blocks allocated to each country by regional internet registries.