7 Commits
Author SHA1 Message Date
oqyude 5712abb78b nginx: 1.31.9 из master-инпута на всех хостах (CVE-2026-123007)
test-runner / smoke (push) Successful in 2s
nixos flake checks / invariant-checks (push) Successful in 8m30s
Уязвимы 1.30.0–1.30.6 и 1.31.0–1.31.8; исправлено в 1.30.7 / 1.31.9.
Наш пин nixos-unstable отдаёт nginxMainline 1.31.8 — пакет из pkgs.nginxMainline
уязвимость не закрывает. В nixpkgs-master уже 1.31.9.

- новый общий модуль modules/nginx-mainline.nix задаёт services.nginx.package
  из nixpkgs-master; его импортируют и defaultModule, и strictModule
- modules/server/nginx.nix больше не задаёт пакет сам (остался комментарий)
2026-11-19 21:36:47 +03:00
oqyude a182905829 engipy: дефолт bge-m3 в юните, флаг AB-моделей, настоящая проверка venv
nixos flake checks / invariant-checks (push) Successful in 1m21s
test-runner / smoke (push) Successful in 1s
После мержа feat/model-select-default (02ed6aa) юнит отдавал устаревший env:
ENGIPY_MODEL указывал на legacy-чекпойнт rubert-tiny2, которого в каталоге без
ENGIPY_ENABLE_AB_MODELS=1 нет — сервис падал на старте с ValueError. Вдобавок
ENGIPY_EMBEDDINGS_PATH указывал на 312-мерную матрицу при 1024-мерной модели.

- model = "BAAI/bge-m3" (каталожный id), embeddingsStem = "gesn_baai_bge_m3"
- новый option enableAbModels -> ENGIPY_ENABLE_AB_MODELS=1 (селектор в UI;
  e5-large остаётся available=false — чекпойнта нет)
- engipy-install проверяет сам venv, а не только маркер: python из pyvenv.cfg
  уехал в GC, после ребута 19.11 exec падал с 203/EXEC
2026-11-19 13:05:40 +03:00
oqyude ee6646970c essentials: убрать тяжёлые по замыканию пакеты (решение владельца)
nixos flake checks / invariant-checks (push) Successful in 2m2s
test-runner / smoke (push) Successful in 2s
Проверено на rydiwo: cache miss'ов в этом файле НЕ было — все 63 пакета
отдавались и нулевым кэшем флота (`nix-cache.zeroq.su`), и `cache.nixos.org`,
включая нишевые (rgx, snitch, whostere, usbtree, mcat, fresh-editor, tuckr).
То есть «долгая сборка» шла не отсюда; убираем не ради misses, а ради веса
замыкания и риска сборки после обновления nixpkgs.

Убрано (closure по `nix path-info -S`):
  nix-prefetch-scripts 727 МБ · devenv 451 МБ · speedtest-cli 213 МБ
  yaml-language-server 215 МБ · mc 161 МБ · nix-du 152 МБ · nvd 213 МБ
  mcat 93 МБ · tuckr, tlrc, tuios (в списке не было) — нишевые TUI

Оставлено сознательно: nil + fresh-editor (один редактор и один LSP для Nix),
gdu + dust (два взгляда на диск), nix-diff/nix-tree/nixfmt-tree (диагностика
store), snitch/whosthere/lazyssh/bluetui/rgx (мелкие, нужны по одной задаче).

Как проверять дальше, а не догадываться:
  sudo nixos-rebuild dry-build --flake /etc/nixos#sapphira   # что РЕАЛЬНО соберётся
  nix path-info -S <drv>                                     # вес замыкания
2026-11-16 22:16:43 +03:00
oqyude 1213fe1757 secrets: rotate minimax provider key (auth + account)
nixos flake checks / invariant-checks (push) Successful in 2m38s
test-runner / smoke (push) Successful in 1s
2026-10-28 19:56:28 +03:00
oqyude 9bf9407c9d fix(nginx): drop authelia from herdr.zeroq.su, trust proxy chain
test-runner / smoke (push) Canceled after 0s
The herdr-web-ui vhost was using authelia forward-auth like every
other *.zeroq.su vhost, but the upstream Bun server's sameOrigin
check (server/machine-security.ts:18-46) is not designed for
reverse proxies other than Tailscale serve:

  1. POST /api/auth through the vhost returned 500 because nginx's
     auth_request subrequest returned 401 and error_page 401 =302
     only works for GET. (Fixed by exempting /api/auth and
     /api/devices/pair from authelia — commit 61ad57a.)

  2. The sameOrigin function compares the browser's Origin against
     new URL(request.url).origin. For a proxy_pass to 127.0.0.1:7317
     the URL is http://127.0.0.1:7317/..., which never matches
     https://herdr.zeroq.su. The function does NOT read
     X-Forwarded-Host. Every cross-origin POST returned 403
     invalid_origin. (Fixed by in-place patch on the plugin's
     server/machine-security.ts on sapphira to also trust
     X-Forwarded-Host when X-Forwarded-Proto is also set, and to
     reset expected.port so the comparison matches the browser's
     default-port Origin. The .orig file is saved alongside so
     `cp server/machine-security.ts.orig server/machine-security.ts`
     reverts the change before any `herdr plugin update`.)

  3. NixOS nginx with recommendedProxySettings = true appends an
     include of a file that sets Host, X-Forwarded-Proto,
     X-Forwarded-Host AFTER every location's extraConfig.
     My previous `proxy_set_header X-Forwarded-Host $host;` in
     extraConfig ended up sending the header twice
     ("herdr.zeroq.su, herdr.zeroq.su"), the sameOrigin function
     then sees a comma-joined value, fails to parse it as a host,
     and 403s every cross-origin POST. Removing the explicit
     proxy_set_header lines lets the include's single values
     reach the upstream correctly.

  4. Static assets (manifest.webmanifest, sw.js, favicon.ico,
     /assets/*) used to go through the authelia-gated / location,
     which 302-redirected them to authelia.zeroq.su, breaking the
     PWA's manifest load and the service worker. Exempted via a
     regex location; with the bun patch and the include-based
     header set, they now load with the right Host.

The herdr.zeroq.su vhost now serves the SPA with only the
herdr_web_token gate. Authelia stays in front of every other
*.zeroq.su vhost. To bring authelia back in front of herdr-web-ui
the cleanest long-term fix is for the upstream to merge the
X-Forwarded-Host patch into the released herdr-web-ui
(server/machine-security.ts); until then, the in-place patch on
sapphira must be reapplied after any `herdr plugin update
devswha.herdr-web-ui`, or the plugin should be installed via
`herdr plugin link` against a local fork that carries the patch.
2026-10-15 12:37:37 +03:00
oqyude 61ad57a102 fix(nginx): exempt herdr-web-ui /api/auth and /api/devices/pair from authelia
test-runner / smoke (push) Canceled after 0s
The herdr-web-ui token entry form (POST /api/auth with JSON body
{"token": "..."}) and the 6-digit pairing flow (POST /api/devices/pair)
were returning 500 through the vhost instead of 204/401. nginx's
auth_request subrequest hits authelia first; authelia returns 401
because the visitor is not signed in yet (no authelia cookie);
error_page 401 =302 then tries to redirect the original POST, but
nginx's 302 rewrite only works cleanly for GET — the POST round
trips to a 500 ("auth request unexpected status" in the nginx
error log). Same root cause as the working vtimeline/tty vhosts,
where the form is GET-only and the redirect works.

Fix: add a regex location '~ ^/api/(auth|devices/pair|health)$'
that proxies these three paths to 127.0.0.1:7317 WITHOUT the
authelia auth_request. The Bun server's own auth.ts keeps the same
three paths open in requiresAuth() (server/auth.ts:79-85), so a
missing or wrong token is rejected there with 401 + JSON body —
the gate is enforced one layer down, just not by authelia.

Verified after the rebuild:
  POST /api/auth (body=token)         -> 204 + set-cookie herdr_web_token
  POST /api/devices/pair (code=...)   -> 401 invalid_code (not 500)
  GET  /api/health                    -> 200

Real-browser flow now: visitor opens herdr.zeroq.su -> authelia
login -> web UI shows pair/token form -> submit POST /api/auth
works -> HttpOnly cookie set -> app loads.
2026-10-15 04:56:55 +03:00
oqyude 4d1426cab0 feat(home): add herdr user service + herdr.zeroq.su vhost
test-runner / smoke (push) Canceled after 0s
Per-UID design of herdr (Unix sockets, no HTTP) drove the home-manager
choice over a NixOS module — mirrors the existing opencode-web pattern.

  - home/modules/herdr.nix: new systemd user service running
    herdr 0.9.3 on sapphira, --session herdr-prod,
    EnvironmentFile from sops opencode_server. 2G/4G cgroup caps,
    Restart=always (mitigates herdr#4920).
  - modules/server/nginx.nix: herdr.zeroq.su vhost with Authelia
    forward-auth (wildcard *.zeroq.su policy already covers it).
    Upstream 127.0.0.1:7317 is the Bun server from the
    devswha/herdr-web-ui plugin (970star, MIT) — vhost 502s until
    'herdr plugin install devswha/herdr-web-ui' runs.
  - modules/server/coredns.nix: 192.168.1.20 herdr.zeroq.su A record.
  - home/server.nix: import the new module.
2026-10-15 04:35:06 +03:00