aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-04-26 19:56:16 -0500
committerCraig Jennings <c@cjennings.net>2026-04-26 19:56:16 -0500
commit822075bf99cda84782ef04419855f6c289a6fc13 (patch)
treee4abf99bdf7da13fcb1b6a00fc12d2105fd2608e /scripts
parent9f62328988e83413eb819ac1ab2021a414188a67 (diff)
downloadarchangel-822075bf99cda84782ef04419855f6c289a6fc13.tar.gz
archangel-822075bf99cda84782ef04419855f6c289a6fc13.zip
refactor: collapse sshd_config seds into enable_sshd_root_login
The two sed -i invocations in configure_ssh worked on stock Arch sshd_config but had a real silent-failure mode. If neither the commented (#PermitRootLogin) nor the uncommented form was present, both seds did nothing and the install shipped without root SSH. The user discovered it at first ssh attempt, not at install time. The second sed was also redundant. By the time it ran, the first sed had produced a line matching the second sed's pattern. The new enable_sshd_root_login helper in lib/common.sh combines both substitutions into one sed -i -e ..., then verifies PermitRootLogin yes is present in the file. If the verification fails, it calls error rather than silently appending. Silent appending would mask a corrupted starting file, which is exactly the failure mode worth flagging loudly. The helper takes the config path as an argument so the bats tests in commit 7486abb can run unprivileged against tempfiles. configure_ssh passes /mnt/etc/ssh/sshd_config and is now a single call instead of two seds. Verified: bats 135 → 140 (+5 covering normal/boundary/error). Lint clean. Helper smoke-tested against current Arch sshd_config. The loud-error path can't be exercised against the live default but is covered by the bats error case. Filed as a follow-up :techdebt: item: ~10 other sed -i sites in installer/archangel and lib/btrfs.sh follow the same silent-replace pattern. The FILES= site for LUKS is the worst (silent failure means LUKS prompts on every boot). Triage each per this same recipe in a future session.
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions