From fa231186968a4143e0be7b47a2f65290625d9a4c Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Fri, 4 Dec 2026 22:42:21 -0600 Subject: [PATCH] Use canonical OpsProof public origin --- .../public/homelab-catalog/index.html | 2 +- apps/opsproof/README.md | 8 ++++--- .../overlay/handlers/welcome/welcome.go | 4 ++++ .../overlay/tests/feature/demo_test.go | 1 + bootstrap/edge/templates/default.conf.tftpl | 21 ++++++++++++++++--- docs/opsproof-architecture.md | 8 ++++--- docs/service-catalog.md | 2 +- homelab.yml | 2 +- scripts/render-service-catalog | 2 +- .../jeannie/test_privacy_services_pipeline.py | 12 +++++++---- 10 files changed, 45 insertions(+), 17 deletions(-) diff --git a/apps/demos-static/public/homelab-catalog/index.html b/apps/demos-static/public/homelab-catalog/index.html index 2b57308..3dbcfd4 100644 --- a/apps/demos-static/public/homelab-catalog/index.html +++ b/apps/demos-static/public/homelab-catalog/index.html @@ -124,7 +124,7 @@ OpsProof public demo debian (control-plane, 192.168.100.73) systemd / jeannie deploy-opsproof - http://192.168.100.73:8891/ + not exposed https://opsproof.lab2025.duckdns.org/ apps/opsproof/README.md diff --git a/apps/opsproof/README.md b/apps/opsproof/README.md index 32706a6..9a2beb6 100644 --- a/apps/opsproof/README.md +++ b/apps/opsproof/README.md @@ -96,9 +96,11 @@ as a successful repair. `/demo` is an unauthenticated portfolio surface backed only by a compiled, sanitized fixture. It does not construct a Jeannie client and has no approval -or execution controls. The OCI edge exposes only `/demo` and immutable build -assets at `https://opsproof.lab2025.duckdns.org/`; all operator routes remain -unpublished there. +or execution controls. The canonical application URL is +`https://opsproof.lab2025.duckdns.org/`; unauthenticated root requests redirect +to the fixture. The OCI edge publishes only the fixture, build assets, and the +explicit Dex/operator route families. Incident data and mutations still require +both a valid Dex session and current operator allowlist membership. ## Security boundary diff --git a/apps/opsproof/overlay/handlers/welcome/welcome.go b/apps/opsproof/overlay/handlers/welcome/welcome.go index 0ebeb0e..0559fc4 100644 --- a/apps/opsproof/overlay/handlers/welcome/welcome.go +++ b/apps/opsproof/overlay/handlers/welcome/welcome.go @@ -7,6 +7,7 @@ import ( "go.laravel.com/inertia" "go.laravel.com/web" + "app/models" "app/services" ) @@ -21,6 +22,9 @@ type overview struct { } func Show(request *web.Request) *web.Response { + if models.CurrentUser(request) == nil { + return web.Redirect("/demo") + } status := overview{ Message: "Jeannie status is temporarily unavailable.", Rows: []services.StatusRow{}, diff --git a/apps/opsproof/overlay/tests/feature/demo_test.go b/apps/opsproof/overlay/tests/feature/demo_test.go index e833445..8784f12 100644 --- a/apps/opsproof/overlay/tests/feature/demo_test.go +++ b/apps/opsproof/overlay/tests/feature/demo_test.go @@ -13,5 +13,6 @@ func TestPublicDemoUsesSanitizedFixtureWithoutAuthentication(t *testing.T) { "OPSPROOF_JEANNIE_URL": "http://127.0.0.1:1", "OPSPROOF_JEANNIE_TOKEN": "must-not-be-used", })) + client.WithoutRedirects().Get("/").AssertRedirect("/demo") client.Get("/demo").AssertOK().AssertInertia("Demo").AssertProp("demo.outcome", "validated") } diff --git a/bootstrap/edge/templates/default.conf.tftpl b/bootstrap/edge/templates/default.conf.tftpl index 97a25a9..ffb4f06 100644 --- a/bootstrap/edge/templates/default.conf.tftpl +++ b/bootstrap/edge/templates/default.conf.tftpl @@ -147,13 +147,18 @@ server { add_header Permissions-Policy "geolocation=(), microphone=(), camera=()"; location = / { - return 302 /demo; + proxy_pass http://${opsproof_backend_host}:${opsproof_backend_port}; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; } location = /demo { proxy_pass http://${opsproof_backend_host}:${opsproof_backend_port}; proxy_http_version 1.1; - proxy_set_header Host ${opsproof_backend_host}:${opsproof_backend_port}; + proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; @@ -163,11 +168,21 @@ server { location ^~ /build/ { proxy_pass http://${opsproof_backend_host}:${opsproof_backend_port}; proxy_http_version 1.1; - proxy_set_header Host ${opsproof_backend_host}:${opsproof_backend_port}; + proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; expires 1h; } + location ~ ^/(?:login|logout|auth/dex/callback|incidents(?:/|$)|proposals(?:/|$)|executions(?:/|$)|reports(?:/|$)) { + proxy_pass http://${opsproof_backend_host}:${opsproof_backend_port}; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + add_header Cache-Control "no-store"; + } + location / { return 404; } diff --git a/docs/opsproof-architecture.md b/docs/opsproof-architecture.md index e6c1cec..5df027e 100644 --- a/docs/opsproof-architecture.md +++ b/docs/opsproof-architecture.md @@ -83,9 +83,11 @@ confirmed by deterministic validation. - Run the focused Doctor target once after a terminal execution and write a durable before/after report. Preserve a failed validation as an explicit outcome rather than inferring success from the execution status alone. -- Keep the public portfolio route fixture-only. The OCI edge may proxy `/demo` - and `/build/`, but must return 404 for login, incident, proposal, execution, - report, and every other application route. +- Keep the unauthenticated portfolio route fixture-only. The OCI edge proxies + `/demo`, `/build/`, and explicit login/operator route families. Root redirects + anonymous users to the fixture; live evidence and mutations remain behind + Dex authentication and the server-side operator allowlist. Unknown routes + return 404. ## Why not Laravel Rust now? diff --git a/docs/service-catalog.md b/docs/service-catalog.md index b2fba0c..e3e3355 100644 --- a/docs/service-catalog.md +++ b/docs/service-catalog.md @@ -25,7 +25,7 @@ Update `homelab.yml`, then run `scripts/render-service-catalog`. | SearXNG | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-searxng | [local](http://192.168.100.73:8888/) | [public](https://search.lab2025.duckdns.org/) | `infra/searxng/README.md` | | PrivateBin | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-privatebin | [local](http://192.168.100.73:8889/) | [public](https://paste.lab2025.duckdns.org/) | `infra/privatebin/README.md` | | Miniflux | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-miniflux | [local](http://192.168.100.73:8890/) | [public](https://feeds.lab2025.duckdns.org/) | `infra/miniflux/README.md` | -| OpsProof public demo | debian (control-plane, 192.168.100.73) | systemd / jeannie deploy-opsproof | [local](http://192.168.100.73:8891/) | [public](https://opsproof.lab2025.duckdns.org/) | `apps/opsproof/README.md` | +| OpsProof public demo | debian (control-plane, 192.168.100.73) | systemd / jeannie deploy-opsproof | | [public](https://opsproof.lab2025.duckdns.org/) | `apps/opsproof/README.md` | | GitOps mirror | debian (control-plane, 192.168.100.73) | Bare Git repository | `/home/jv/git-server/my-homelab-configs.git` | [public](ssh://jv@192.168.100.73/home/jv/git-server/my-homelab-configs.git) | `README.md#gitops-and-gitea-actions` | | Container Registry | debian (control-plane, 192.168.100.73) | Argo CD / apps/container-registry | [local](http://192.168.100.73:30500/v2/_catalog) | | `apps/container-registry/` | | Traefik | Kubernetes | OpenTofu / bootstrap/platform | [local](http://192.168.100.240/) | [public](https://lab2025.duckdns.org) | `README.md#loadbalancer-services` | diff --git a/homelab.yml b/homelab.yml index 5ede649..3b69492 100644 --- a/homelab.yml +++ b/homelab.yml @@ -214,7 +214,7 @@ services: install_dir: /data/homelab-opsproof http_port: 8891 bind_ip: 0.0.0.0 - public_url: http://192.168.100.73:8891/ + public_url: https://opsproof.lab2025.duckdns.org/ demo_public_url: https://opsproof.lab2025.duckdns.org/ gitops_mirror: host: debian diff --git a/scripts/render-service-catalog b/scripts/render-service-catalog index 8eac4ba..e7725e0 100755 --- a/scripts/render-service-catalog +++ b/scripts/render-service-catalog @@ -156,7 +156,7 @@ def service_rows(values: dict[str, object]) -> list[dict[str, str]]: "name": "OpsProof public demo", "host": value(values, "services.opsproof.host", "debian"), "managed_by": "systemd / jeannie deploy-opsproof", - "local": value(values, "services.opsproof.public_url", f"http://{debian_ip}:8891/"), + "local": "", "public": value(values, "services.opsproof.demo_public_url", f"https://opsproof.{domain}/"), "docs": "apps/opsproof/README.md", }, diff --git a/tests/jeannie/test_privacy_services_pipeline.py b/tests/jeannie/test_privacy_services_pipeline.py index 8e21a1d..343c9f1 100644 --- a/tests/jeannie/test_privacy_services_pipeline.py +++ b/tests/jeannie/test_privacy_services_pipeline.py @@ -204,10 +204,14 @@ class OpsProofPipelineTests(unittest.TestCase): self.assertIn("server_name ${opsproof_server_name}", edge) self.assertIn("location = /demo", edge) self.assertIn("location ^~ /build/", edge) - self.assertGreaterEqual( - edge.count("proxy_set_header Host ${opsproof_backend_host}:${opsproof_backend_port};"), - 2, - ) + self.assertIn("auth/dex/callback", edge) + self.assertIn("incidents(?:/|$)", edge) + + welcome = ( + ROOT / "apps/opsproof/overlay/handlers/welcome/welcome.go" + ).read_text(encoding="utf-8") + self.assertIn("models.CurrentUser(request) == nil", welcome) + self.assertIn('web.Redirect("/demo")', welcome) if __name__ == "__main__":