Skip to content

Commit 17dc094

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 1a89400 commit 17dc094

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 about a minute on a ThinkPad T14s Gen 6 Snapdragon
70+
vm.expect_exact("debian login:", timeout=120)
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
@@ -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)