fix(test): prevent fixture password expiry after baseline restore
This commit is contained in:
1 parent
34274f0f62
commit
14cb3570c1
3 files changed
+32
No files matched your search
@@ -41,6 +41,14 @@ reads the same value for both accounts from:
|
|||||||
/home/cabbage/.local/share/rvbox-secrets/rvbox-win10-test.password
|
/home/cabbage/.local/share/rvbox-secrets/rvbox-win10-test.password
|
||||||
```
|
```
|
||||||
|
|
||||||
|
After every baseline restore, `test-host prepare` uses the fixture Administrator
|
||||||
|
to mark these two accounts' passwords as non-expiring before normal-user
|
||||||
|
Guest Control checks. Restoring a snapshot retains its old password-set date;
|
||||||
|
the original `rvboxtest` password expired on 2026-10-18 even though the VM was
|
||||||
|
clean. This per-run repair preserves the fixed password, account enablement,
|
||||||
|
other users, and machine-wide password policy. It does not log Administrator
|
||||||
|
into an interactive session or modify any retained snapshot.
|
||||||
|
|
||||||
The file must be mode `0600` and is supplied to VirtualBox only with
|
The file must be mode `0600` and is supplied to VirtualBox only with
|
||||||
`--passwordfile`; the controller never places it on a command line, run
|
`--passwordfile`; the controller never places it on a command line, run
|
||||||
manifest, log, or artifact. The SSH key and the Helium host account credential
|
manifest, log, or artifact. The SSH key and the Helium host account credential
|
||||||
|
|||||||
@@ -351,6 +351,18 @@ configure_display_keepalive() {
|
|||||||
fail "fixture provisioner could not disable disposable display/sleep timers"
|
fail "fixture provisioner could not disable disposable display/sleep timers"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure_fixture_password_expiry() {
|
||||||
|
# Snapshot restore preserves PasswordLastSet, not the wall clock. The
|
||||||
|
# fixed test credential can therefore expire long after a clean capture.
|
||||||
|
# Keep both recorded fixture accounts reusable without changing passwords,
|
||||||
|
# enabling accounts, or weakening the machine-wide password policy.
|
||||||
|
account_check=$(printf '$ErrorActionPreference="Stop"; $ProgressPreference="SilentlyContinue"; foreach ($name in @("%s","%s")) { Set-LocalUser -Name $name -PasswordNeverExpires $true; if ((Get-LocalUser -Name $name).PasswordExpires) { throw "Fixture password still expires" } }; Write-Output RVBOX_GUEST_OK' "$guest_user" "$provisioner_user")
|
||||||
|
account_encoded=$(printf '%s' "$account_check" | iconv -f UTF-8 -t UTF-16LE | base64 -w 0)
|
||||||
|
provisioner_run --exe 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' --wait-stdout --wait-stderr --unquoted-args -- \
|
||||||
|
-NoProfile -NonInteractive -EncodedCommand "$account_encoded" >/dev/null || \
|
||||||
|
fail "fixture provisioner could not disable fixture-account password expiration"
|
||||||
|
}
|
||||||
|
|
||||||
assert_mouse_bypassed() {
|
assert_mouse_bypassed() {
|
||||||
# Read-only guard for the canonical USB-tablet baseline. An additions
|
# Read-only guard for the canonical USB-tablet baseline. An additions
|
||||||
# reinstall may re-register VBoxMouse; fail visibly instead of silently
|
# reinstall may re-register VBoxMouse; fail visibly instead of silently
|
||||||
@@ -420,6 +432,8 @@ case "$action" in
|
|||||||
step prepare-guest-additions-ready
|
step prepare-guest-additions-ready
|
||||||
configure_display_keepalive
|
configure_display_keepalive
|
||||||
step prepare-display-keepalive
|
step prepare-display-keepalive
|
||||||
|
configure_fixture_password_expiry
|
||||||
|
step prepare-fixture-password-expiry
|
||||||
assert_clean_guest
|
assert_clean_guest
|
||||||
# Retained pre-workaround snapshots fail this guard until explicitly
|
# Retained pre-workaround snapshots fail this guard until explicitly
|
||||||
# repaired; never report a prepared fixture with the bad path revived.
|
# repaired; never report a prepared fixture with the bad path revived.
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ func TestNativeFixtureAssets_HP_HARNESS_20(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
testHost := read("scripts/windows/test-host")
|
testHost := read("scripts/windows/test-host")
|
||||||
|
for _, required := range []string{"configure_fixture_password_expiry", "Set-LocalUser -Name $name -PasswordNeverExpires $true", "prepare-fixture-password-expiry", "Fixture password still expires"} {
|
||||||
|
if !strings.Contains(testHost, required) {
|
||||||
|
t.Fatalf("native test-host is missing fixed fixture credential contract %q", required)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expiryStep := strings.Index(testHost, " step prepare-fixture-password-expiry")
|
||||||
|
cleanStep := strings.Index(testHost, " assert_clean_guest\n")
|
||||||
|
if expiryStep < 0 || cleanStep < expiryStep {
|
||||||
|
t.Fatal("fixture password expiration must be disabled before normal-user cleanliness checks")
|
||||||
|
}
|
||||||
for _, required := range []string{"xz -T0 -3", "accelerated_stage", "copy_stage_file", "--proxy", "--anyauth", "--continue-at", "rvbox.exe.xz", "retry_limit=4", "ConnectTimeout=10", "bundle transfer did not reach the expected SHA-256 manifest", "verified transfer_sha256", "reset-force-poweroff", "$run_root/.accelerated-stage.XXXXXX", "service-startup.log", "test-logs/rvbox.log"} {
|
for _, required := range []string{"xz -T0 -3", "accelerated_stage", "copy_stage_file", "--proxy", "--anyauth", "--continue-at", "rvbox.exe.xz", "retry_limit=4", "ConnectTimeout=10", "bundle transfer did not reach the expected SHA-256 manifest", "verified transfer_sha256", "reset-force-poweroff", "$run_root/.accelerated-stage.XXXXXX", "service-startup.log", "test-logs/rvbox.log"} {
|
||||||
if !strings.Contains(testHost, required) {
|
if !strings.Contains(testHost, required) {
|
||||||
t.Fatalf("native test-host is missing compressed transfer contract %q", required)
|
t.Fatalf("native test-host is missing compressed transfer contract %q", required)
|
||||||
|
|||||||
Reference in new issue
Block a user