Skip to content

Commit c27b221

Browse files
committed
debos: rootfs: fix password reset requirement
Existing code arranges to set up an initial well-known password but with a requirement to reset it on first login. This wasn't working because the well-known password was being set after expiring the "old" password, meaning that it was being treated as having been reset immediately. Instead, ensure to expire the password _after_ setting it. Fixes: #69 Signed-off-by: Robie Basak <[email protected]>
1 parent a19da21 commit c27b221

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

ci/qemu_test.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,23 @@ def vm():
6060
# If this blocks then we have a problem. Better to hang than build up
6161
# excess qemu processes that won't die.
6262
child.wait()
63+
64+
65+
def test_password_reset_required(vm):
66+
"""On first login, there should be a mandatory reset password flow"""
67+
# https://github.com/qualcomm-linux/qcom-deb-images/issues/69
68+
69+
# This takes a minute or two on a ThinkPad T14s Gen 6 Snapdragon
70+
vm.expect_exact("debian login:", timeout=240)
71+
72+
vm.send("debian\r\n")
73+
vm.expect_exact("Password:")
74+
vm.send("debian\r\n")
75+
vm.expect_exact("You are required to change your password immediately")
76+
vm.expect_exact("Current password:")
77+
vm.send("debian\r\n")
78+
vm.expect_exact("New password:")
79+
vm.send("new password\r\n")
80+
vm.expect_exact("Retype new password:")
81+
vm.send("new password\r\n")
82+
vm.expect_exact("debian@debian:~$")

debos-recipes/qualcomm-linux-debian-rootfs.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ actions:
119119
# session has not updated ACLs to the device nodes
120120
useradd --create-home --shell /bin/bash --user-group \
121121
--groups adm,audio,render,sudo,users,video debian
122-
# password must be changed on first login; set it to "debian"
123-
chage --lastday 0 debian
122+
# set password to "debian"
124123
echo debian:debian | chpasswd
124+
# password must be changed on first login
125+
chage --lastday 0 debian
125126
# add to sudoers
126127
mkdir -v --mode 755 --parents /etc/sudoers.d
127128
# subshell to override umask

0 commit comments

Comments
 (0)