wolfsshd: remove the temp config dir on exit

The exit teardown stops the shared daemon before sweeping the registry.
stop_wolfsshd is what removes the per-daemon temp directory, which
holds the rewritten config and root-owned copies of the trust anchors,
and it is idempotent, so a run that stopped already is unaffected.

- a run that exits early, on a daemon that will not start or on a
  failed test, reaches no stop of its own and left the directory in
  /tmp with a copy of the host key in it
pull/1256/head
John Safranek 2026-09-16 15:49:05 -07:00
parent 0efb0174b2
commit 997cda9b7c
1 changed files with 5 additions and 0 deletions

View File

@ -142,6 +142,11 @@ export WOLFSSHD_TEST_PIDFILE
# script's exit status, which would turn a passing run red.
run_teardown() {
if [ "$USING_LOCAL_HOST" == 1 ]; then
# Before the sweep, and idempotent: this is what removes $SSHD_KEYDIR,
# the temp dir holding the rewritten config and the root-owned copies
# of the trust anchors. The early exits -- a daemon that will not
# start, a failed test -- never reach a stop of their own.
stop_wolfsshd || true
stop_all_wolfsshd || true
fi
rm -f "$WOLFSSHD_TEST_PIDFILE" || true