Repository navigation
fix(ssh): accept a provisioned key while root is still locked - #700
Conversation
Root ships locked ("!unprovisioned"). Ignition users entries and the
ssh.authorized_keys.root credential install a key without touching the
password, so root stays locked, and sshd without PAM refuses a locked
account even for keys ("User root not allowed because account is
locked"). The documented ssh root@<node> path was refused on netboot,
Booty and credential-provisioned nodes.
UsePAM yes hands the account check to FSDK's /etc/pam.d/sshd, which
ignores the password field. PasswordAuthentication and
KbdInteractiveAuthentication stay off, so PAM is never asked for a
password.
The dogfood SSH login no longer unlocks root first, and asserts root is
still locked when the key login succeeds.
Assisted-by: Claude via Claude Code
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Needs approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Summary: This change lets a server accept a login with an SSH key even while the administrator account (root) still has no password, which is how most nodes are set up. I found no problems that block it. One side effect is worth knowing: locking an account's password no longer stops that account from logging in with a key.
security (info, FYI)
files/os/ssh/sshd_config.d/bluefin-server.conf:17: withUsePAM yes, sshd no longer checks the!lock in shadow. FSDK's/etc/pam.d/sshdusespassword-auth, whose account stack ispam_unix.so(expiry only). Sopasswd -l <user>stops blocking key logins for every account, not only root. That matches Fedora/RHEL and is what the PR wants. Operators who usedpasswd -lto turn off SSH must now removeauthorized_keysor expire the account (usermod -e 1). No password path opens:PasswordAuthentication noandKbdInteractiveAuthentication no(lines 10-11) keep the PAM auth stack out.
What I checked
files/os/ssh/sshd_configholds only theInclude, so the drop-in'sUsePAM yesapplies.- FSDK's
sshdandpassword-authstacks have nopam_motd. That means no second banner, so the comments that now namePrintMotdare accurate. scripts/dogfood-installer.sh:880/:1117: step 6 runs only in unattended mode. That mode gives root!*(line 573), sopasswd -SreportsL. Console mode, which sets a real root password, exits before step 6 (line 1060).
Limits: build, image-check and boot-test were skipped at 845a133. Neither the image build nor the dogfood SSH check ran, so the new step-6 check has not run yet.
No findings from: correctness, intent-alignment, style, docs-currency.
Confidence: 5/5 (safe)
-- hive: agent=reviewer backend=claude model=claude-opus-5-5 effort=medium claude=2.1.327
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Ready for a human merge: verdict approved The hive never approves on your behalf: approve and merge it on GitHub if you accept it. |
Summary: Root ships locked, and giving root an SSH key through Ignition or the
ssh.authorized_keys.rootcredential leaves it locked. The image's sshd ran without PAM, and sshd without PAM refuses a locked account even when the key is correct. So the documentedssh root@<node>login failed on network-booted, Booty-provisioned and credential-provisioned nodes. USB installs only got around it because the first-boot root password prompt unlocks root. This turns PAM on for sshd. Password logins stay off.Why
files/os/ssh/sshd_configreplaces FSDK's copy. FSDK's own copy hasUsePAM yes(itsopenssh.bstseds it in), but ours has only theInclude, so sshd fell back toUsePAM no. Root's shadow entry is!unprovisioned(elements/oci/bluefin-server-usr.bst), and Ignition 2.27 sets a password on an existing user only whenpasswordHashis given. The homelab templates, Booty'sbluefin-node.ignand the credential path all give root a key and nothing else.The repo already knew about this: the dogfood SSH check ran
usermod -p '*' rootfirst because "sshd refuses a locked root even for keys". That hid the problem from CI.I reproduced it with OpenSSH in a Fedora 44 container, with root set to
!unprovisionedand the image's auth settings:What changes
files/os/ssh/sshd_config.d/bluefin-server.conf:UsePAM yes. FSDK ships/etc/pam.d/sshdand itspassword-authstack (both are in the image's factory/etc).PasswordAuthentication noandKbdInteractiveAuthentication nostay, so PAM is never asked for a password. It only runs the account and session stacks.scripts/dogfood-installer.sh: the step-6 SSH login no longer unlocks root. It recordspasswd -S rootand fails unless root was still locked (L) when the key login worked.PrintMotd(the motd behaviour they describe is unchanged), and theusb-installer.mdnote on*versus!*is corrected.This is in the sshd drop-in, which is factory
/etc, so it reaches new and diskless nodes. Installed nodes that already have/etc/ssh/sshd_config.d/bluefin-server.confkeep their copy. A separate PR moves the vendor sshd, sysctl and journald config out of factory/etc.Tests
tests/unit/test_root_credential_contract.py::test_sshd_accepts_keys_for_a_root_that_has_no_passwordfails without the change and passes with it.pytest -n auto: 1878 passed, 3 skipped.just validate: passes.python3 .github/scripts/docs-checks.py: passes.dogfood-installerstep-6 check needs afull-buildrun.🤖 Generated with Claude Code