Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

114 Commits

REST + WebSocket API for Cloudflare domain security management. Enables external dashboards, CI/CD pipelines, and PanLL remote integration to audit, harden, and manage Cloudflare domains over HTTP.

Overview

CloudGuard Server wraps all CloudGuard operations as HTTP endpoints, providing a programmatic interface for tools that can’t use the CLI directly. It includes WebSocket support for real-time progress updates during bulk operations.

Companion projects:

  • cloudguard-cli — Command-line interface for terminal/CI use

  • PanLL CloudGuard module — GUI panel with three-panel compliance view

Installation

From source

git clone https://github.com/hyperpolymath/cloudguard-server
cd cloudguard-server
cargo build --release
# Binary at target/release/cloudguard-server

Environment

export CLOUDFLARE_API_TOKEN="your-token-here"# Optional: custom port (default 3847)export PORT=3847

Run

./target/release/cloudguard-server
# CloudGuard Server listening on http://0.0.0.0:3847

API Routes

MethodPathDescription
GET/healthHealth check
GET/api/zonesList all zones in the Cloudflare account
GET/api/zones/:id/settingsGet all settings for a zone
GET/api/zones/:id/dnsList DNS records for a zone
POST/api/zones/:id/dnsCreate a DNS record
DELETE/api/zones/:id/dns/:record_idDelete a DNS record
POST/api/zones/:id/hardenApply hardening settings to a zone
POST/api/zones/:id/auditRun compliance audit on a zone
POST/api/bulk/hardenBulk harden multiple zones
GET (WebSocket)/ws/bulkReal-time progress for bulk operations

Examples

List zones

curl http://localhost:3847/api/zones

Audit a zone

curl -X POST http://localhost:3847/api/zones/ZONE_ID/audit

Bulk harden via REST

curl -X POST http://localhost:3847/api/bulk/harden \
-H "Content-Type: application/json" \
-d '{"zone_ids": ["id1", "id2", "id3"]}'

Bulk harden via WebSocket (real-time progress)

constws=newWebSocket("ws://localhost:3847/ws/bulk");ws.onmessage=(e)=>console.log(JSON.parse(e.data));ws.onopen=()=>ws.send(JSON.stringify({action: "harden",zone_ids: ["id1","id2","id3"]}));// Receives: { type: "progress", completed: 0, total: 3, current_zone: "id1" }// Receives: { type: "zone_complete", zone_id: "id1", status: "hardened", settings_updated: 17 }// ... per zone ...// Receives: { type: "complete", total: 3 }

Response Format

All endpoints return JSON with a consistent envelope:

{
"success": true,
"result": { ... }
}

On error:

{
"success": false,
"error": "description of what went wrong"
}

License

MPL-2.0

Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath)

About

CloudGuard Server — REST + WebSocket API for Cloudflare domain security management

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages