cryptolabs-proxy 1.1.7__tar.gz → 1.4.0__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.
Files changed (63) hide show
  1. {cryptolabs_proxy-1.1.7/src/cryptolabs_proxy.egg-info → cryptolabs_proxy-1.4.0}/PKG-INFO +97 -1
  2. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/README.md +96 -0
  3. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/pyproject.toml +1 -1
  4. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy/__init__.py +1 -1
  5. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy/auth.py +354 -67
  6. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy/cli.py +267 -28
  7. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/config.py +145 -0
  8. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/controller_recovery.py +284 -0
  9. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/custom_config.py +203 -0
  10. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/identity.py +17 -0
  11. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/migration.py +658 -0
  12. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/release_selection.py +176 -0
  13. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy/services.py +12 -0
  14. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy/setup.py +176 -23
  15. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/standard_adoption.py +778 -0
  16. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/templates/acme-challenge.conf.j2 +15 -0
  17. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy/templates/docker-compose.yml.j2 +17 -2
  18. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/templates/exporter-auth-routes.conf.j2 +37 -0
  19. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/templates/fleet-api-routes.conf.j2 +52 -0
  20. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/templates/host-forwarding.conf.j2 +61 -0
  21. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/templates/legacy-bootstrap-nginx.conf +506 -0
  22. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/templates/legacy-bootstrap-provenance.json +1 -0
  23. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy/templates/nginx.conf.j2 +20 -28
  24. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/templates/standard-service-routes.conf.j2 +238 -0
  25. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/templates/vast-price-manager-auth-blocks.conf.j2 +7 -0
  26. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/templates/vast-price-manager.conf.j2 +43 -0
  27. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/updates.py +747 -0
  28. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy/vpm_prerequisite.py +100 -0
  29. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0/src/cryptolabs_proxy.egg-info}/PKG-INFO +97 -1
  30. cryptolabs_proxy-1.4.0/src/cryptolabs_proxy.egg-info/SOURCES.txt +59 -0
  31. cryptolabs_proxy-1.4.0/tests/test_auth.py +531 -0
  32. cryptolabs_proxy-1.4.0/tests/test_controller_guard_transport.py +126 -0
  33. cryptolabs_proxy-1.4.0/tests/test_controller_recovery_guard.py +342 -0
  34. cryptolabs_proxy-1.4.0/tests/test_edge_ownership.py +87 -0
  35. cryptolabs_proxy-1.4.0/tests/test_exporter_auth_protections.py +146 -0
  36. cryptolabs_proxy-1.4.0/tests/test_host_forwarding.py +94 -0
  37. cryptolabs_proxy-1.4.0/tests/test_identity_host_package.py +36 -0
  38. cryptolabs_proxy-1.4.0/tests/test_image_release_promotion.py +511 -0
  39. cryptolabs_proxy-1.4.0/tests/test_netbox_link.py +231 -0
  40. cryptolabs_proxy-1.4.0/tests/test_offline_image.py +96 -0
  41. cryptolabs_proxy-1.4.0/tests/test_proxy_customer_route_repairs.py +374 -0
  42. cryptolabs_proxy-1.4.0/tests/test_proxy_lifecycle_review_repairs.py +347 -0
  43. cryptolabs_proxy-1.4.0/tests/test_proxy_recovery_tls_repairs.py +621 -0
  44. cryptolabs_proxy-1.4.0/tests/test_release_identifier_boundary.py +39 -0
  45. cryptolabs_proxy-1.4.0/tests/test_release_publication.py +309 -0
  46. cryptolabs_proxy-1.4.0/tests/test_release_selection.py +341 -0
  47. cryptolabs_proxy-1.4.0/tests/test_release_workflow_temp_paths.py +227 -0
  48. cryptolabs_proxy-1.4.0/tests/test_routes.py +699 -0
  49. cryptolabs_proxy-1.4.0/tests/test_standard_adoption.py +453 -0
  50. cryptolabs_proxy-1.4.0/tests/test_updates.py +358 -0
  51. cryptolabs_proxy-1.4.0/tests/test_vast_price_manager.py +1200 -0
  52. cryptolabs_proxy-1.4.0/tests/test_version_consistency.py +13 -0
  53. cryptolabs_proxy-1.4.0/tests/test_vpm_prerequisite.py +77 -0
  54. cryptolabs_proxy-1.1.7/src/cryptolabs_proxy/config.py +0 -44
  55. cryptolabs_proxy-1.1.7/src/cryptolabs_proxy.egg-info/SOURCES.txt +0 -19
  56. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/LICENSE +0 -0
  57. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/setup.cfg +0 -0
  58. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy/exporter_manager.py +0 -0
  59. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy/ssl.py +0 -0
  60. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy.egg-info/dependency_links.txt +0 -0
  61. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy.egg-info/entry_points.txt +0 -0
  62. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy.egg-info/requires.txt +0 -0
  63. {cryptolabs_proxy-1.1.7 → cryptolabs_proxy-1.4.0}/src/cryptolabs_proxy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cryptolabs-proxy
3
- Version: 1.1.7
3
+ Version: 1.4.0
4
4
  Summary: Unified reverse proxy and fleet management landing page for CryptoLabs products
5
5
  Author-email: CryptoLabs <support@cryptolabs.co.za>
6
6
  License: MIT
@@ -74,6 +74,15 @@ Unified reverse proxy and fleet management landing page for CryptoLabs products.
74
74
  | Grafana | `/grafana/` | Metrics visualization |
75
75
  | Prometheus | `/prometheus/` | Metrics collection (with auth) |
76
76
 
77
+ ### CryptoLabs' own public sites
78
+
79
+ This product is the fleet proxy for customer datacenters. It does **not** route
80
+ CryptoLabs' own public sites under `cryptolabs.co.za`. Those are served by the
81
+ common proxy owned by `cryptolabs-ai-platform`
82
+ ([services/nginx-configs](https://github.com/cryptolabsza/cryptolabs-ai-platform/tree/dev/services/nginx-configs),
83
+ deployed by its Synchronized Platform Deployment).
84
+ Add or change public-site routing there, not here.
85
+
77
86
  ## Quick Start
78
87
 
79
88
  The easiest way to deploy is through **DC Overview** or **IPMI Monitor** quickstart, which automatically sets up cryptolabs-proxy:
@@ -154,6 +163,68 @@ Config files are stored in `/etc/cryptolabs-proxy/`:
154
163
  └── ssl/ # SSL certificates
155
164
  ```
156
165
 
166
+ The image ships a bootstrap Nginx configuration. Service lifecycle commands
167
+ regenerate the configuration above and require it to be mounted at
168
+ `/etc/nginx/nginx.conf` in the running proxy container. This is how optional
169
+ Vast Price Manager routing is enabled and removed; the CLI refuses to claim a
170
+ route change when the container is still using the bundled configuration.
171
+ The bootstrap configuration intentionally contains no Vast Price Manager route.
172
+ Before an installer enables or disables VPM, it must first create the registry
173
+ configuration, render `/etc/cryptolabs-proxy/nginx.conf`, bind-mount that file
174
+ as `/etc/nginx/nginx.conf`, and verify the proxy is using it. The subsequent
175
+ `cryptolabs-proxy register` or `unregister` command then validates and reloads
176
+ that mounted configuration atomically with the registry update.
177
+
178
+ ### Existing custom proxy configuration
179
+
180
+ Do not use the generic CLI alone to migrate a proxy that already runs a custom
181
+ unmounted `nginx.conf`: it regenerates the full configuration. Use the reviewed
182
+ `scripts/vpm-custom-config-migrate.py` helper first. Its read-only `plan` mode
183
+ derives a migration ID from the source container and config hash. Its explicit
184
+ `apply` stores root-only backups, mounts a byte-preserved custom baseline with
185
+ only the canonical managed blocks added, and can perform a proxy-only
186
+ `rollback`. Custom-config mode then permits only normal VPM
187
+ `register`/`unregister`; it rejects changes to every other service. Its managed
188
+ Fleet auth deny block remains installed in every HTTP server block after VPM is unregistered, so the
189
+ always-running internal VPM session and reauthentication endpoints cannot fall
190
+ through a preserved public <code>/auth/</code> route. Rollback restores the
191
+ original stored baseline exactly.
192
+
193
+ Supported DC monitoring adoption uses the private durable
194
+ [controller adoption guard](docs/controller-adoption-guard.md), including normal
195
+ updater and proxy-adoption exclusion during crash recovery.
196
+
197
+ ### Vast Price Manager Fleet sign-in
198
+
199
+ ### Vast Price Manager prerequisite
200
+
201
+ Before a new Vast Price Manager route can be added, the local Vast.ai exporter
202
+ must be running and report at least one connected account. Complete setup at
203
+ `/vastai/`. Existing VPM installations remain available for maintenance if the
204
+ exporter later loses connectivity; they are never automatically disabled.
205
+
206
+ The proxy checks the exporter from inside its container using its internal
207
+ management token, which must be provisioned by the exporter setup. It records
208
+ only whether setup is ready and the count of connected accounts; API keys,
209
+ account names, balances, and tokens are not returned.
210
+
211
+ When Vast Price Manager runs in Fleet mode, it uses the existing Fleet
212
+ `fleet_session` cookie and does not create a second VPM account or login. VPM
213
+ introspects the current Fleet session on the Docker network at
214
+ `http://cryptolabs-proxy:8081/auth/vast-price-manager/session`; the public
215
+ Nginx configuration explicitly returns `404` for that endpoint and its
216
+ reauthentication companion, including their trailing-slash variants.
217
+
218
+ The internal session response is limited to the current enabled Fleet admin's
219
+ username, role, and two purpose-separated HMAC values derived from the signed
220
+ cookie: a subject and a CSRF token. It never returns the cookie, password,
221
+ password hash, or signing key. The proxy rereads the user record for every
222
+ session, reauthentication, and VPM proxy authorization check, so a disabled,
223
+ deleted, demoted, or password-change-required account loses VPM access
224
+ immediately. Sensitive VPM confirmation calls
225
+ `POST /auth/vast-price-manager/reauth` internally with the Fleet password and
226
+ the returned CSRF token; it uses the normal Fleet password throttle.
227
+
157
228
  User authentication data is stored in `/data/auth/`:
158
229
 
159
230
  ```
@@ -320,3 +391,28 @@ MIT License - See [LICENSE](LICENSE) for details.
320
391
 
321
392
  - [CryptoLabs](https://cryptolabs.co.za)
322
393
  - [Documentation](https://cryptolabs.co.za/dc-monitoring/)
394
+
395
+ ## NetBox environment link
396
+
397
+ NetBox starts in **Available Products** on the Fleet dashboard. An administrator
398
+ can select **Set up NetBox**, enter that site's environment URL, and select
399
+ **Save NetBox**. The card then moves to **Services**, where **Open NetBox** opens
400
+ the saved environment in a new tab. NetBox keeps its own login and permissions.
401
+
402
+ Use **Configure** to edit the destination. **Remove NetBox**, or saving an empty
403
+ URL, returns the card to Available Products. Each installation keeps its own
404
+ link in the existing persistent Fleet authentication data volume. Ordinary
405
+ Fleet users can open the link; only administrators can change it.
406
+
407
+ URLs must be absolute HTTP or HTTPS links without embedded credentials. Use
408
+ HTTPS for NetBox Cloud. The card indicates a configured external service; it
409
+ does not poll NetBox or claim that the environment is healthy.
410
+
411
+ For API configuration, authenticate to Fleet and fetch `/auth/api/netbox`.
412
+ Administrators receive a session-bound `csrf_token` with the public link
413
+ metadata. POST JSON containing `netbox_url` to `/auth/api/settings`, with that
414
+ token in the `X-CSRF-Token` header. An empty string clears the link; omitting
415
+ the field preserves it. Invalid URLs or failed saves preserve existing settings.
416
+
417
+ SSO is a separate integration. A NetBox environment link does not establish
418
+ NetBox authentication or grant inventory permissions.
@@ -46,6 +46,15 @@ Unified reverse proxy and fleet management landing page for CryptoLabs products.
46
46
  | Grafana | `/grafana/` | Metrics visualization |
47
47
  | Prometheus | `/prometheus/` | Metrics collection (with auth) |
48
48
 
49
+ ### CryptoLabs' own public sites
50
+
51
+ This product is the fleet proxy for customer datacenters. It does **not** route
52
+ CryptoLabs' own public sites under `cryptolabs.co.za`. Those are served by the
53
+ common proxy owned by `cryptolabs-ai-platform`
54
+ ([services/nginx-configs](https://github.com/cryptolabsza/cryptolabs-ai-platform/tree/dev/services/nginx-configs),
55
+ deployed by its Synchronized Platform Deployment).
56
+ Add or change public-site routing there, not here.
57
+
49
58
  ## Quick Start
50
59
 
51
60
  The easiest way to deploy is through **DC Overview** or **IPMI Monitor** quickstart, which automatically sets up cryptolabs-proxy:
@@ -126,6 +135,68 @@ Config files are stored in `/etc/cryptolabs-proxy/`:
126
135
  └── ssl/ # SSL certificates
127
136
  ```
128
137
 
138
+ The image ships a bootstrap Nginx configuration. Service lifecycle commands
139
+ regenerate the configuration above and require it to be mounted at
140
+ `/etc/nginx/nginx.conf` in the running proxy container. This is how optional
141
+ Vast Price Manager routing is enabled and removed; the CLI refuses to claim a
142
+ route change when the container is still using the bundled configuration.
143
+ The bootstrap configuration intentionally contains no Vast Price Manager route.
144
+ Before an installer enables or disables VPM, it must first create the registry
145
+ configuration, render `/etc/cryptolabs-proxy/nginx.conf`, bind-mount that file
146
+ as `/etc/nginx/nginx.conf`, and verify the proxy is using it. The subsequent
147
+ `cryptolabs-proxy register` or `unregister` command then validates and reloads
148
+ that mounted configuration atomically with the registry update.
149
+
150
+ ### Existing custom proxy configuration
151
+
152
+ Do not use the generic CLI alone to migrate a proxy that already runs a custom
153
+ unmounted `nginx.conf`: it regenerates the full configuration. Use the reviewed
154
+ `scripts/vpm-custom-config-migrate.py` helper first. Its read-only `plan` mode
155
+ derives a migration ID from the source container and config hash. Its explicit
156
+ `apply` stores root-only backups, mounts a byte-preserved custom baseline with
157
+ only the canonical managed blocks added, and can perform a proxy-only
158
+ `rollback`. Custom-config mode then permits only normal VPM
159
+ `register`/`unregister`; it rejects changes to every other service. Its managed
160
+ Fleet auth deny block remains installed in every HTTP server block after VPM is unregistered, so the
161
+ always-running internal VPM session and reauthentication endpoints cannot fall
162
+ through a preserved public <code>/auth/</code> route. Rollback restores the
163
+ original stored baseline exactly.
164
+
165
+ Supported DC monitoring adoption uses the private durable
166
+ [controller adoption guard](docs/controller-adoption-guard.md), including normal
167
+ updater and proxy-adoption exclusion during crash recovery.
168
+
169
+ ### Vast Price Manager Fleet sign-in
170
+
171
+ ### Vast Price Manager prerequisite
172
+
173
+ Before a new Vast Price Manager route can be added, the local Vast.ai exporter
174
+ must be running and report at least one connected account. Complete setup at
175
+ `/vastai/`. Existing VPM installations remain available for maintenance if the
176
+ exporter later loses connectivity; they are never automatically disabled.
177
+
178
+ The proxy checks the exporter from inside its container using its internal
179
+ management token, which must be provisioned by the exporter setup. It records
180
+ only whether setup is ready and the count of connected accounts; API keys,
181
+ account names, balances, and tokens are not returned.
182
+
183
+ When Vast Price Manager runs in Fleet mode, it uses the existing Fleet
184
+ `fleet_session` cookie and does not create a second VPM account or login. VPM
185
+ introspects the current Fleet session on the Docker network at
186
+ `http://cryptolabs-proxy:8081/auth/vast-price-manager/session`; the public
187
+ Nginx configuration explicitly returns `404` for that endpoint and its
188
+ reauthentication companion, including their trailing-slash variants.
189
+
190
+ The internal session response is limited to the current enabled Fleet admin's
191
+ username, role, and two purpose-separated HMAC values derived from the signed
192
+ cookie: a subject and a CSRF token. It never returns the cookie, password,
193
+ password hash, or signing key. The proxy rereads the user record for every
194
+ session, reauthentication, and VPM proxy authorization check, so a disabled,
195
+ deleted, demoted, or password-change-required account loses VPM access
196
+ immediately. Sensitive VPM confirmation calls
197
+ `POST /auth/vast-price-manager/reauth` internally with the Fleet password and
198
+ the returned CSRF token; it uses the normal Fleet password throttle.
199
+
129
200
  User authentication data is stored in `/data/auth/`:
130
201
 
131
202
  ```
@@ -292,3 +363,28 @@ MIT License - See [LICENSE](LICENSE) for details.
292
363
 
293
364
  - [CryptoLabs](https://cryptolabs.co.za)
294
365
  - [Documentation](https://cryptolabs.co.za/dc-monitoring/)
366
+
367
+ ## NetBox environment link
368
+
369
+ NetBox starts in **Available Products** on the Fleet dashboard. An administrator
370
+ can select **Set up NetBox**, enter that site's environment URL, and select
371
+ **Save NetBox**. The card then moves to **Services**, where **Open NetBox** opens
372
+ the saved environment in a new tab. NetBox keeps its own login and permissions.
373
+
374
+ Use **Configure** to edit the destination. **Remove NetBox**, or saving an empty
375
+ URL, returns the card to Available Products. Each installation keeps its own
376
+ link in the existing persistent Fleet authentication data volume. Ordinary
377
+ Fleet users can open the link; only administrators can change it.
378
+
379
+ URLs must be absolute HTTP or HTTPS links without embedded credentials. Use
380
+ HTTPS for NetBox Cloud. The card indicates a configured external service; it
381
+ does not poll NetBox or claim that the environment is healthy.
382
+
383
+ For API configuration, authenticate to Fleet and fetch `/auth/api/netbox`.
384
+ Administrators receive a session-bound `csrf_token` with the public link
385
+ metadata. POST JSON containing `netbox_url` to `/auth/api/settings`, with that
386
+ token in the `X-CSRF-Token` header. An empty string clears the link; omitting
387
+ the field preserves it. Invalid URLs or failed saves preserve existing settings.
388
+
389
+ SSO is a separate integration. A NetBox environment link does not establish
390
+ NetBox authentication or grant inventory permissions.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cryptolabs-proxy"
7
- version = "1.1.7"
7
+ version = "1.4.0"
8
8
  description = "Unified reverse proxy and fleet management landing page for CryptoLabs products"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -1,6 +1,6 @@
1
1
  """CryptoLabs Proxy - Unified reverse proxy for CryptoLabs products."""
2
2
 
3
- __version__ = "1.1.7"
3
+ __version__ = "1.4.0"
4
4
 
5
5
  # Export programmatic setup API
6
6
  from .setup import (