Симптом (ревью 2026-11-29): samba отдавала шару `root` с `path = "/"` и
`force user = "root"` — любой, кто знает учётку владельца, получал запись
на весь корень; для ssh стоял `PermitRootLogin = "yes"`, то есть root мог
войти паролем (сам пароль запрещён `PasswordAuthentication = false`, но
разрешение на парольный вход для root в конфиге оставалось явным).
Решение владельца: «шару root убирай, я в целом ей почти не пользовался»;
«Только ключ. Пароль запрещаем».
Правка: блок шары `root` удалён целиком (шары `nixos` и `oqyude` не
тронуты); `PermitRootLogin = "prohibit-password"`, `PasswordAuthentication
= false` оставлен.
Проверено (nix eval, sapphira):
- `services.samba.settings` → attrNames `["global" "nixos" "oqyude"]`;
- `services.openssh.settings` → `{prl:"prohibit-password", pwa:false}`.
Исследование по исходникам пина 31ecbaca (26.11), samba 4.23.10:
* В nixpkgs `services.samba` НЕТ ни одной опции AD DC — ни
enableActiveDirectoryDomainController, ни domainName/realm/serverRole.
Единственное похожее — settings.global.security = "ads" (вход в
существующий домен как member server, а не DC).
* pkgs.samba собран --without-ad-dc --without-ldap --without-ads: бинаря
samba-tool в нём нет вообще (проверено на работающем на sapphira
файловом сервере). Для DC нужен отдельный пакет; берём минимальный
override samba4.override { enableLDAP = true; enableDomainController = true; },
а не pkgs.samba4Full (cups + avahi + cephfs лишним весом).
* samba-tool domain provision берёт realm из smb.conf (флага --realm нет),
пишет <targetdir>/etc/smb.conf, private/, state/sysvol/, bind-dns/.
Шейры [sysvol] и [netlogon] обязательны: lp.get("path", "<имя шейры>")
возвращает path именно этой секции, иначе MissingShareError.
Непустой smb.conf не перезаписывается — поэтому шаблон задаёт
dns forwarder / dns port / server services.
* Провижининг НЕ идемпотентен → идемпотентность сделана в юните
(наличие private/sam.ldb → skip, exit 0).
Конфликты на sapphira (ссороться за порты нельзя, оба — assertion):
53/tcp+udp coredns (зоны zeroq.su + home.arpa) против AD DNS
445/tcp samba-smbd (файловый сервер) против DC (нужен для sysvol/GPO)
Оба порта — с внятным текстом и тремя вариантами решения; по умолчанию
предложен отдельный хост. Время не блокер: chronyd, расхождение ≈0.5 мс
при требовании ≤5 минут.
Что добавлено:
* modules/server/samba-ad.nix — опция host.samba-ad (enable = false),
юниты samba-ad-provision.service (oneshot, идемпотентный) и
samba-ad.service (Type=notify), smb.conf-шаблон в state dir,
пароль администратора только из sops-секрета (в рантайме).
* modules/server/default.nix — импорт (выключено).
* modules/server/samba.nix — samba-smbd теперь создаётся только при
services.samba.enable. Без этого выключение файлового сервера (нужное,
чтобы отдать 445 DC'у) оставляло фантомный юнит без ExecStart —
ровно ловушка ADR-0004 / R1.14. Для работающих хостов поведение
не меняется ни на байт.
Доказательства (ничего не активировано):
* enable=false: конфигурация оценивается, юнитов samba-ad* нет, AD-вариант
samba в замыкании отсутствует (0 совпадений).
* enable=true: конфигурация падает с тремя assertion'ами (realm не задан,
53 занят, 445 занят) — правильный результат.
* enable=true + конфликты сняты: drvPath
/nix/store/hm0i8qmni34b2j5bcjak1yvmg2s3y20p-nixos-system-sapphira-default.drv,
в плане сборки AD-сборка samba, шаблон smb.conf и оба юнита.
Открытые решения владельца (имя домена/realm, где живёт DC, делегирование
DNS, пароль, нужен ли DC на sapphira) — в .agent/notes/samba-ad-2026-10-30.md.
mkStorageGuard returned a serviceConfig fragment, so ConditionPathIsMountPoint
landed in [Service] where systemd ignores it - the guard was dead on 13 units.
- helper now returns a unitConfig fragment ([Unit]); RequiresMountsFor still
intentionally absent
- consumers re-pointed at the real unit names: samba-smbd, phpfpm-nextcloud,
immich-server, podman-3xui_app, podman-taperotation-{backend,frontend};
the old serviceConfig keys silently rendered three empty phantom units
- vds excluded: otreca has no /home/oqyude/External and a live condition would
skip podman-3xui_app and kill the 3x-ui panel at pubray1.zeroq.su
Verified: sapphira and otreca toplevel builds exit 0; all 13 units carry the
condition under [Unit] (line 3), zero occurrences under [Service].
Comprehensive batch addressing the 16-task backlog in
.agent/tasks/manifest.json. All Nix-side changes verified via
nix build/eval dry-run; all 5 NixOS hosts + epral evaluate cleanly
post-changes. No regressions.
Wave 1 (non-functional cleanup):
T1/A1 — configurations/mobile.nix:12: fix `import ../lib/xlib.nix`
(broken path) → `import ../lib/xlib`. Unblocks nixOnDroid
configurations.epral. R1.1 invariant.
T8/C3 — modules/containers/3x-ui.nix: remove `podman-update-3xui_app`
systemd service and commented timer. Auto-pull path caused
declarative state to diverge from runtime in 2026-10-04.
R1.5 invariant.
T13/D3 — modules/server/nginx.nix:368-371: remove dead
`networking.firewall.allowedTCPPorts = [80 443]`.
`firewall.enable = false` on sapphira (R1.3), so openFirewall
rules are no-op. Replace with R1.3 comment.
T6/C1 — .agent/decisions/notes/3x-ui-xray-26.9.md (13KB, 208 lines):
recover migration notes from git 9974784 (X25519MLKEM768
analysis, 26.7→26.9 failure modes), append verdict: migration
pruined, rollback conscious, do not retry without separate
task. R1.5 / C1.
T9/C4 — .agent/rules/project-rules.md: add R1.8 — Xray-core version is
state of 3x-ui panel, not Nix. Update trap entry for
3x-ui.nix:54 to reference R1.8.
T11/D1, T12/D2 — .agent/checkpoints.json + .agent/tasks/manifest.json:
verify R1.3 (router port-forwards 22/80/443/8443/22000) and
R1.4 (100.64.0.0 = Tailscale sapphira) wording already
satisfies acceptance criteria. Flip status pending → completed.
T4 (storage guard, FUNCTIONAL CHANGE):
New helper in lib/xlib/helpers.nix:
mkStorageGuard = xlib: {
RequiresMountsFor = [ xlib.dirs.server-home ];
ConditionPathIsMountPoint = [ "!${xlib.dirs.server-home}" ];
};
Applied to 13 systemd units via path-style override:
- modules/server/{postgresql,samba,homebox,gitea,navidrome,
syncthing,uptime-kuma,immich,nextcloud,calibre-web}.nix
- modules/containers/3x-ui.nix (podman-3xui_app)
- modules/containers/tape-rotation.nix (podman-taperotation-{backend,frontend})
Anchor: xlib.dirs.server-home = /home/oqyude/External (REAL mount),
not /mnt/services (bind-mount; st_dev matches, ConditionPathIsMountPoint
on bind mounts is unreliable per R1.2 note).
Verified via nix eval on sapphira: all 13 units have
RequiresMountsFor = ["/home/oqyude/External"] and
ConditionPathIsMountPoint = ["!/home/oqyude/External"].
Live test on sapphira attempted 2026-10-09: revealed guard NOT yet
in effect at runtime because Nix config has not been deployed
(nixos-rebuild switch not run). postgresql started despite External
being unmounted. Implementation correct, deployment pending user
action.
T7/C2 (read-only diag, no code change):
3x-ui version facts recorded in conversation (sapphira journal +
/var/lib/containers/storage/overlay/.../diff/app/bin/xray-linux-amd64):
- Active Xray: 26.7.28 (go1.26.5 linux/amd64) — R1.5 validated at runtime
- Stale binary: 26.9.30 (go1.27.1) — leftover from failed 26.9 migration
- Panel DB (x-ui.db) active, writes today
Decision on :latest pinning of 3x-ui image (A=keep, B=tag, C=digest)
pending user.
T3/A3 (nftables on otreca — config analysis + proposal):
Diagnostic attempted via ssh otreca-tailscale (100.64.1.0) and
otreca public (109.248.161.5:22): BOTH UNREACHABLE. Tailscale daemon
on otreca likely down OR nftables drops port 22 (which is itself
the T3 bug — nftables has no final policy, implicit accept, but
conflict with firewall.enable = true per R1.6).
Proposal written: .agent/decisions/proposals/vds-nftables-fix.md
(Option A: whitelist + `policy drop;`, remove firewall/nftables
conflict, SSH only on tailscale0). Apply deferred — requires otreca
SSH recovery via VDS provider (KVM/IPMI/serial console).
T5/B2 (backups documentation):
.agent/decisions/0002-backups-external.md (draft): catalog of what
is declared in Nix vs. what is external; awaiting answer to open
question 5.6 (where are backups, how are they verified).
T15/E2 (CI checks):
.ci/checks.sh (executable, ~140 lines) with 3 checks from
analysis-report.md §5:
- #1: no `:latest` in container images (with R1.5 whitelist
for 3x-ui). FAIL — 4 violations:
localhost/kokoro-tts:latest
ghcr.io/openhands/openhands:latest
docker.io/elizaroveugene/taperotation-backend:latest
docker.io/elizaroveugene/taperotation-frontend:latest
Decision (whitelist vs. pin) pending user.
- #2: nix flake check (skipped with --no-build).
- #7: secrets/ files match .sops.yaml path_regex. PASS.
T16/E3 (archive commented modules):
13 of 14 commented modules in modules/server/default.nix:37-50
existed as files. git mv them to archive/{server-modules,containers}/.
1 (stirling-pdf.nix) didn't exist; just removed the comment.
modules/server/default.nix:37-50 cleaned of 14 commented lines.
Added 3-line comment recording the archive date and reason.
Verified: nixosConfigurations.sapphira still evaluates.
Post-change state:
$ nix build .#nixosConfigurations.{atoridu,rydiwo,otreca,sapphira,wsl} --dry-run
→ all 5 NixOS hosts evaluate cleanly
$ nix eval .#nixOnDroidConfigurations.epral.config.system.stateVersion
→ "24.05"
Pending (user input required — not in this commit):
- T4 deploy: run `nixos-rebuild switch` on sapphira to activate guard
- T7: pick A/B/C for 3x-ui :latest pinning
- T3: recover otreca SSH via VDS provider, then apply Option A
- T10/C5: decide fate of reality443Forwarding
- T5: answer 5.6 about backup location/verification
- T15: whitelist or pin 4 :latest images
Untracked files NOT committed (in .gitignore):
.temp/t4-live-test*.sh, .temp/cleanup-*.sh — throwaway test scripts
from T4 live test attempts. Preserved locally for reference; see
AGENTS.md convention ("Создавать `.temp/` в корне проекта — Для
временных файлов агента. Всегда в `.gitignore`").
Also untracked, committed:
.agent/reviews/2026-10-10-review-dev-diff-vs-16644fc.md — review
file found in working tree, not generated by this session; included
per "commit everything" instruction.