Skip to main content

Cloudflare Executive Report - CLI for multi-zone reporting and cache

Project description

Cloudflare Executive Report

Turn Cloudflare analytics into executive-ready PDF reports with security scores, NIST mappings, and multi-zone portfolio views.

PyPI version Python 3.11+ License

Why this tool exists

Cloudflare dashboard data is excellent for day-to-day operations, but executive reporting often needs:

  • historical windows beyond dashboard convenience
  • one report across many zones
  • reusable PDF outputs for leadership and audit trails
  • concise risk scoring and action narrative

Cloudflare Executive Report fills that gap with local caching and deterministic report generation.

What you get

Feature Outcome
Historical cache Sync once, generate reports later without re-querying everything
Multi-zone portfolio One page for score, grade, and common risks across zones
Executive summary Verdict, KPIs, takeaways, and actions per zone
Security score 0-100 + grade, based on risk takeaways only
NIST mapping Control references for compliance context
Email delivery Optional SMTP send after successful PDF generation
Brand colors Primary/accent customization in PDF

Install

pip install cloudflare-executive-report

Optional SVG rendering:

pip install "cloudflare-executive-report[svg]"

API token permissions (read-only)

Create token in Cloudflare Dashboard: My Profile -> API Tokens.

Required

Permission (Zone) Purpose
Zone Read Zone metadata and zone management helpers
Analytics Read DNS/HTTP/security/cache GraphQL analytics

Required for zone health (default report behavior)

Permission (Zone) Purpose
Zone Settings Read SSL/HTTPS/security/DDOS settings
DNS Read DNSSEC status
Firewall Services Read Active firewall rule counts

If zone-health permissions are missing, those fields become unavailable with warnings. Use --skip-zone-health to disable zone-health fetch.

Quick start

cf-report init
cf-report sync --last 30
cf-report report -o security-report.pdf

This initializes config, syncs 30 days of data, and generates a PDF report. Add --email to the report command to send it via SMTP when email is enabled in config.

Configuration

Default file: ~/.cf-report/config.yaml.

api_token: "cfat_xxx"
cache_dir: "~/.cache/cf-report"
output_dir: "~/.cf-report"
log_level: "info"

zones:
  - id: "abc123..."
    name: "example.com"

pdf:
  profile: "executive"     # minimal | executive | detailed
  chart_format: "png"      # png | svg
  map_format: "png"        # png | svg
  colors:
    primary: "#2563eb"
    accent: "#f38020"

executive:
  disabled_rules:
    - dnssec
    - security_.*
  include_appendix: true
  reference_risk_weight: 60
  verdict_warn_threshold: 3

email:
  enabled: false
  smtp_host: "smtp.example.com"
  smtp_port: 587
  smtp_starttls: true
  smtp_user: "reports@example.com"
  smtp_password: "..."
  recipients:
    - "security@example.com"

Report profiles

Profile Cover Portfolio (2+ zones) Zone summary Stream details Best for
minimal Yes Yes No No quick status
executive Yes Yes Yes No leadership (default)
detailed Yes Yes Yes Yes technical deep dive

PDF examples (demo data)

The repository includes sample PDFs generated from synthetic placeholder zones:

Note: SVG/high-quality rendering can increase PDF size significantly compared to png medium quality.

Security score model

Only risk takeaways in risks section affect score. win, action, comparison, and observation are informational for scoring.

score = max(0, 100 - (total_risk_weight / 60) * 100)

Examples:

Total risk weight Score Grade
0 100 A+
19 68.3 C+
26 56.7 C
60+ 0 F

Example composition: SSL off (10) + WAF disabled (9) = 19, which maps to score 68.3 (C+).

Data quality notes

Some metrics are trend-oriented approximations:

  • top entities are merged from daily top lists
  • mitigation/security analytics can be sampled
  • relative trends are more reliable than single-point absolutes

Use this report as executive posture guidance, not packet-level forensic truth.

Retention behavior

Plan-aware windows currently enforced by this tool:

Plan DNS Security HTTP
Free 7d 7d 30d
Pro 31d 7d 30d
Business 31d 31d 30d
Enterprise 62d 90d 30d

Days outside these windows are cached as unavailable and skipped from API calls.

CLI overview

Sync

cf-report sync --last 30
cf-report sync --start 2026-01-01 --end 2026-03-31
cf-report sync --zone example.com --last 30
cf-report sync --last 7 --refresh

Report

cf-report report -o report.pdf
cf-report report -o report.pdf --email
cf-report report -o report.pdf --cache-only
cf-report report -o report.pdf --skip-zone-health

Zones and cache cleanup

cf-report zones list
cf-report zones add --id abc123 --name example.com
cf-report zones remove --name example.com
cf-report clean --older-than 90
cf-report clean --all

Exit codes

Code Meaning
0 Success
1 General error
2 Invalid parameters
3 Authentication failed
4 Rate limit exceeded
5 Cache lock timeout

Contributing

Developer setup and architecture notes: CONTRIBUTING.md.

Links

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudflare_executive_report-0.8.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudflare_executive_report-0.8.0-py3-none-any.whl (154.5 kB view details)

Uploaded Python 3

File details

Details for the file cloudflare_executive_report-0.8.0.tar.gz.

File metadata

File hashes

Hashes for cloudflare_executive_report-0.8.0.tar.gz
Algorithm Hash digest
SHA256 a7e8cf1137c53e411427f360959d9e517c6b91fa495299285b1123bfa7ab6140
MD5 b6c306451e1fd9d7e42420af6c27b52b
BLAKE2b-256 97ab0339cca3a0c91ed15fc2a8115fdd107329296bb846dc5469139cd6bc28b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudflare_executive_report-0.8.0.tar.gz:

Publisher: publish.yml on vhsantos/cloudflare-executive-report

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cloudflare_executive_report-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudflare_executive_report-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05a5bdb49da8518c186c7eab875945e01fc058c0b2a05e8dde027558a5de5721
MD5 267664ab387c83790891342a9f5a1255
BLAKE2b-256 fa75f82b0ce2c32fda035b12df3e47dbee5e4fcf917bc6598c6b6b03320794f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudflare_executive_report-0.8.0-py3-none-any.whl:

Publisher: publish.yml on vhsantos/cloudflare-executive-report

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page