Skip to content

fix(e2e): prevent VM login password aging lockouts - #758

Merged
vladimirrott merged 1 commit into
lacs-project:mainfrom
QinXi-ai:fix/736-vm-password-aging
Nov 4, 2026
Merged

vladimirrott merged 1 commit into
lacs-project:mainfrom
QinXi-ai:fix/736-vm-password-aging

Conversation

@QinXi-ai

@QinXi-ai QinXi-ai commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

An aging test can leave the VM login account usable for weeks and then lock out SSH key authentication. The harness now recognizes the PAM password-expiry failure and points to overlay recovery. Before a clean shutdown, it checks the login user's shadow aging fields and resets risky settings so they do not enter the next snapshot. Lookup or reset failures stop shutdown with an explicit error.

The bootstrap test now sources the harness and exercises it with SSH/nc stubs, including reset-before-poweroff ordering, unchanged safe accounts, custom login users, and keeping the password field out of logs. The VM guide documents prevention and recovery.

Validation:

  • 14 behavioral cases in ubuntu-vm-bootstrap.test.sh passed.
  • Six mutations were caught: removing the expiry diagnostic, omitting the reset, resetting unconditionally, dropping the stop hook, and ignoring either forced password changes or account expiry.
  • ShellCheck, vm-env-secrets.test.sh, vm-sync-parity.test.sh, multi-vm-smoke.test.sh, and check_evidence_claims.py passed.

Closes #736.

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 3ade56ee.

You wired reset_login_password_aging into cmd_stop ahead of the poweroff, so a test that touches the login user's aging can no longer ride into the next snapshot, and you made the lookup fail closed instead of guessing. The BASH_SOURCE guard on the dispatch also turned a grep-only contract test into fourteen behavioural cases, which this harness has wanted for a long time.

I ran your test and five mutants of tests/e2e/ubuntu-vm.sh in a container (ubuntu:24.04, no network):

pristine                                     14 PASS, rc=0
m1  drop reset_login_password_aging from cmd_stop   FAIL reset_precedes_poweroff, lookup_failure_prevents_poweroff,
                                                    reset_failure_prevents_poweroff, malformed_aging_prevents_poweroff  rc=1
m2  drop the "password has expired" branch          FAIL expired_password_diagnostic  rc=1
m3  reset unconditionally (if true || ...)          FAIL safe_aging_is_unchanged, disabled_aging_is_unchanged  rc=1
m4  drop the max_days < 99999 condition             FAIL finite_max_is_reset, reset_precedes_poweroff,
                                                    reset_failure_prevents_poweroff, custom_login_user  rc=1
m5  main's ubuntu-vm.sh under your test             all 14 FAIL  rc=1

vm-env-secrets, vm-sync-parity and multi-vm-smoke pass on your tree as on main, and shellcheck --severity=warning on both scripts is clean. The merge gate observed m1 on its own: receipt recorded for #758 at 3ade56ee (observed: clean pass, mutated fail).

One optional item, nothing blocking. I drove stop against a stub VM whose login password has already expired:

main: WARNING: SSH poweroff command exited with status 255. The VM may still be running.
      QEMU process is still alive; keeping PID file at .../vm.pid for recovery.
      VM stopped.                                   stop rc=0
#758: ERROR: Could not read password aging for login user 'ubuntu'; refusing to power off with unchecked aging.
                                                    stop rc=1

Your rc=1 is more honest than main's "VM stopped". A reader of that error still has to find the troubleshooting section to learn the next step is killing QEMU. If you want, the die could name the pid file the way the 60s timeout message does (kill $(cat "$PID_FILE")). Fine as a follow-up or not at all.

I'm merging this through the gate now and have assigned #736 to you. When you want another, #652 (check_test_reachability counts a step disabled with if: false as running its test) sits close to the CI guard work you did in #427 and #454.

@vladimirrott
vladimirrott merged commit d68b139 into lacs-project:main Nov 4, 2026
14 checks passed
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.

ubuntu-vm.sh: password aging on the login user locks the harness out of its VM weeks later

2 participants