You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TestPasswordSecurity fails with an empty passwordauthentication value on OpenSSH 10.x/socket-activated SSH on Ubuntu 26.10 Stonking Stingray #625
TestPasswordSecurity (in test_suites/security/image_security_test.go) fails on Ubuntu 26.10 images (with OpenSSH 10.3p1, socket-activated ssh.socket) even though the image's sshd config is all fine. The failure message reports that there's an empty value rather than a bad one:
image_security_test.go:152: sshd passwordauthentication setting is "", want "passwordauthencation no"
Environment
Test suite: security / TestPasswordSecurity → verifySSHConfig
Saw using CIT tag 20260826.00 (but the code path is the same through to the current main branch)
What's happening
verifySSHConfig parses the sshd -T output with:
passwordauthentication[ \t]+[a-zA-Z]+\r?\n
and tries to compare the whole matched line. When sshd -T exits 0 but returns incomplete output (i.e. the passwordauthentication line absent), regexp.Find returns nil, which gets stringy-fied to "" and then the test reports "".
Evidence the image is actually okay
$ sudo sshd -T | grep -i passwordauth
passwordauthentication no
Running the exact same test regex against the healthy sshd -T output matches fine (passwordauthentication no\n), i.e. on a "settled" system the test passes. I think the failure is from a transient/incomplete sshd -T result on the image's first boot (socket-activated ssh defers initialisation as opposed to the old always-on sshd.service)
N.B: when sshd -T legit can't start (i.e. sshd: no hostkeys available -- exiting.) it exits 1 with an empty stdout, so .Output() returns an error (that path's a different but also-slightly-unhelpful message and stderr isn't currently kept)
Expected behavior
A missing key in sshd -T output (incomplete result) should produce a distinct error and not be silently compared against ""
A genuine sshd -T failure should surface the stderr (e.g. that "no hostkeys" message above)
Proposed fix
I'll link a PR when it's ready 🫡
Open questions
If the incomplete sshd -T output at early boot really is a race on socket-activated ssh the suite would probably benefit from a wait on ssh readiness and/or retry the sshd -T call
Workaround
For now we're skipping the TestPasswordSecurity test on Stonking 26.10 images, will revert back to running it when the PR is merged and/or another fix lands
Activity