Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/architecture.md

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ docstring gives: it is a record, not a claim about now.

## 2026-11-17

- **The office wall page is in the sensitive stack**
([ADR-0119](adr/0119-put-the-office-wall-dashboard-on-a-pi-5-on-hicks.md)).
`stacks/sensitive/wall/` holds static HTML, CSS and JS in the Tokyo Night
look of the operator's mockup, trimmed from about 18 cards to six panels
and sized for the office television at seven feet.
- **Behind it:** Caddy serves the page at `wall.matrix.elysium` and answers
eight fixed Prometheus questions with the reader token added
server-side. The page picks a name, never a query, and only GET and HEAD
pass. That was checked against the pinned Caddy and a stand-in upstream:
`?query=up` ignored, POST 405 before upstream, `/api/v1/query` 404.
- **When it does not know, it says so:** with Prometheus unreachable or
Watchdog silent it shows that in red instead of "All quiet", and each
source's age is in the status bar.
- **The household half** (calendar, weather, the house) comes through Home
Assistant in a later change.
- **Not live yet:** the name needs a host override on `morpheus`, and the
blackbox probe is committed commented out until it answers.

- **`heimdall`, the office wall dashboard, is on Hicks at `10.0.50.15`**
([ADR-0119](adr/0119-put-the-office-wall-dashboard-on-a-pi-5-on-hicks.md),
[`build-heimdall.md`](runbooks/build-heimdall.md)). A Raspberry Pi 5 drives
Expand Down
6 changes: 4 additions & 2 deletions docs/runbooks/build-heimdall.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ sudo raspi-config nonint do_blanking 1
sudo reboot
```

The page is Glance's Homelab page until the wall page exists. When it does,
this line's URL is the only change. `--password-store=basic` stops Chromium
The page is the wall page, `https://wall.matrix.elysium/`, once `morpheus`
has its host override (`stacks/sensitive/README.md`, *The wall page*). Until
then the line above shows Glance's Homelab page. Moving between them is this
line's URL and a reboot, nothing else. `--password-store=basic` stops Chromium
asking for a keyring at boot, which would otherwise sit on the screen.
Blanking off keeps the desktop from turning the screen off. §8 turns the
television off instead.
Expand Down
11 changes: 11 additions & 0 deletions docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,17 @@ from Home Assistant with *not enough permissions*.
that difference is accepted. It holds two credentials: the reader token,
which can only query, and a Fever key that can only mark items read for a
Miniflux user that follows public feeds.
- **The wall page answers eight fixed questions**
([ADR-0119](adr/0119-put-the-office-wall-dashboard-on-a-pi-5-on-hicks.md)):
`wall.matrix.elysium` on `trinity`'s Caddy. Each `/api/q/NAME` is one PromQL
query written in the Caddyfile, sent with the reader token, which Caddy
adds. The caller picks a name, never a query, and its own query string is
discarded. Only GET and HEAD are served, because Prometheus would take a
POST body's `query=` over the URL's. Like Glance it has no login, so
anything that reaches `trinity:443` can read those eight answers: the
firing alerts, per-host CPU, SNMP reachability, WAN traffic and latency,
the UPS and `heimdall`'s temperature. That is less than the Homelab page
already shows, and the page and the Pi hold no credential.
- `snmp-exporter` is never published to a host interface — it is reachable only
on the compose network.
- Alertmanager binds to `127.0.0.1` only. It is unauthenticated, and a silence
Expand Down
4 changes: 3 additions & 1 deletion scripts/check_caddyfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ for stack in "${STACKS[@]}"; do
# a Caddyfile that loads its leaf from files rather than over ACME — the
# wiki's (#847) and the ingest proxy's (#764) — since `caddy validate` loads
# them and fails on a missing one. It proves the paths and the syntax, not
# the leaf.
# the leaf. It is offered as /etc/caddy/tls/ingest-ca.pem too, the trust pool
# of the sensitive tier's one off-host upstream (the wall page, ADR-0119).
openssl req -x509 -newkey rsa:2048 -nodes -days 1 \
-subj '/CN=caddyfile-validation' \
-keyout "${work}/key.pem" -out "${work}/ca.pem" >/dev/null 2>&1
Expand Down Expand Up @@ -111,6 +112,7 @@ for stack in "${STACKS[@]}"; do
--env-file "${work}/env" \
-v "${work}/Caddyfile:/etc/caddy/Caddyfile:ro" \
-v "${work}/ca.pem:/etc/caddy/tls/ca.pem:ro" \
-v "${work}/ca.pem:/etc/caddy/tls/ingest-ca.pem:ro" \
-v "${work}/ca.pem:/etc/caddy/tls/cert.pem:ro" \
-v "${work}/key.pem:/etc/caddy/tls/key.pem:ro" \
"${image}")
Expand Down
15 changes: 15 additions & 0 deletions stacks/observability/prometheus/targets/blackbox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,21 @@
renewal: acme
tier: household

# The office wall page (ADR-0119), static files Caddy serves itself, so a
# 200 on `/` proves the site, its certificate and Caddy. COMMENTED OUT until
# morpheus has the `wall` host override (stacks/sensitive/README.md, "The
# wall page", step 5): before that the name does not resolve, and SiteDown
# would fire for a page nobody has been told about yet.
# - targets: ["https://wall.matrix.elysium/"]
# labels:
# module: http_2xx_tier_ca
# name: wall
# role: wall-dashboard
# host: trinity
# via: dns
# renewal: acme
# tier: household

# `/health` answers `{"status":"UP"}` without a session.
- targets: ["https://actual.matrix.elysium/health"]
labels:
Expand Down
126 changes: 126 additions & 0 deletions stacks/sensitive/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,132 @@ start.matrix.elysium {
}
}

# The office wall dashboard (ADR-0119): a static page and the Prometheus
# answers it shows, served to `heimdall`'s kiosk and to anything else on a
# segment that reaches 443 here. Two halves, one rule between them:
#
# / the page, from stacks/sensitive/wall/, mounted read-only.
# /api/q/NAME a FIXED question. Each handle below rewrites to one PromQL
# query written in this file, and the reader token is added
# here, server-side. The browser chooses which question, never
# the query: the client's own query string is replaced by the
# rewrite, so /api/q/cpu?query=anything still asks the CPU
# question. Nothing else under /api/ answers. The reader token
# can query and nothing more (ADR-0067); this narrows it again,
# to eight answers. The page holds no credential, and neither
# does the Pi.
#
# The token is the one Glance already holds, GLANCE_PROMETHEUS_TOKEN, given
# to the caddy service in compose.yaml. It is the estate's READER, which
# Glance and Home Assistant already share, so rotating it is still the three
# edits secrets/sensitive.example.yaml lists. The upstream is the ingest proxy
# on `prometheus`, whose leaf the estate CA issued, so that CA is trusted for
# this one transport: the committed stacks/observability/alloy/ingest-ca.pem,
# mounted read-only, the same file render-trust-bundles.sh feeds Glance.
#
# Read-only by method as well: anything but GET or HEAD is refused before a
# handle runs. The CSP lets the page load only itself and fetch only itself,
# so a change to the page that reached for a CDN or a third-party API would
# fail in the browser rather than quietly leak a request.
(wall_prometheus) {
reverse_proxy https://10.0.99.20:9090 {
header_up Authorization "Bearer {$GLANCE_PROMETHEUS_TOKEN}"
header_up -Cookie
header_down -Set-Cookie
transport http {
tls_trust_pool file /etc/caddy/tls/ingest-ca.pem
}
}
}

wall.matrix.elysium {
header {
Content-Security-Policy "default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self'; font-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
X-Content-Type-Options nosniff
Referrer-Policy no-referrer
-Server
}

# `route` keeps the order written: the method gate must run before any
# handle, and Caddy would otherwise sort `respond` after `handle`. It
# matters because Prometheus reads a POST body's `query=` ahead of the
# URL's, so a POST through a rewrite could still ask its own question.
route {
@unsafe not method GET HEAD
respond @unsafe 405

# Every firing alert, Watchdog included: its absence means rule evaluation has stopped.
# ALERTS{alertstate="firing"}
handle /api/q/alerts {
rewrite * /api/v1/query?query=ALERTS%7Balertstate%3D%22firing%22%7D
import wall_prometheus
}

# CPU busy per node_exporter host; a host that stops reporting drops out.
# 100 * (1 - avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])))
handle /api/q/cpu {
rewrite * /api/v1/query?query=100%20%2A%20%281%20-%20avg%20by%20%28instance%29%20%28rate%28node_cpu_seconds_total%7Bmode%3D%22idle%22%7D%5B5m%5D%29%29%29
import wall_prometheus
}

# Whether each SNMP device answered its last poll: morpheus, mjolnir, neo, shiva.
# max by (device) (up{job="snmp"})
handle /api/q/snmp {
rewrite * /api/v1/query?query=max%20by%20%28device%29%20%28up%7Bjob%3D%22snmp%22%7D%29
import wall_prometheus
}

# WAN traffic now, both directions (rules/internet.rules.yaml).
# homelab_wan_bits_per_second
handle /api/q/wan {
rewrite * /api/v1/query?query=homelab_wan_bits_per_second
import wall_prometheus
}

# The last hour of download, for the sparkline: a range vector, so a matrix.
# homelab_wan_bits_per_second{direction="receive"}[1h:2m]
handle /api/q/wan_hour {
rewrite * /api/v1/query?query=homelab_wan_bits_per_second%7Bdirection%3D%22receive%22%7D%5B1h%3A2m%5D
import wall_prometheus
}

# TCP connect time to 1.1.1.1:443, the internet anchor.
# probe_duration_seconds{job="blackbox-latency",name="cloudflare"}
handle /api/q/rtt {
rewrite * /api/v1/query?query=probe_duration_seconds%7Bjob%3D%22blackbox-latency%22%2Cname%3D%22cloudflare%22%7D
Comment on lines +357 to +359
import wall_prometheus
}

# Mjolnir: charge, runtime, time on battery, load.
# {__name__=~"upsEstimatedChargeRemaining|upsEstimatedMinutesRemaining|upsSecondsOnBattery|upsOutputPercentLoad",instance="10.0.99.10"}
handle /api/q/ups {
rewrite * /api/v1/query?query=%7B__name__%3D~%22upsEstimatedChargeRemaining%7CupsEstimatedMinutesRemaining%7CupsSecondsOnBattery%7CupsOutputPercentLoad%22%2Cinstance%3D%2210.0.99.10%22%7D
import wall_prometheus
}

# Heimdall's own SoC temperature, for the status bar.
# max(node_thermal_zone_temp{instance="heimdall"})
handle /api/q/pi_temp {
rewrite * /api/v1/query?query=max%28node_thermal_zone_temp%7Binstance%3D%22heimdall%22%7D%29
import wall_prometheus
}

handle /api/* {
respond "no such question" 404
}

handle {
root * /srv/wall
file_server
}
}

log {
output stdout
format json
}
}

# The host's own name: nothing is served under it yet.
trinity.matrix.elysium {
handle {
Expand Down
54 changes: 54 additions & 0 deletions stacks/sensitive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ adguard/AdGuardHome.yaml AdGuard Home's whole configuration, blocklists includ
glance/ Glance's configuration: glance.yml and pages/, each
mounted read-only, and assets/icons; validated in CI
by its own binary
wall/ the office wall dashboard (ADR-0119): static HTML,
CSS and JS, served by Caddy at wall.matrix.elysium
ntfy/server.yml ntfy's settings; its users and access list come from SOPS
ntfy/templates/ message templates, mounted read-only
stirling-pdf/smoke.sh proves the PDF engine works, not just its status endpoint;
Expand Down Expand Up @@ -738,6 +740,58 @@ is a file under `pages/`, an `$include` line in `glance.yml` and a mount in
the tier CA probed it from `trinity` (`probe_success 1`). It is live once
`prometheus` pulls the merge; `probe_success{name="glance"}` then reads 1.

## The wall page

The office wall dashboard, at `https://wall.matrix.elysium`, shown full-screen
by `heimdall`'s kiosk
([ADR-0119](../../docs/adr/0119-put-the-office-wall-dashboard-on-a-pi-5-on-hicks.md),
[`build-heimdall.md`](../../docs/runbooks/build-heimdall.md)). It shows about
eight things at a size read from across the room: the time, the firing
alerts, eight hosts, the internet, the UPS, and how old each answer is. No
container of its own: Caddy serves `wall/` as static files.

- **The page chooses the question, never the query.** Each `/api/q/NAME` is a
`handle` in the Caddyfile that rewrites to one PromQL query written there,
and Caddy adds the reader token on the way to the ingest proxy on
`prometheus`. A client's own query string is replaced, so
`/api/q/cpu?query=…` still asks the CPU question. Anything else under
`/api/` is 404. Only GET and HEAD reach a handle: Prometheus reads a POST
body's `query=` ahead of the URL's, so the method gate runs first, inside a
`route` that keeps it there. Measured against the pinned Caddy with a
stand-in upstream on 2026-11-17: the question rewritten, `?query=up`
ignored, POST and DELETE 405 without reaching upstream, `/api/v1/query`
404, the client's cookie stripped and the token added.
- **No credential in the page or on the Pi.** The token is
`GLANCE_PROMETHEUS_TOKEN`, the estate's reader that Glance and Home
Assistant already share, given to the caddy service. Its upstream's leaf
is the estate CA's, so Caddy trusts the committed
`stacks/observability/alloy/ingest-ca.pem` for that one transport.
- **It loads nothing from anywhere else.** The site's Content-Security-Policy
allows only itself. There are no web fonts; the stacks fall back to the
Pi's DejaVu.
- **It says when it does not know.** No answer from Prometheus, or a
Watchdog that is not firing, is shown in red as exactly that, never as
"All quiet". A host that stops reporting reads *no data*. The status bar
gives each source's age and turns amber at two and a half minutes.
- **The household half is not here yet.** The calendar, the weather and the
house come through Home Assistant in a later change, the same way: fixed
entities, a token added by Caddy.
- **Adding it to the running tier.** On `trinity`:
1. Add `wall` to `trinity`'s *Additional Names for this Host* on `morpheus`
([`add-a-host-override.md`](../../docs/runbooks/add-a-host-override.md)),
then check that `wall.matrix.elysium` answers `10.0.99.40`.
2. `make up STACK=sensitive` (or wait for the converge timer). Caddy is
recreated for its alias, its mounts and the site block, and step-ca
issues the name's leaf on the first request.
3. `curl -s https://wall.matrix.elysium/api/q/alerts | head -c 200` from a
Hicks host that trusts the tier's root: a JSON answer with
`"status":"success"`.
4. On `heimdall`, change the URL in `~/.config/labwc/autostart` to
`https://wall.matrix.elysium/` and reboot (`build-heimdall.md` §7).
5. Uncomment the `wall` probe in
`stacks/observability/prometheus/targets/blackbox.yaml`, in its own
change, once step 3 answers.

## ntfy

Where the estate's alerts are delivered since [#136], replacing ntfy.sh for
Expand Down
14 changes: 14 additions & 0 deletions stacks/sensitive/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ services:
- actual.matrix.elysium
- pdf.matrix.elysium
- start.matrix.elysium
- wall.matrix.elysium
# The reader token, for the wall page's fixed Prometheus questions only
# (the Caddyfile's wall.matrix.elysium block, ADR-0119). It is Glance's
# variable on purpose: one reader, so rotating it stays the three edits
# secrets/sensitive.example.yaml lists.
environment:
GLANCE_PROMETHEUS_TOKEN: ${GLANCE_PROMETHEUS_TOKEN:?set in secrets/sensitive.sops.yaml}
mem_limit: 128m
memswap_limit: 128m
cap_drop: [ALL]
Expand Down Expand Up @@ -178,6 +185,13 @@ services:
# its message says so rather than naming `make certs`, which on this host
# would mint a third CA nobody asked for.
- ../../certificates/tier-ca.pem:/etc/caddy/tls/ca.pem:ro
# The estate CA, for the one upstream outside this host: the ingest
# proxy on `prometheus`, which the wall page's questions go to. The
# committed copy, the file render-trust-bundles.sh gives Glance, so it
# exists in every checkout and needs no render step.
- ../observability/alloy/ingest-ca.pem:/etc/caddy/tls/ingest-ca.pem:ro
# The wall page itself, static files served as they are (ADR-0119).
- ./wall:/srv/wall:ro
ports:
- "${BIND_ADDR:-0.0.0.0}:${HTTPS_PORT:-443}:443"
depends_on:
Expand Down
Loading
Loading