Skip to content

Commit 8867f91

Browse files
committed
Add sponsor badge
1 parent e480570 commit 8867f91

1 file changed

Lines changed: 172 additions & 0 deletions

File tree

README.md

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
[![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?logo=github)](https://github.com/sponsors/hyperpolymath)
2+
3+
// SPDX-License-Identifier: MPL-2.0
4+
5+
= CloudGuard Server
6+
:toc: macro
7+
:toc-title: Contents
8+
:toclevels: 2
9+
10+
REST + WebSocket API for Cloudflare domain security management.
11+
Enables external dashboards, CI/CD pipelines, and PanLL remote integration
12+
to audit, harden, and manage Cloudflare domains over HTTP.
13+
14+
toc::[]
15+
16+
== Overview
17+
18+
CloudGuard Server wraps all CloudGuard operations as HTTP endpoints,
19+
providing a programmatic interface for tools that can't use the CLI
20+
directly. It includes WebSocket support for real-time progress updates
21+
during bulk operations.
22+
23+
Companion projects:
24+
25+
* **cloudguard-cli** — Command-line interface for terminal/CI use
26+
* **PanLL CloudGuard module** — GUI panel with three-panel compliance view
27+
28+
== Installation
29+
30+
=== From source
31+
32+
[source,bash]
33+
----
34+
git clone https://github.com/hyperpolymath/cloudguard-server
35+
cd cloudguard-server
36+
cargo build --release
37+
# Binary at target/release/cloudguard-server
38+
----
39+
40+
=== Environment
41+
42+
[source,bash]
43+
----
44+
export CLOUDFLARE_API_TOKEN="your-token-here"
45+
46+
# Optional: custom port (default 3847)
47+
export PORT=3847
48+
----
49+
50+
=== Run
51+
52+
[source,bash]
53+
----
54+
./target/release/cloudguard-server
55+
# CloudGuard Server listening on http://0.0.0.0:3847
56+
----
57+
58+
== API Routes
59+
60+
[cols="1,3,3"]
61+
|===
62+
| Method | Path | Description
63+
64+
| GET
65+
| `/health`
66+
| Health check
67+
68+
| GET
69+
| `/api/zones`
70+
| List all zones in the Cloudflare account
71+
72+
| GET
73+
| `/api/zones/:id/settings`
74+
| Get all settings for a zone
75+
76+
| GET
77+
| `/api/zones/:id/dns`
78+
| List DNS records for a zone
79+
80+
| POST
81+
| `/api/zones/:id/dns`
82+
| Create a DNS record
83+
84+
| DELETE
85+
| `/api/zones/:id/dns/:record_id`
86+
| Delete a DNS record
87+
88+
| POST
89+
| `/api/zones/:id/harden`
90+
| Apply hardening settings to a zone
91+
92+
| POST
93+
| `/api/zones/:id/audit`
94+
| Run compliance audit on a zone
95+
96+
| POST
97+
| `/api/bulk/harden`
98+
| Bulk harden multiple zones
99+
100+
| GET (WebSocket)
101+
| `/ws/bulk`
102+
| Real-time progress for bulk operations
103+
|===
104+
105+
== Examples
106+
107+
=== List zones
108+
109+
[source,bash]
110+
----
111+
curl http://localhost:3847/api/zones
112+
----
113+
114+
=== Audit a zone
115+
116+
[source,bash]
117+
----
118+
curl -X POST http://localhost:3847/api/zones/ZONE_ID/audit
119+
----
120+
121+
=== Bulk harden via REST
122+
123+
[source,bash]
124+
----
125+
curl -X POST http://localhost:3847/api/bulk/harden \
126+
-H "Content-Type: application/json" \
127+
-d '{"zone_ids": ["id1", "id2", "id3"]}'
128+
----
129+
130+
=== Bulk harden via WebSocket (real-time progress)
131+
132+
[source,javascript]
133+
----
134+
const ws = new WebSocket("ws://localhost:3847/ws/bulk");
135+
ws.onmessage = (e) => console.log(JSON.parse(e.data));
136+
ws.onopen = () => ws.send(JSON.stringify({
137+
action: "harden",
138+
zone_ids: ["id1", "id2", "id3"]
139+
}));
140+
// Receives: { type: "progress", completed: 0, total: 3, current_zone: "id1" }
141+
// Receives: { type: "zone_complete", zone_id: "id1", status: "hardened", settings_updated: 17 }
142+
// ... per zone ...
143+
// Receives: { type: "complete", total: 3 }
144+
----
145+
146+
== Response Format
147+
148+
All endpoints return JSON with a consistent envelope:
149+
150+
[source,json]
151+
----
152+
{
153+
"success": true,
154+
"result": { ... }
155+
}
156+
----
157+
158+
On error:
159+
160+
[source,json]
161+
----
162+
{
163+
"success": false,
164+
"error": "description of what went wrong"
165+
}
166+
----
167+
168+
== License
169+
170+
MPL-2.0
171+
172+
Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath)

0 commit comments

Comments
 (0)