cryptolabs-proxy 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CryptoLabs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,320 @@
1
+ Metadata-Version: 2.4
2
+ Name: cryptolabs-proxy
3
+ Version: 1.1.1
4
+ Summary: Unified reverse proxy and fleet management landing page for CryptoLabs products
5
+ Author-email: CryptoLabs <support@cryptolabs.co.za>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/cryptolabsza/cryptolabs-proxy
8
+ Project-URL: Documentation, https://cryptolabs.co.za/docs
9
+ Project-URL: Repository, https://github.com/cryptolabsza/cryptolabs-proxy
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: click>=8.0
22
+ Requires-Dist: rich>=13.0
23
+ Requires-Dist: questionary>=2.0
24
+ Requires-Dist: jinja2>=3.0
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: requests>=2.28
27
+ Dynamic: license-file
28
+
29
+ # CryptoLabs Proxy
30
+
31
+ Unified reverse proxy and fleet management landing page for CryptoLabs products. **This is the central entry point** that manages authentication and routing for all CryptoLabs services.
32
+
33
+ ## Architecture
34
+
35
+ ```
36
+ ┌─────────────────────────────────┐
37
+ │ CryptoLabs Proxy │
38
+ │ (Landing Page & Auth) │
39
+ │ │
40
+ User → HTTPS ───►│ ┌─────────────────────────┐ │
41
+ │ │ Unified Authentication │ │
42
+ │ └─────────────────────────┘ │
43
+ │ │ │
44
+ └──────────────┼──────────────────┘
45
+
46
+ ┌────────────────────┼────────────────────┐
47
+ │ │ │
48
+ ▼ ▼ ▼
49
+ ┌──────────┐ ┌──────────┐ ┌──────────┐
50
+ │ /ipmi/ │ │ /dc/ │ │/grafana/ │
51
+ │ IPMI │ │ DC │ │ Grafana │
52
+ │ Monitor │ │ Overview │ │ │
53
+ └──────────┘ └──────────┘ └──────────┘
54
+ ```
55
+
56
+ ## Features
57
+
58
+ - **cryptolabs-watchtower** - Auto-updates cryptolabs-proxy (primary) and other labeled containers (dc-overview, ipmi-monitor, etc.)
59
+ - **Fleet Management Dashboard** - Landing page showing all CryptoLabs services
60
+ - **Unified Authentication** - Single login for all services
61
+ - **Site Name Branding** - Customize landing page with your datacenter name
62
+ - **Auto-Detection** - Automatically detects running services via Docker
63
+ - **Health Checks** - Real-time health status for all containers
64
+ - **Cross-Promotion** - Promotes other CryptoLabs products when not installed
65
+ - **SSL Support** - Let's Encrypt and self-signed certificate support
66
+ - **Subpath Routing** - Route to services via `/ipmi/`, `/dc/`, `/grafana/`, etc.
67
+
68
+ ## Supported Services
69
+
70
+ | Service | Path | Description |
71
+ |---------|------|-------------|
72
+ | IPMI Monitor | `/ipmi/` | Server hardware monitoring |
73
+ | DC Overview | `/dc/` | Datacenter overview dashboard |
74
+ | Grafana | `/grafana/` | Metrics visualization |
75
+ | Prometheus | `/prometheus/` | Metrics collection (with auth) |
76
+
77
+ ## Quick Start
78
+
79
+ The easiest way to deploy is through **DC Overview** or **IPMI Monitor** quickstart, which automatically sets up cryptolabs-proxy:
80
+
81
+ ### Option 1: Deploy with DC Overview (Full Monitoring Stack)
82
+
83
+ ```bash
84
+ # Install from dev branch
85
+ pip install git+https://github.com/cryptolabsza/dc-overview.git@dev --break-system-packages
86
+
87
+ # Run quickstart with config file
88
+ sudo dc-overview quickstart -c /path/to/config.yaml -y
89
+ ```
90
+
91
+ ### Option 2: Deploy with IPMI Monitor (IPMI/BMC Only)
92
+
93
+ ```bash
94
+ # Install from dev branch
95
+ pip install git+https://github.com/cryptolabsza/ipmi-monitor.git@dev --break-system-packages
96
+
97
+ # Run quickstart with config file
98
+ sudo ipmi-monitor quickstart -c /path/to/config.yaml -y
99
+ ```
100
+
101
+ ### Option 3: Standalone Installation
102
+
103
+ ```bash
104
+ pip install cryptolabs-proxy
105
+ sudo cryptolabs-proxy setup
106
+ ```
107
+
108
+ ## Authentication Configuration
109
+
110
+ Authentication credentials are configured via environment variables or through the quickstart config file:
111
+
112
+ | Variable | Description | Default |
113
+ |----------|-------------|---------|
114
+ | `FLEET_ADMIN_USER` | Admin username | `admin` |
115
+ | `FLEET_ADMIN_PASS` | Admin password | **Required** |
116
+ | `SITE_NAME` | Site name for landing page branding | `DC Overview` |
117
+ | `AUTH_SECRET_KEY` | Token signing key | Auto-generated |
118
+ | `AUTH_DATA_DIR` | Auth data directory | `/data/auth` |
119
+
120
+ **Important:** You must set `FLEET_ADMIN_PASS` - there is no default password.
121
+
122
+ When using the quickstart config file, set these in your YAML:
123
+
124
+ ```yaml
125
+ site_name: My Datacenter # Appears in landing page title
126
+ fleet_admin_user: admin
127
+ fleet_admin_pass: YOUR_ADMIN_PASSWORD
128
+ ```
129
+
130
+ ## Manual Docker Deployment
131
+
132
+ ```bash
133
+ docker run -d \
134
+ --name cryptolabs-proxy \
135
+ -p 80:80 -p 443:443 \
136
+ -e FLEET_ADMIN_USER=admin \
137
+ -e FLEET_ADMIN_PASS=YOUR_ADMIN_PASSWORD \
138
+ -v /var/run/docker.sock:/var/run/docker.sock:ro \
139
+ -v cryptolabs_ssl:/etc/nginx/ssl \
140
+ -v cryptolabs_auth:/data/auth \
141
+ ghcr.io/cryptolabsza/cryptolabs-proxy:latest
142
+ ```
143
+
144
+ ## Configuration
145
+
146
+ Config files are stored in `/etc/cryptolabs-proxy/`:
147
+
148
+ ```
149
+ /etc/cryptolabs-proxy/
150
+ ├── nginx.conf # Nginx configuration
151
+ ├── services.yaml # Registered services
152
+ └── ssl/ # SSL certificates
153
+ ```
154
+
155
+ User authentication data is stored in `/data/auth/`:
156
+
157
+ ```
158
+ /data/auth/
159
+ ├── users.json # User database (hashed passwords)
160
+ └── sessions/ # Active sessions
161
+ ```
162
+
163
+ ## API Endpoints
164
+
165
+ | Endpoint | Description |
166
+ |----------|-------------|
167
+ | `GET /` | Fleet management landing page |
168
+ | `GET /api/health` | Health status of all services |
169
+ | `GET /api/services` | List of registered services |
170
+ | `POST /auth/login` | Authentication endpoint |
171
+ | `POST /auth/logout` | Logout endpoint |
172
+
173
+ ## DC Watchdog Integration
174
+
175
+ Fleet Management provides seamless integration with DC Watchdog for uptime monitoring.
176
+
177
+ ### How It Works
178
+
179
+ When a user clicks "Enable DC Watchdog" in the Fleet Management UI:
180
+
181
+ ```
182
+ ┌─────────────────────────────────────────────────────────────────────────────┐
183
+ │ First-Time Setup (No API Key) │
184
+ ├─────────────────────────────────────────────────────────────────────────────┤
185
+ │ │
186
+ │ 1. User clicks "Enable DC Watchdog" │
187
+ │ └── Fleet checks /data/auth/watchdog_api_key → empty │
188
+ │ │
189
+ │ 2. Redirect to WordPress signup: │
190
+ │ https://cryptolabs.co.za/dc-watchdog-signup/ │
191
+ │ ?redirect_uri=https://your-fleet.local/auth/watchdog/callback │
192
+ │ &source=fleet_management │
193
+ │ │
194
+ │ 3. User logs in / creates account on WordPress │
195
+ │ └── Clicks "Start Free Trial" │
196
+ │ └── WordPress generates API key (sk-ipmi-xxx) │
197
+ │ │
198
+ │ 4. WordPress redirects back with API key: │
199
+ │ https://your-fleet.local/auth/watchdog/callback?api_key=sk-ipmi-xxx │
200
+ │ │
201
+ │ 5. Fleet saves API key to /data/auth/watchdog_api_key │
202
+ │ │
203
+ │ 6. Auto-SSO to DC Watchdog dashboard (no manual login needed!) │
204
+ │ │
205
+ └─────────────────────────────────────────────────────────────────────────────┘
206
+
207
+ ┌─────────────────────────────────────────────────────────────────────────────┐
208
+ │ Returning User (API Key Already Saved) │
209
+ ├─────────────────────────────────────────────────────────────────────────────┤
210
+ │ │
211
+ │ 1. User clicks "DC Watchdog" → API key loaded from storage │
212
+ │ 2. Fleet generates signed SSO token (using API key as secret) │
213
+ │ 3. Redirect to watchdog.cryptolabs.co.za/auth/sso │
214
+ │ 4. Instant dashboard access (no WordPress redirect!) │
215
+ │ │
216
+ └─────────────────────────────────────────────────────────────────────────────┘
217
+ ```
218
+
219
+ ### DC Watchdog Endpoints
220
+
221
+ | Endpoint | Description |
222
+ |----------|-------------|
223
+ | `GET /auth/watchdog/sso` | Generate SSO URL and redirect to DC Watchdog |
224
+ | `GET /auth/watchdog/sso-url` | Get SSO URL as JSON (for JavaScript) |
225
+ | `GET /auth/watchdog/callback` | OAuth-style callback from WordPress signup |
226
+ | `GET /auth/watchdog/status` | Check DC Watchdog configuration status |
227
+ | `POST /auth/watchdog/deploy-agents` | Deploy agents to all servers via dc-overview |
228
+
229
+ ### Environment Variables
230
+
231
+ | Variable | Description | Default |
232
+ |----------|-------------|---------|
233
+ | `WATCHDOG_API_KEY` | Pre-configured API key (optional, requires SSO verification) | (none) |
234
+ | `WATCHDOG_URL` | DC Watchdog server URL | `https://watchdog.cryptolabs.co.za` |
235
+
236
+ ### First-Time SSO Requirement
237
+
238
+ Even if `WATCHDOG_API_KEY` is provided via environment variable (e.g., from dc-overview quickstart), users must complete the SSO flow at least once to verify their account. This is enforced by:
239
+
240
+ 1. **Persistent verification flag** (`/data/auth/watchdog_verified`) - Only set after SSO completion
241
+ 2. **Status endpoint checks** - Returns `not_configured` until verification is complete
242
+ 3. **UI enforcement** - Shows "Link Account" button until verified
243
+
244
+ This ensures users explicitly authorize DC Watchdog integration, even when API keys are pre-provisioned.
245
+
246
+ ### Agent Deployment
247
+
248
+ Once DC Watchdog is enabled, you can deploy agents to all your servers:
249
+
250
+ 1. Click "Deploy Agents" in the Fleet Management UI
251
+ 2. Agents are installed via SSH to each configured server
252
+ 3. Agents send heartbeats every 30 seconds to DC Watchdog
253
+ 4. If a server stops responding, you get alerts via email, Telegram, push, or app
254
+
255
+ ## Development Status
256
+
257
+ ### Implemented Features ✓
258
+
259
+ | Feature | Status |
260
+ |---------|--------|
261
+ | Fleet Management landing page | ✓ Complete |
262
+ | Unified authentication | ✓ Complete |
263
+ | DC Watchdog SSO integration | ✓ Complete |
264
+ | First-time SSO verification enforcement | ✓ Complete |
265
+ | "Cloud Service" label for DC Watchdog | ✓ Complete |
266
+ | Duplicate card prevention (System Updates) | ✓ Complete |
267
+ | `key_invalid` state with "Re-link Account" prompt | ✓ Complete |
268
+ | Agent deployment status display | ✓ Complete |
269
+
270
+ ### Pending Features (In Development)
271
+
272
+ | Feature | Status |
273
+ |---------|--------|
274
+ | Token renewal UI feedback | ⏳ Future |
275
+ | Subscription expiry warning banner | ⏳ Future |
276
+
277
+ ## Related Projects
278
+
279
+ | Project | Description |
280
+ |---------|-------------|
281
+ | [DC Overview](https://github.com/cryptolabsza/dc-overview) | Full datacenter monitoring with GPU metrics, Prometheus & Grafana |
282
+ | [IPMI Monitor](https://github.com/cryptolabsza/ipmi-monitor) | IPMI/BMC hardware monitoring, SEL logs, ECC tracking |
283
+ | [DC Exporter](https://github.com/cryptolabsza/dc-exporter-releases) | Standalone GPU metrics exporter for Prometheus |
284
+ | [DC Watchdog](https://github.com/cryptolabsza/dc-watchdog) | External uptime monitoring with multi-channel alerts |
285
+
286
+ ## Changelog
287
+
288
+ ### v1.1.1 (Feb 2026) - DC Watchdog Integration
289
+
290
+ **SSO & Verification:**
291
+ - First-time SSO verification enforcement (even with pre-configured API key)
292
+ - Persistent verification flag (`/data/auth/watchdog_verified`)
293
+ - "Link Account" button until SSO is completed
294
+
295
+ **UI Improvements:**
296
+ - "Cloud Service" label for CryptoLabs-hosted services
297
+ - Fixed duplicate DC Watchdog cards in System Updates
298
+ - `key_invalid` state displays "Re-link Account" when API key expires
299
+ - `agents_installed` state shows installed agents waiting for heartbeats
300
+
301
+ **Backend:**
302
+ - Prioritized file-based API key storage over environment variables
303
+ - Added key validation against WordPress API
304
+ - Propagated `keyError` state to frontend for proper UI handling
305
+
306
+ ### v1.0.0 (Jan 2026) - Initial Release
307
+
308
+ - Fleet Management landing page
309
+ - Unified authentication for all services
310
+ - DC Watchdog SSO flow
311
+ - Agent deployment via dc-overview
312
+
313
+ ## License
314
+
315
+ MIT License - See [LICENSE](LICENSE) for details.
316
+
317
+ ## Links
318
+
319
+ - [CryptoLabs](https://cryptolabs.co.za)
320
+ - [Documentation](https://cryptolabs.co.za/dc-monitoring/)
@@ -0,0 +1,292 @@
1
+ # CryptoLabs Proxy
2
+
3
+ Unified reverse proxy and fleet management landing page for CryptoLabs products. **This is the central entry point** that manages authentication and routing for all CryptoLabs services.
4
+
5
+ ## Architecture
6
+
7
+ ```
8
+ ┌─────────────────────────────────┐
9
+ │ CryptoLabs Proxy │
10
+ │ (Landing Page & Auth) │
11
+ │ │
12
+ User → HTTPS ───►│ ┌─────────────────────────┐ │
13
+ │ │ Unified Authentication │ │
14
+ │ └─────────────────────────┘ │
15
+ │ │ │
16
+ └──────────────┼──────────────────┘
17
+
18
+ ┌────────────────────┼────────────────────┐
19
+ │ │ │
20
+ ▼ ▼ ▼
21
+ ┌──────────┐ ┌──────────┐ ┌──────────┐
22
+ │ /ipmi/ │ │ /dc/ │ │/grafana/ │
23
+ │ IPMI │ │ DC │ │ Grafana │
24
+ │ Monitor │ │ Overview │ │ │
25
+ └──────────┘ └──────────┘ └──────────┘
26
+ ```
27
+
28
+ ## Features
29
+
30
+ - **cryptolabs-watchtower** - Auto-updates cryptolabs-proxy (primary) and other labeled containers (dc-overview, ipmi-monitor, etc.)
31
+ - **Fleet Management Dashboard** - Landing page showing all CryptoLabs services
32
+ - **Unified Authentication** - Single login for all services
33
+ - **Site Name Branding** - Customize landing page with your datacenter name
34
+ - **Auto-Detection** - Automatically detects running services via Docker
35
+ - **Health Checks** - Real-time health status for all containers
36
+ - **Cross-Promotion** - Promotes other CryptoLabs products when not installed
37
+ - **SSL Support** - Let's Encrypt and self-signed certificate support
38
+ - **Subpath Routing** - Route to services via `/ipmi/`, `/dc/`, `/grafana/`, etc.
39
+
40
+ ## Supported Services
41
+
42
+ | Service | Path | Description |
43
+ |---------|------|-------------|
44
+ | IPMI Monitor | `/ipmi/` | Server hardware monitoring |
45
+ | DC Overview | `/dc/` | Datacenter overview dashboard |
46
+ | Grafana | `/grafana/` | Metrics visualization |
47
+ | Prometheus | `/prometheus/` | Metrics collection (with auth) |
48
+
49
+ ## Quick Start
50
+
51
+ The easiest way to deploy is through **DC Overview** or **IPMI Monitor** quickstart, which automatically sets up cryptolabs-proxy:
52
+
53
+ ### Option 1: Deploy with DC Overview (Full Monitoring Stack)
54
+
55
+ ```bash
56
+ # Install from dev branch
57
+ pip install git+https://github.com/cryptolabsza/dc-overview.git@dev --break-system-packages
58
+
59
+ # Run quickstart with config file
60
+ sudo dc-overview quickstart -c /path/to/config.yaml -y
61
+ ```
62
+
63
+ ### Option 2: Deploy with IPMI Monitor (IPMI/BMC Only)
64
+
65
+ ```bash
66
+ # Install from dev branch
67
+ pip install git+https://github.com/cryptolabsza/ipmi-monitor.git@dev --break-system-packages
68
+
69
+ # Run quickstart with config file
70
+ sudo ipmi-monitor quickstart -c /path/to/config.yaml -y
71
+ ```
72
+
73
+ ### Option 3: Standalone Installation
74
+
75
+ ```bash
76
+ pip install cryptolabs-proxy
77
+ sudo cryptolabs-proxy setup
78
+ ```
79
+
80
+ ## Authentication Configuration
81
+
82
+ Authentication credentials are configured via environment variables or through the quickstart config file:
83
+
84
+ | Variable | Description | Default |
85
+ |----------|-------------|---------|
86
+ | `FLEET_ADMIN_USER` | Admin username | `admin` |
87
+ | `FLEET_ADMIN_PASS` | Admin password | **Required** |
88
+ | `SITE_NAME` | Site name for landing page branding | `DC Overview` |
89
+ | `AUTH_SECRET_KEY` | Token signing key | Auto-generated |
90
+ | `AUTH_DATA_DIR` | Auth data directory | `/data/auth` |
91
+
92
+ **Important:** You must set `FLEET_ADMIN_PASS` - there is no default password.
93
+
94
+ When using the quickstart config file, set these in your YAML:
95
+
96
+ ```yaml
97
+ site_name: My Datacenter # Appears in landing page title
98
+ fleet_admin_user: admin
99
+ fleet_admin_pass: YOUR_ADMIN_PASSWORD
100
+ ```
101
+
102
+ ## Manual Docker Deployment
103
+
104
+ ```bash
105
+ docker run -d \
106
+ --name cryptolabs-proxy \
107
+ -p 80:80 -p 443:443 \
108
+ -e FLEET_ADMIN_USER=admin \
109
+ -e FLEET_ADMIN_PASS=YOUR_ADMIN_PASSWORD \
110
+ -v /var/run/docker.sock:/var/run/docker.sock:ro \
111
+ -v cryptolabs_ssl:/etc/nginx/ssl \
112
+ -v cryptolabs_auth:/data/auth \
113
+ ghcr.io/cryptolabsza/cryptolabs-proxy:latest
114
+ ```
115
+
116
+ ## Configuration
117
+
118
+ Config files are stored in `/etc/cryptolabs-proxy/`:
119
+
120
+ ```
121
+ /etc/cryptolabs-proxy/
122
+ ├── nginx.conf # Nginx configuration
123
+ ├── services.yaml # Registered services
124
+ └── ssl/ # SSL certificates
125
+ ```
126
+
127
+ User authentication data is stored in `/data/auth/`:
128
+
129
+ ```
130
+ /data/auth/
131
+ ├── users.json # User database (hashed passwords)
132
+ └── sessions/ # Active sessions
133
+ ```
134
+
135
+ ## API Endpoints
136
+
137
+ | Endpoint | Description |
138
+ |----------|-------------|
139
+ | `GET /` | Fleet management landing page |
140
+ | `GET /api/health` | Health status of all services |
141
+ | `GET /api/services` | List of registered services |
142
+ | `POST /auth/login` | Authentication endpoint |
143
+ | `POST /auth/logout` | Logout endpoint |
144
+
145
+ ## DC Watchdog Integration
146
+
147
+ Fleet Management provides seamless integration with DC Watchdog for uptime monitoring.
148
+
149
+ ### How It Works
150
+
151
+ When a user clicks "Enable DC Watchdog" in the Fleet Management UI:
152
+
153
+ ```
154
+ ┌─────────────────────────────────────────────────────────────────────────────┐
155
+ │ First-Time Setup (No API Key) │
156
+ ├─────────────────────────────────────────────────────────────────────────────┤
157
+ │ │
158
+ │ 1. User clicks "Enable DC Watchdog" │
159
+ │ └── Fleet checks /data/auth/watchdog_api_key → empty │
160
+ │ │
161
+ │ 2. Redirect to WordPress signup: │
162
+ │ https://cryptolabs.co.za/dc-watchdog-signup/ │
163
+ │ ?redirect_uri=https://your-fleet.local/auth/watchdog/callback │
164
+ │ &source=fleet_management │
165
+ │ │
166
+ │ 3. User logs in / creates account on WordPress │
167
+ │ └── Clicks "Start Free Trial" │
168
+ │ └── WordPress generates API key (sk-ipmi-xxx) │
169
+ │ │
170
+ │ 4. WordPress redirects back with API key: │
171
+ │ https://your-fleet.local/auth/watchdog/callback?api_key=sk-ipmi-xxx │
172
+ │ │
173
+ │ 5. Fleet saves API key to /data/auth/watchdog_api_key │
174
+ │ │
175
+ │ 6. Auto-SSO to DC Watchdog dashboard (no manual login needed!) │
176
+ │ │
177
+ └─────────────────────────────────────────────────────────────────────────────┘
178
+
179
+ ┌─────────────────────────────────────────────────────────────────────────────┐
180
+ │ Returning User (API Key Already Saved) │
181
+ ├─────────────────────────────────────────────────────────────────────────────┤
182
+ │ │
183
+ │ 1. User clicks "DC Watchdog" → API key loaded from storage │
184
+ │ 2. Fleet generates signed SSO token (using API key as secret) │
185
+ │ 3. Redirect to watchdog.cryptolabs.co.za/auth/sso │
186
+ │ 4. Instant dashboard access (no WordPress redirect!) │
187
+ │ │
188
+ └─────────────────────────────────────────────────────────────────────────────┘
189
+ ```
190
+
191
+ ### DC Watchdog Endpoints
192
+
193
+ | Endpoint | Description |
194
+ |----------|-------------|
195
+ | `GET /auth/watchdog/sso` | Generate SSO URL and redirect to DC Watchdog |
196
+ | `GET /auth/watchdog/sso-url` | Get SSO URL as JSON (for JavaScript) |
197
+ | `GET /auth/watchdog/callback` | OAuth-style callback from WordPress signup |
198
+ | `GET /auth/watchdog/status` | Check DC Watchdog configuration status |
199
+ | `POST /auth/watchdog/deploy-agents` | Deploy agents to all servers via dc-overview |
200
+
201
+ ### Environment Variables
202
+
203
+ | Variable | Description | Default |
204
+ |----------|-------------|---------|
205
+ | `WATCHDOG_API_KEY` | Pre-configured API key (optional, requires SSO verification) | (none) |
206
+ | `WATCHDOG_URL` | DC Watchdog server URL | `https://watchdog.cryptolabs.co.za` |
207
+
208
+ ### First-Time SSO Requirement
209
+
210
+ Even if `WATCHDOG_API_KEY` is provided via environment variable (e.g., from dc-overview quickstart), users must complete the SSO flow at least once to verify their account. This is enforced by:
211
+
212
+ 1. **Persistent verification flag** (`/data/auth/watchdog_verified`) - Only set after SSO completion
213
+ 2. **Status endpoint checks** - Returns `not_configured` until verification is complete
214
+ 3. **UI enforcement** - Shows "Link Account" button until verified
215
+
216
+ This ensures users explicitly authorize DC Watchdog integration, even when API keys are pre-provisioned.
217
+
218
+ ### Agent Deployment
219
+
220
+ Once DC Watchdog is enabled, you can deploy agents to all your servers:
221
+
222
+ 1. Click "Deploy Agents" in the Fleet Management UI
223
+ 2. Agents are installed via SSH to each configured server
224
+ 3. Agents send heartbeats every 30 seconds to DC Watchdog
225
+ 4. If a server stops responding, you get alerts via email, Telegram, push, or app
226
+
227
+ ## Development Status
228
+
229
+ ### Implemented Features ✓
230
+
231
+ | Feature | Status |
232
+ |---------|--------|
233
+ | Fleet Management landing page | ✓ Complete |
234
+ | Unified authentication | ✓ Complete |
235
+ | DC Watchdog SSO integration | ✓ Complete |
236
+ | First-time SSO verification enforcement | ✓ Complete |
237
+ | "Cloud Service" label for DC Watchdog | ✓ Complete |
238
+ | Duplicate card prevention (System Updates) | ✓ Complete |
239
+ | `key_invalid` state with "Re-link Account" prompt | ✓ Complete |
240
+ | Agent deployment status display | ✓ Complete |
241
+
242
+ ### Pending Features (In Development)
243
+
244
+ | Feature | Status |
245
+ |---------|--------|
246
+ | Token renewal UI feedback | ⏳ Future |
247
+ | Subscription expiry warning banner | ⏳ Future |
248
+
249
+ ## Related Projects
250
+
251
+ | Project | Description |
252
+ |---------|-------------|
253
+ | [DC Overview](https://github.com/cryptolabsza/dc-overview) | Full datacenter monitoring with GPU metrics, Prometheus & Grafana |
254
+ | [IPMI Monitor](https://github.com/cryptolabsza/ipmi-monitor) | IPMI/BMC hardware monitoring, SEL logs, ECC tracking |
255
+ | [DC Exporter](https://github.com/cryptolabsza/dc-exporter-releases) | Standalone GPU metrics exporter for Prometheus |
256
+ | [DC Watchdog](https://github.com/cryptolabsza/dc-watchdog) | External uptime monitoring with multi-channel alerts |
257
+
258
+ ## Changelog
259
+
260
+ ### v1.1.1 (Feb 2026) - DC Watchdog Integration
261
+
262
+ **SSO & Verification:**
263
+ - First-time SSO verification enforcement (even with pre-configured API key)
264
+ - Persistent verification flag (`/data/auth/watchdog_verified`)
265
+ - "Link Account" button until SSO is completed
266
+
267
+ **UI Improvements:**
268
+ - "Cloud Service" label for CryptoLabs-hosted services
269
+ - Fixed duplicate DC Watchdog cards in System Updates
270
+ - `key_invalid` state displays "Re-link Account" when API key expires
271
+ - `agents_installed` state shows installed agents waiting for heartbeats
272
+
273
+ **Backend:**
274
+ - Prioritized file-based API key storage over environment variables
275
+ - Added key validation against WordPress API
276
+ - Propagated `keyError` state to frontend for proper UI handling
277
+
278
+ ### v1.0.0 (Jan 2026) - Initial Release
279
+
280
+ - Fleet Management landing page
281
+ - Unified authentication for all services
282
+ - DC Watchdog SSO flow
283
+ - Agent deployment via dc-overview
284
+
285
+ ## License
286
+
287
+ MIT License - See [LICENSE](LICENSE) for details.
288
+
289
+ ## Links
290
+
291
+ - [CryptoLabs](https://cryptolabs.co.za)
292
+ - [Documentation](https://cryptolabs.co.za/dc-monitoring/)
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cryptolabs-proxy"
7
+ version = "1.1.1"
8
+ description = "Unified reverse proxy and fleet management landing page for CryptoLabs products"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "CryptoLabs", email = "support@cryptolabs.co.za"}
13
+ ]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: System Administrators",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.9",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ ]
24
+ requires-python = ">=3.9"
25
+ dependencies = [
26
+ "click>=8.0",
27
+ "rich>=13.0",
28
+ "questionary>=2.0",
29
+ "jinja2>=3.0",
30
+ "pyyaml>=6.0",
31
+ "requests>=2.28",
32
+ ]
33
+
34
+ [project.scripts]
35
+ cryptolabs-proxy = "cryptolabs_proxy.cli:main"
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/cryptolabsza/cryptolabs-proxy"
39
+ Documentation = "https://cryptolabs.co.za/docs"
40
+ Repository = "https://github.com/cryptolabsza/cryptolabs-proxy"
41
+
42
+ [tool.setuptools.packages.find]
43
+ where = ["src"]
44
+
45
+ [tool.setuptools.package-data]
46
+ cryptolabs_proxy = ["templates/*", "templates/**/*"]