Skip to content

fix(terminfo): harden systems.configure.terminfo — no silent no-op, sshd validate, required terminfo_hosts - #143

Open
t0kubetsu wants to merge 1 commit into
devfrom
fix/terminfo-bundle-hardening
Open

fix(terminfo): harden systems.configure.terminfo — no silent no-op, sshd validate, required terminfo_hosts#143
t0kubetsu wants to merge 1 commit into
devfrom
fix/terminfo-bundle-hardening

Conversation

@t0kubetsu

Copy link
Copy Markdown
Contributor

Summary

Hardens bundles/generic/systems.configure.terminfo (merged via #141), addressing the review feedback that carried over from the superseded #135:

  • Drop ignore_errors: true on the terminfo copy — the play now stats /usr/share/terminfo/a/alacritty on the controller first, copies only when present, and emits an explicit skip warning otherwise. Previously a headless controller without Alacritty produced a green run that installed nothing.
  • Add validate: '/usr/sbin/sshd -t -f %s' to the sshd_config edit — a config that would not parse is never written, instead of surviving until the next full sshd restart and locking the host out.
  • Require terminfo_hosts (drop default('all')) — scenario inventories carry proxmox/proxmox_cli groups, so a caller forgetting the var would rewrite sshd config on the hypervisor and the deployer. Matches the TARGET_GROUP pattern used by the other generic/ bundles. The only existing caller (admin_services_lab stage_01) already passes it explicitly.

README.md and bundle_parameters updated to match (default_where: call-site, no default); JSON regenerated with bundles/_tools/generate-bundle-params.py.

cc @pparage — this picks up your non-blocking findings from #135.

Relates to range42/range42#227.

Not addressed (deliberate)

insertafter: '^AcceptEnv LANG LC_\*' can still fall back to EOF and land inside a trailing Match block on exotic configs. Moving to an /etc/ssh/sshd_config.d/ drop-in would sidestep it, but that changes the bundle's editing strategy — left for a separate change if it bites.

Test plan

  • ansible-playbook --syntax-check (ansible-core, -e terminfo_hosts=<group>) — pass
  • ansible-lint — the previous ignore-errors violation is gone; the remaining standalone syntax-check[specific] complaint about the undefined hosts var is shared by every templated-hosts bundle in the repo (no lint CI configured)
  • Run admin_services_lab stage_01 against the lab; confirm skip warning appears when the controller lacks the terminfo entry, and the copy + sshd reload work when it does

Follow-up to #135 review feedback (superseded PR, comments carried over):

- drop ignore_errors on the terminfo copy: stat the controller for
  /usr/share/terminfo/a/alacritty first, copy only when present, and
  emit an explicit skip warning otherwise — no more green no-op runs
- add validate: 'sshd -t -f %s' to the sshd_config edit so a config
  that would not parse is never written
- require terminfo_hosts (drop default('all')): scenario inventories
  carry proxmox/proxmox_cli groups, an implicit all would rewrite sshd
  config on the hypervisor and the deployer; matches the TARGET_GROUP
  pattern used by the other generic bundles

Relates to range42/range42#227
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant