chore(memory): LRN-018 + journal — hotfix sshd-reload-inactive

This commit is contained in:
bchanot committed 2026-10-12 21:24:09 +02:00
1 parent 9d8347f58f
commit c9d47ce91d
4 files changed
+89

No files matched your search

+3
View File
@@ -144,3 +144,6 @@ Done: `bind -n C-M-Up/Down/Left/Right select-pane` (root + copy-mode-vi, no vim
## 2026-10-11 — desktop + RDP offered, WSL default no
Done: `offer_desktop()` (desktop [Y/n] → RDP [Y/n], WSL → [y/N] + hint), `confirm` default arg, `is_wsl()`. Trigger: WSL install lost DNS mid-run after ubuntu-desktop-minimal (hypothesis: NetworkManager/systemd-resolved rewrote /etc/resolv.conf), fail2ban/whois fetch failed. 8-case stub harness OK, shellcheck clean. Branch feature/desktop-rdp-prompt, commit 5d60269, pushed, not merged.
## 2026-10-12 — WSL DNS confirmed + sshd hardening abort fixed
Done: WSL DNS root cause confirmed (ubuntu-desktop-minimal → systemd-resolved/NetworkManager rewrote resolv.conf); repair runbook (disable both, rm resolv.conf, `wsl --shutdown`) worked. Then install aborted at harden_sshd: `systemctl reload ssh` on inactive unit + `set -e`. Fix 64f06bb on bugfix/sshd-reload-inactive: `is-active` guard + `try-reload-or-restart`, `/run/sshd` created before `sshd -t` (Ubuntu 24.04: privsep dir exists only while ssh.service runs — challenge correctness MAJOR). Stub smoke both branches, shellcheck, semgrep PASS. Not merged.
+12
View File
@@ -135,3 +135,15 @@ triggering pane as target: `set -pu @opt` needs no `-t`; `#{hook_pane}` quoting
testable headless on a scratch pane (`new-window -d -P -F '#{pane_id}'`, assert `#{pane_in_mode}`); address
by pane id, window-name plugin renames `-n` names. (5) `\;` inside tmux.conf '...' stays literal, then splits
a bind's command list when the string is parsed by if-shell: works, no need to convert to `{ }` blocks.
## LRN-018 — systemctl under `set -e`: guard reload, create /run/sshd before `sshd -t`
2026-10-12. Found fixing install.sh `harden_sshd` on WSL (commit 64f06bb). (1) Bare `systemctl reload <unit>`
exits non-zero when unit inactive ("<unit> is not active, cannot reload.") → `set -e` kills installer. Guard:
`if systemctl is-active --quiet <unit>; then sudo systemctl try-reload-or-restart <unit>; else echo ...; fi`.
`try-reload-or-restart` exits 0 if unit stopped between check and call (no TOCTOU abort); `is-active` needs no
sudo, inside `if` never trips `set -e`. `restart` on inactive unit starts it, different semantic. (2) Ubuntu 24.04
(systemd 255): `/run/sshd` created only by ssh.service `RuntimeDirectory=sshd`, no tmpfiles rule (systemd ≥ 256
adds `20-systemd-ssh-generator.conf`). sshd never started → `sudo sshd -t` fails "Missing privilege separation
directory" → looks like config rejection. `sudo install -d -m 0755 /run/sshd` before `sshd -t`, idempotent.
(3) WSL: no sshd running by default, unit socket-activated or never started → any installer "validate + reload"
path must survive inactive unit. Stub `systemctl`/`sudo`/`sshd` on PATH in scratchpad to smoke both branches.