You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GeoIP2 Enrichment: Country, city, ASN for source IPs
Spoofed IP Detection: Private/reserved ranges marked with warning
Prefix Filter: Only notify for your configured prefixes (ignores Cloudflare anycast)
Deduplication: SHA256-based event fingerprinting
Gap Prevention: 15-minute lookback window with 5-minute polling
DDoS Custom Overrides (v2.9.15+)
Create and manage custom DDoS override rules with Cloudflare's wirefilter expression language:
Feature
Description
Wirefilter Expressions
Create rules using IP ranges, ports, protocols, TCP flags
Actions
block, log, managed_challenge, js_challenge, skip
Position Control
Reorder rules via up/down arrows or direct position input
Syntax Validation
Real-time expression validation before save
Full CRUD
Create, read, update, delete custom rules
Example Expressions:
# Block traffic from specific IP range
ip.src in {192.0.2.0/24 198.51.100.0/24}
# Skip protection for specific destination port
ip.dst.port == 8080
# Block specific TCP flags pattern
tcp.flags.syn && !tcp.flags.ack
# Combine conditions
ip.src in {10.0.0.0/8} && ip.dst.port in {80 443}
Network Flow Analytics (24h)
Real-time traffic visibility from mnmFlowDataAdaptiveGroups GraphQL API:
Stat Card
Color
Description
Avg Bit Rate
Blue
Average bandwidth (Mbps)
Avg Packet Rate
Blue
Average packets per second (kpps)
Top Protocol
Purple
Highest traffic protocol (TCP/UDP/ICMP/GRE/ESP)
Top Source
Amber
IP address generating most traffic
Top Router
Emerald
Router handling most traffic (your edge routers)
Top Destination
Pink
Most targeted IP address
Connectors Management
Monitor and manage Magic Transit connectivity:
Connector Type
Description
GRE Tunnels
Generic Routing Encapsulation tunnels to Cloudflare
flowchart TB
subgraph CF["CLOUDFLARE EDGE"]
DDoS["DDoS Protection"]
MT["Magic Transit"]
WH["Webhook System"]
GQL["GraphQL API"]
DDoS --> MT --> WH
MT --> GQL
end
subgraph INFRA["YOUR INFRASTRUCTURE"]
subgraph SERVICES["Systemd Services"]
WEBHOOK["Webhook Receiver<br>:8080"]
MONITOR["Network Analytics<br>Monitor"]
AUTO["Auto-Withdraw<br>Daemon"]
DASH["Web Dashboard<br>:8081"]
end
DB["SQLite Database"]
TG["Telegram"]
WEBHOOK --> DB
WEBHOOK --> TG
MONITOR --> DB
MONITOR --> TG
AUTO --> DB
AUTO --> TG
AUTO -->|"BGP Control"| CF
DASH --> DB
DASH -->|"BGP Control"| CF
end
WH -->|"HTTPS POST"| WEBHOOK
GQL -->|"GraphQL Query"| MONITOR
GQL -->|"GraphQL Query"| AUTO
GQL -->|"GraphQL Query"| DASH
Loading
Attack Lifecycle (v2.9.9+)
flowchart TD
A["🚨 ATTACK DETECTED<br>Cloudflare detects DDoS"]
B["📡 AUTO-ADVERTISE<br>MNM rules trigger BGP announcement"]
C["WEBHOOK START<br>Receive → DB (mitigating) → Telegram"]
D["🛡️ MITIGATION ACTIVE<br>Traffic scrubbed"]
E["✅ ATTACK ENDS<br>Cloudflare sends END webhook"]
F["AUTO-WITHDRAW MONITORS<br>Checks GraphQL every 60s"]
G{"15 MIN CALM?"}
H["📤 WITHDRAW<br>Auto-withdraw performs BGP withdraw"]
I["TELEGRAM<br>Prefix withdrawn notification"]
A --> B --> C --> D --> E --> F --> G
G -->|"Yes"| H --> I
G -->|"No"| F
style A fill:#ef4444,stroke:#b91c1c,color:#fff
style B fill:#f59e0b,stroke:#d97706,color:#fff
style C fill:#3b82f6,stroke:#1d4ed8,color:#fff
style D fill:#8b5cf6,stroke:#6d28d9,color:#fff
style E fill:#10b981,stroke:#059669,color:#fff
style H fill:#06b6d4,stroke:#0891b2,color:#fff
Loading
Scripts
Core Services
Script
Version
Description
Service
cloudflare-webhook-receiver.py
v1.9.0
Webhook receiver - all events logged to DB
cloudflare-webhook.service
cloudflare-network-analytics-monitor.py
v1.3.10
GraphQL poller with GeoIP2 enrichment
cloudflare-analytics-monitor.service
cloudflare-autowithdraw.py
v3.4
ONLY service that performs BGP withdrawals
cloudflare-autowithdraw.service
dashboard/app.py
v2.9.22
Web dashboard with prefix management
cloudflare-dashboard.service
Management Tools
Script
Version
Description
cloudflare-prefix-manager.py
v1.4.0
CLI tool for BGP prefix management (with DB logging)
cloudflare-rules-manager.py
v1.4
Interactive MNM rules manager
cloudflare-services-watchdog.sh
v1.2
HA watchdog for all services
db_manager.py
v1.3.0
Database operations module
CLI: cloudflare-prefix-manager
# Interactive menu
cloudflare-prefix-manager
# View status
cloudflare-prefix-manager status
cloudflare-prefix-manager status 203.0.113.0/24
# Advertise/Withdraw (logged to DB, visible in dashboard)
cloudflare-prefix-manager advertise 203.0.113.0/24
cloudflare-prefix-manager withdraw 203.0.113.0/24
cloudflare-prefix-manager advertise --all
cloudflare-prefix-manager withdraw --all
# List prefixes
cloudflare-prefix-manager list
CLI: cloudflare-autowithdraw
# Run as daemon (systemd)
python3 cloudflare-autowithdraw.py daemon
# Check status
python3 cloudflare-autowithdraw.py status
# Manual operations
python3 cloudflare-autowithdraw.py withdraw 192.0.2.0/24
python3 cloudflare-autowithdraw.py withdraw # All advertised
python3 cloudflare-autowithdraw.py advertise 192.0.2.0/24
# Test API
python3 cloudflare-autowithdraw.py test
CLI: cloudflare-rules-manager
# Interactive menu
python3 cloudflare-rules-manager.py
# Menu options:# [1] List all rules# [2] List dynamic rules (zscore)# [3] List threshold rules (BPS/PPS)# [4] List advanced DDoS rules (sFlow)# [5] General status# [6] Add BPS rule (bandwidth threshold)# [7] Add PPS rule (packet threshold)# [8] Add dynamic rule (zscore)# [9] Add advanced DDoS rule (sFlow)# [d] Delete single rule# [t] Delete rules by type# [s] DDoS protection status (L3/4 Managed Ruleset)# [l] List customizable DDoS rules# [m] Modify rule sensitivity/action# [o] View current overrides# [e] Export configuration# [q] Quit
DNS Timeout Fix - Dashboard gracefully handles DNS lookup timeouts, Analytics Monitor v1.3.10 - Added Cloudflare anycast prefixes (162.159/16, 172.64/13, 104.16/13) for complete traffic visibility
2.9.21
2026-01-23
Improved Constraint Messages - Clearer "Cloudflare API cooldown" messaging, backend returns updated state
2.9.20
2026-01-23
CNI Pass Rate Fix - Correct calculation using resultStatus=ok instead of tunnelState
2.9.19
2026-01-23
Network Analytics Hostname - Added Hostname column with reverse DNS lookup
2.9.18
2026-01-23
Network Flow Hostnames - Top Source/Router/Destination show resolved hostnames
2.9.17
2026-01-23
Complete DB Logging - All webhook handlers now save to database (v1.9.0), Dashboard limit increased to 100 events, Autowithdraw shows peak attack stats (v3.4)
2.9.16
2026-01-22
Network Analytics Status Indicator - Dynamic status in card header shows monitoring state (⏸️ Paused / ✅ Active) based on BGP prefix status
Backend services, API clients, database operations
64%
HTML/CSS/JavaScript
Web dashboard, responsive UI, real-time updates
35%
Bash
Watchdog scripts, system automation, cron jobs
1%
Python Dependencies
Package
Purpose
flask
Web dashboard framework
requests
HTTP client for Cloudflare API
bcrypt
Password hashing
geoip2
GeoIP2 database reader (optional)
sqlite3
Database operations (built-in)
External Services
Service
Integration
Cloudflare API
REST + GraphQL for Magic Transit
Telegram Bot API
Real-time SOC notifications
GeoIP2 Databases
IP geolocation enrichment
Let's Encrypt
TLS certificates
Database Schema
SQLite database with event correlation and audit trail:
Table
Purpose
Key Fields
attack_events
All attack lifecycle events
event_type, attack_id, prefix, timestamp
withdrawal_history
Completed BGP withdrawals
prefix, protection_duration, method
webhook_events
All received webhooks
alert_type, event_state, payload
network_analytics_events
Dropped traffic events
source_ip, dest_ip, attack_vector, geoip
prefix_calm_status
Real-time calm tracking
prefix, calm_minutes, dropped_bits
Quick Database Queries
# Recent attacks
sqlite3 db/magic_transit.db "SELECT event_type, prefix, created_at FROM attack_events ORDER BY id DESC LIMIT 10;"# Withdrawal history
sqlite3 db/magic_transit.db "SELECT prefix, withdrawn_at, protection_duration_seconds/60 as minutes FROM withdrawal_history ORDER BY id DESC LIMIT 10;"# Today's events
sqlite3 db/magic_transit.db "SELECT * FROM attack_events WHERE date(created_at) = date('now');"
Security
HTTPS Only: All traffic encrypted via TLS (Let's Encrypt)
Authentication: Session-based login with bcrypt password hashing
IP Whitelist: Dashboard restricted to authorized networks
Signature Verification: Optional HMAC validation of webhooks
Localhost Binding: Flask binds to 127.0.0.1 only
Credential Isolation: API tokens in separate config files
No Credentials in Repo: All sensitive data via config files