From 279f4d6b95508043a5b597ad488cbfb1ebf39431 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Sun, 30 Aug 2026 18:06:33 -0400 Subject: [PATCH] Give the sshd acceptance exercise a terminal for sudo Without a terminal sudo keys its cached credential on the parent process of each call, so the timestamp validated by sudo -S -v in the test shell never reached omarchy-setup-security-sshd's own sudo calls when omarchy-iso-test drove the suite over ssh with no pty, and the exercise died with 'a terminal is required'. Run it under script(1) and validate the password on that pseudo-terminal first, so every sudo underneath shares the terminal-keyed credential. --- test/acceptance.d/security-test.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/acceptance.d/security-test.sh b/test/acceptance.d/security-test.sh index 0755c722..4dc96ad9 100755 --- a/test/acceptance.d/security-test.sh +++ b/test/acceptance.d/security-test.sh @@ -58,7 +58,17 @@ verify_sshd_hardening() { rm -f "$key_file" "$key_file.pub" ssh-keygen -t ed25519 -N "" -q -C "omarchy-acceptance" -f "$key_file" - if ! omarchy-setup-security-sshd --key="$(cat "$key_file.pub")" >"$ARTIFACTS/setup-security-sshd.log" 2>&1; then + # sudo keys its cached credential on the calling terminal and, absent one, on + # the caller's parent process alone, so a timestamp validated in this shell + # never reaches the setup command's own sudo calls when the suite runs + # without a terminal (omarchy-iso-test drives it over ssh with no pty). Give + # the exercise a pseudo-terminal and validate the password on it first, so + # every sudo underneath shares that terminal's credential. + if ! OMARCHY_ACCEPTANCE_SUDO_PASSWORD="$OMARCHY_ACCEPTANCE_SUDO_PASSWORD" \ + OMARCHY_ACCEPTANCE_SSHD_KEY="$(cat "$key_file.pub")" SHELL=/bin/bash \ + script -qec 'printf "%s\n" "$OMARCHY_ACCEPTANCE_SUDO_PASSWORD" | sudo -S -v 2>/dev/null && + omarchy-setup-security-sshd --key="$OMARCHY_ACCEPTANCE_SSHD_KEY"' /dev/null \ + "$ARTIFACTS/setup-security-sshd.log" 2>&1; then fail "omarchy-setup-security-sshd completes unattended" "$(tail -5 "$ARTIFACTS/setup-security-sshd.log")" fi pass "omarchy-setup-security-sshd completes unattended"