Update phosphor-defaults with stronger root password hash algorithm
jrey at linux.ibm.com
Fri Jul 2 00:42:54 AEST 2021
Testing the [libpam_1.5.1 changes] revealed a limitation with the old
MD5 hash algorithm used to encode OpenBMC's root password. The fix is
to change phosphor-defaults to use an acceptable hash algorithm such as
SHA-512. We can keep the same password so our testing tools continue to
work. Details are below. I plan to push a fix for this.
OpenBMC provisions the BMC firmware image with the root account password
in a form which is no longer acceptable to Linux-PAM version 1.5.1.
Specifically, [phosphor-defaults.inc] sets the password hash into
/etc/shadow as "\$1\$UGMqyqdG\$FZiylVFmRRfl9Z0Ue8G7e/", where $1
indicates the old weak MD5 hash algorithm. Ref: [wikipedia passwd
entry]. Beginning around PAM version 1.5.1, when you log in, the
[pam_unix.so module] authenticates okay but requires the password to
be changed. (For example, you'll get a message like "You are required
to change your password immediately (administrator enforced)." This
behavior is undesirable for the OpenBMC project defaults, and is not
tolerated by the project's current continuous integration tools.) Note
the new password is stored using the SHA-512 algorithm. Thanks to Noah
Brewer for debugging this issue.
This has an easy fix: use the same password with an updated hash
algorithm. Specifically, update the password hash supplied in
phosphor-defaults.inc to use the same password as before but encoded
with the SHA-512 algorithm. An acceptable hash can be provided by the
`openssl passwd -6 0penBmc` command. This change ought to be
transparent, forward and backward compatible. This change is also a
prerequisite for going to libpam_1.5.1 (presuming you don't want to
force users to change their password the first time they login).
Note various meta-layers use this same old hash string in
conf/local.conf.sample files. They should consider updating to match the
Closely related: the [Replace deprecated Linux-PAM modules] gerrit review.
[wikipedia passwd entry]: https://en.wikipedia.org/wiki/Passwd
[Replace deprecated Linux-PAM modules]:
More information about the openbmc