Skip to content

Commit 25a9664

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 27948c5 commit 25a9664

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
@@ -57,3 +57,23 @@ def vm():
5757
# If this blocks then we have a problem. Better to hang than build up
5858
# excess qemu processes that won't die.
5959
child.wait()
60+
61+
62+
def test_password_reset_required(vm):
63+
"""On first login, there should be a mandatory reset password flow"""
64+
# https://github.com/qualcomm-linux/qcom-deb-images/issues/69
65+
66+
# This takes about a minute on a ThinkPad T14s Gen 6 Snapdragon
67+
vm.expect_exact("debian login:", timeout=120)
68+
69+
vm.send("debian\r\n")
70+
vm.expect_exact("Password:")
71+
vm.send("debian\r\n")
72+
vm.expect_exact("You are required to change your password immediately")
73+
vm.expect_exact("Current password:")
74+
vm.send("debian\r\n")
75+
vm.expect_exact("New password:")
76+
vm.send("new password\r\n")
77+
vm.expect_exact("Retype new password:")
78+
vm.send("new password\r\n")
79+
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
@@ -80,9 +80,10 @@ actions:
8080
# some of these groups are only needed for desktop scenarios
8181
useradd --create-home --shell /bin/bash --user-group \
8282
--groups adm,video,users,sudo debian
83-
# password must be changed on first login; set it to "debian"
84-
chage --lastday 0 debian
83+
# set password to "debian"
8584
echo debian:debian | chpasswd
85+
# password must be changed on first login
86+
chage --lastday 0 debian
8687
# add to sudoers
8788
mkdir -v --mode 755 --parents /etc/sudoers.d
8889
# subshell to override umask

0 commit comments

Comments
 (0)