diff --git a/docs/runbooks/build-the-sensitive-tier-host.md b/docs/runbooks/build-the-sensitive-tier-host.md index 2c9149ce..a8c5d8d6 100644 --- a/docs/runbooks/build-the-sensitive-tier-host.md +++ b/docs/runbooks/build-the-sensitive-tier-host.md @@ -409,6 +409,7 @@ what each key is for. The values: | `GLANCE_PROMETHEUS_TOKEN` | The estate's reader token, `INGEST_TOKEN_READER` in `secrets/observability.sops.yaml` | No. `secrets/observability.sops.yaml` holds the original | | `GLANCE_MINIFLUX_FEVER_KEY` | The MD5 of `glance:`, once Miniflux is up and its user `glance` exists — the steps are beside the key in the example file ([ADR-0098](../adr/0098-add-glance-as-the-operators-start-page-beside-homepage.md)) | The Fever password and the `glance` login, both generated | | `GLANCE_TSP_SHEET_ID`, `GLANCE_GOOGLE_API_KEY` | The link-shared sheet of TSP prices and a Google API key restricted to the Sheets API, for the TSP widget on Sports & Markets — the steps are beside them in the example file | The key is in the operator's Google Cloud project; the sheet in their Drive | +| `GLANCE_GITHUB_TOKEN` | A fine-grained GitHub token with no permissions, for the Maintenance page's releases list and Glance card; it lifts GitHub's limit from 60 requests an hour to 5,000 | On the operator's GitHub account, where it expires | | `GLANCE_MARKETS`, `GLANCE_BOOKMARKS`, `GLANCE_VIDEO_TABS`, `GLANCE_REDDIT_TABS`, `GLANCE_TEAMS`, `GLANCE_PODCASTS` | The operator's own lists, one line of JSON each, in the shape `secrets/sensitive.example.yaml` gives ([ADR-0100](../adr/0100-grow-glance-into-a-homelab-page-and-keep-the-operators-lists-in-sops.md)). Not credentials | No | | `NTFY_ALERTMANAGER_TOKEN` | the pinned image's `ntfy token generate` — the command is beside the key | No. The monitoring host's `ALERTMANAGER_NTFY_TOKEN` is the other copy | | `NTFY_ALERTMANAGER_PASSWORD_HASH` | `make gen-secret`, then `make hash-password` on it | No — the password is thrown away; this user logs in by token | diff --git a/docs/security.md b/docs/security.md index b1a12a07..05de900b 100644 --- a/docs/security.md +++ b/docs/security.md @@ -1167,17 +1167,21 @@ from Home Assistant with *not enough permissions*. - **Glance fetches a fixed list from `trinity`** ([#1223](https://github.com/Gerrrt/HomeLab/issues/1223), [ADR-0098](adr/0098-add-glance-as-the-operators-start-page-beside-homepage.md), [ADR-0100](adr/0100-grow-glance-into-a-homelab-page-and-keep-the-operators-lists-in-sops.md)): - Reddit, Hacker News, Open-Meteo, Yahoo Finance, ESPN, GitHub, YouTube's - feeds and uselessfacts, on its cache schedule. Every URL it asks is written + Reddit, Hacker News, Open-Meteo, Yahoo Finance, ESPN, GitHub, Google + Sheets, YouTube's feeds, the podcasts' own feeds and uselessfacts, on its + cache schedule. Every URL it asks is written in `glance/` or in the operator's lists in SOPS, and nothing a visitor types becomes a fetch, so it has no inward-fetch flag to set. The one third-party request the browser makes is for YouTube thumbnails. The feeds people follow are fetched by Miniflux's fetcher, under the flag above, and Glance reads them from Miniflux. It has no login. It shows the names of firing alerts, which Grafana shows to the same networks behind a login, and - 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. + that difference is accepted. Every credential it holds reads one thing: + the reader token, which can only query; a Fever key that can only mark + items read for a Miniflux user that follows public feeds; an Immich key + with only `server.statistics`; the token of Paperless's view-only user; a + Google API key restricted to the Sheets API, which can read only sheets + already shared by link; and a GitHub token with no permissions. - **The wall page answers twelve 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 diff --git a/scripts/render-config.sh b/scripts/render-config.sh index b898ca37..791c335a 100755 --- a/scripts/render-config.sh +++ b/scripts/render-config.sh @@ -594,6 +594,7 @@ COMPOSE_VARS=( GLANCE_MINIFLUX_FEVER_KEY GLANCE_GOOGLE_API_KEY GLANCE_TSP_SHEET_ID + GLANCE_GITHUB_TOKEN GLANCE_MARKETS GLANCE_BOOKMARKS GLANCE_VIDEO_TABS diff --git a/scripts/seed-validation-env.sh b/scripts/seed-validation-env.sh index 6cb90b12..e88de730 100755 --- a/scripts/seed-validation-env.sh +++ b/scripts/seed-validation-env.sh @@ -80,6 +80,7 @@ STACK="${REPO_ROOT}/stacks/${2:-observability}" echo "GLANCE_MINIFLUX_FEVER_KEY=validation-only" echo "GLANCE_GOOGLE_API_KEY=validation-only" echo "GLANCE_TSP_SHEET_ID=validation-only" + echo "GLANCE_GITHUB_TOKEN=validation-only" # Glance's own lists are substituted into YAML, so a placeholder string # would not parse: each is the smallest valid list of its kind (ADR-0100), # single-quoted as render-config.sh writes them. The bookmark title holds a diff --git a/secrets/sensitive.example.yaml b/secrets/sensitive.example.yaml index 45d746b7..951de74c 100644 --- a/secrets/sensitive.example.yaml +++ b/secrets/sensitive.example.yaml @@ -316,6 +316,18 @@ GLANCE_MINIFLUX_FEVER_KEY: change-me-to-the-md5-of-glance-colon-fever-password GLANCE_TSP_SHEET_ID: change-me-to-the-link-shared-price-sheets-id GLANCE_GOOGLE_API_KEY: change-me-to-a-key-restricted-to-the-sheets-api +# Glance's Maintenance page reads GitHub's public API: the releases list and +# the Glance card. +# +# GLANCE_GITHUB_TOKEN github.com › Settings › Developer settings › +# Personal access tokens › Fine-grained tokens › +# Generate new token: public repositories only, no +# permissions added. It reads only what anyone can, +# and lifts the limit from 60 requests an hour, +# shared by the house's address, to 5,000. When it +# expires, both widgets say GitHub answered 401. +GLANCE_GITHUB_TOKEN: change-me-to-a-fine-grained-token-with-no-permissions + # Glance's own lists (ADR-0100). NOT credentials. They are here because this # repository is public and they describe a person: what they watch, read, # invest in and log in to. Each is ONE LINE of JSON, which Glance substitutes diff --git a/secrets/sensitive.sops.yaml b/secrets/sensitive.sops.yaml index 2bf68f7d..2655aef0 100644 --- a/secrets/sensitive.sops.yaml +++ b/secrets/sensitive.sops.yaml @@ -126,6 +126,7 @@ MQTT_RING_PASSWORD: ENC[AES256_GCM,data:FanU7jvscjrueyn8c6t+r4zbdM1qBOba,iv:a4zJ WALL_HA_TOKEN: ENC[AES256_GCM,data:5ePw/y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aZ3sZssDttnmoSRHKJ1PozZGhT1GXVO/BAP3GhroBZyKIGg=,iv:A5pznIXxJn6s67J2kKMBU+5IVR7OgDpwBDKY3R4Foys=,tag:TLEuyqRI9RLwgevYYMJ/WA==,type:str] +GLANCE_GITHUB_TOKEN: ENC[AES256_GCM,data:jWsnDND3rapYFYoxzFXJ2wtn1LZFYcxnWrvNPASYueNCpRmauj3eEYia9PzEn3PmEgdt2oljYC807tQRnwWoPYXO2yr3A6vAPcBuI1ynwQbldB9/AQaOb0Sfb9qJ,iv:PJtVtDys6SvblJNx91bzdwo9XS33I3OXvlPrErMxwaI=,tag:+pkl9o4YNm7/S/vHXs+jwA==,type:str] sops: kms: [] gcp_kms: [] @@ -150,8 +151,8 @@ sops: cWFUOUk2ajZjLzJ3akI4b2NVa2x6WFUKCfpLOW4BYcdPB6/oUKS91hKK0bQ0ma8k aLfyl0VnZz/iBAOImN/7l2sZPV/XY0lilPMjWWh4yGK27uDKhvDDtA== -----END AGE ENCRYPTED FILE----- - lastmodified: "2026-11-27T05:24:13Z" - mac: ENC[AES256_GCM,data:3EHL+RN23IWiA3O3ltkxAkmq+UhZaewQZkFzKsaUwmRbP0xbtHLAkCxY6asD4CKqYg29yUCWfgWI70LZ3EQjm8DBqe9ujDjavP0lRCJQ2o4gNQ4UpPWD/kEAGX7aysOhj13Y5NQlWVuc78mTIoDHcMygut74+6QMZJZoclj7yJg=,iv:xunQwunILIdzwShHIJ42spdbyXk9ke5VQHVehlFcE9E=,tag:7mkMxmmbYAdAaxP8ZrNabQ==,type:str] + lastmodified: "2026-11-28T05:13:56Z" + mac: ENC[AES256_GCM,data:po92+pJlt6iRhF3RcbjdY1HhtBlNRKV7gmNCOpMLovccFKw0YpwsrUqhjU8BGM0Zf7h7jIGhJ+3Rj1a5YFE7EPP0Dg+PF1S+8bcmaJ5dz6M9IdCEFPhSSolyWuEnWeH4XSla+ps1qtuO0o8teHpnwLpYab2ucF30pw9NwWiDP5s=,iv:y4Kc+McRPgHbVsvgH2lf/WPlZa8cExmjdVBM7GP73Io=,tag:3f2DWDEJHMyUBMMsYcP6gA==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.9.4 diff --git a/stacks/sensitive/README.md b/stacks/sensitive/README.md index 2be9d729..667ebb85 100644 --- a/stacks/sensitive/README.md +++ b/stacks/sensitive/README.md @@ -620,7 +620,8 @@ each a file under `glance/pages/` and a tab along the top, so none carries everything: - **Home** (`home.yml`): the ticker strip, search, bookmarks, the time and - weather, the estate in brief, the year and a random fact. Short on purpose. + weather, the estate in brief with the fullest disk, the year and a random + fact. Short on purpose. - **Read** (`read.yml`): Following, the Reddit tabs, Listen (the podcasts in `GLANCE_PODCASTS`, a few episodes per show), Hacker News, Lobsters and trending repositories. @@ -638,7 +639,10 @@ everything: - **Maintenance** (`maintenance.yml`): every scheduled job against its allowed age (backups and the off-site copy among them), the open `security` issues, pending updates and reboots, certificates by days left, - and upstream releases. + whether Glance itself is behind its latest release, and upstream releases. + Both GitHub widgets send `GLANCE_GITHUB_TOKEN`, a token with no + permissions, so they are not limited to the 60 requests an hour GitHub + gives the house's address. `glance.yml` holds what they share: the server, the theme, and the `&prometheus`, `&fever` and `&hosts` anchors the pages merge in. A new page diff --git a/stacks/sensitive/compose.yaml b/stacks/sensitive/compose.yaml index 85d2122f..2c6689e6 100644 --- a/stacks/sensitive/compose.yaml +++ b/stacks/sensitive/compose.yaml @@ -1775,6 +1775,11 @@ services: # reads. The id is in SOPS because the sheet is the operator's. GLANCE_GOOGLE_API_KEY: ${GLANCE_GOOGLE_API_KEY:?set in secrets/sensitive.sops.yaml} GLANCE_TSP_SHEET_ID: ${GLANCE_TSP_SHEET_ID:?set in secrets/sensitive.sops.yaml} + # A GitHub token with no permissions, for the Maintenance page's + # releases list and Glance card. It reads only what anyone can; it + # lifts GitHub's limit from the 60 an hour the house's address shares + # to 5,000 for the token. + GLANCE_GITHUB_TOKEN: ${GLANCE_GITHUB_TOKEN:?set in secrets/sensitive.sops.yaml} # The operator's own lists, one-line JSON that Glance substitutes into # the pages (ADR-0100). Not credentials: in SOPS because this # repository is public and they describe a person. diff --git a/stacks/sensitive/glance/pages/home.yml b/stacks/sensitive/glance/pages/home.yml index d46f1062..8b06912c 100644 --- a/stacks/sensitive/glance/pages/home.yml +++ b/stacks/sensitive/glance/pages/home.yml @@ -43,6 +43,9 @@ # The estate in one line each, from the same reader-proxy queries the # Homelab page uses; the detail is there. A site that is down is # named under the figures, so the page says which without a click. + # Under them, each host's fullest real disk: every one at 70% or more + # (where HostDiskFillingUp may fire), red from 90% (HostDiskCritical); + # below 70% only the fullest is named. - type: custom-api title: Estate title-url: /homelab @@ -63,8 +66,16 @@ or vector(0)) + (sum(homelab_container_running) or vector(0)) + disks: + <<: *prometheus + parameters: + query: >- + max by (instance) (100 * (1 + - node_filesystem_avail_bytes{fstype!~"tmpfs|overlay|squashfs|vfat|ramfs|fuse.*|nfs.*"} + / node_filesystem_size_bytes)) template: | {{ $probes := .Subrequest "probes" }} + {{ $dsk := .Subrequest "disks" }} {{ $ctr := .Subrequest "containers" }} {{ if or (ne .Response.StatusCode 200) (ne $probes.Response.StatusCode 200) }}

Prometheus answered {{ .Response.StatusCode }}

@@ -116,6 +127,23 @@ {{ if $down }}

Down: {{ $down }}

{{ end }} + {{ $disks := "" }}{{ $filling := false }}{{ $critical := false }} + {{ range sortByFloat "value.1" "desc" ($dsk.JSON.Array "data.result") }} + {{ $pct := .Float "value.1" }} + {{ $one := printf "%s %.0f%%" (.String "metric.instance") $pct }} + {{ if ge $pct 70.0 }} + {{ $filling = true }}{{ if ge $pct 90.0 }}{{ $critical = true }}{{ end }} + {{ if $disks }}{{ $disks = concat $disks ", " }}{{ end }} + {{ $disks = concat $disks $one }} + {{ else if not $disks }}{{ $disks = $one }}{{ end }} + {{ end }} + {{ if ne $dsk.Response.StatusCode 200 }} +

+ Disks: Prometheus answered {{ $dsk.Response.StatusCode }}

+ {{ else if $filling }} +

Disks filling: {{ $disks }}

+ {{ else if $disks }} +

Fullest disk: {{ $disks }}

{{ end }} {{ if not $watchdog }}

Watchdog silent: nothing here is current.

{{ end }} {{ end }} diff --git a/stacks/sensitive/glance/pages/maintenance.yml b/stacks/sensitive/glance/pages/maintenance.yml index c487ac8a..d2f6da44 100644 --- a/stacks/sensitive/glance/pages/maintenance.yml +++ b/stacks/sensitive/glance/pages/maintenance.yml @@ -278,12 +278,44 @@ {{ end }} + # Glance itself: the image trinity runs, as cAdvisor reports it, against + # GitHub's latest release. Dependabot opens the bump PR; this says + # whether one is due and whether the running container has it yet. + - type: custom-api + title: Glance + title-url: https://github.com/glanceapp/glance/releases + cache: 6h + <<: *prometheus + parameters: + query: max by (image) (container_last_seen{instance="trinity", name="sensitive-glance"}) + subrequests: + latest: + url: https://api.github.com/repos/glanceapp/glance/releases/latest + headers: + Accept: application/vnd.github+json + Authorization: Bearer ${GLANCE_GITHUB_TOKEN} + template: | + {{ $gh := .Subrequest "latest" }} + {{ $running := findSubmatch ":(v[0-9][^@]*)" (.JSON.String "data.result.0.metric.image") }} + {{ $latest := $gh.JSON.String "tag_name" }} + {{ if or (ne .Response.StatusCode 200) (not $running) }} +

No running version: Prometheus answered {{ .Response.StatusCode }}.

+ {{ else if ne $gh.Response.StatusCode 200 }} +

GitHub answered {{ $gh.Response.StatusCode }}.

+ {{ else if eq $running $latest }} +

{{ $running }}, the latest release.

+ {{ else }} +

{{ $latest }} is out; trinity runs {{ $running }}.

+ Release notes + {{ end }} + # New releases of the software this estate pins: the services, not the # lint and build tools. Dependabot opens the PR; this is the heads-up. - # Unauthenticated GitHub API, once per six hours per repository: 32 - # requests against the anonymous 60 an hour. + # Once per six hours per repository, with the no-permission token so + # the 32 requests do not spend the house's anonymous 60 an hour. - type: releases cache: 6h + token: ${GLANCE_GITHUB_TOKEN} show-source-icon: false collapse-after: 6 repositories: