openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Update phosphor-defaults with stronger root password hash algorithm
@ 2021-07-01 14:42 Joseph Reynolds
  0 siblings, 0 replies; only message in thread
From: Joseph Reynolds @ 2021-07-01 14:42 UTC (permalink / raw)
  To: openbmc

OpenBMC Community,

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.

- Joseph


Details:

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 
new value.

Closely related: the [Replace deprecated Linux-PAM modules][] gerrit review.

References:
[libpam_1.5.1 changes]: 
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/41294
[phosphor-defaults.inc]: 
https://github.com/openbmc/openbmc/blob/1a977b269ed437bebb9ae7810e3157746ec9174d/meta-phosphor/conf/distro/include/phosphor-defaults.inc#L245 

[wikipedia passwd entry]: https://en.wikipedia.org/wiki/Passwd
[pam_unix.so module]: 
https://github.com/linux-pam/linux-pam/tree/master/modules/pam_unix
[Replace deprecated Linux-PAM modules]: 
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/41357



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-01 14:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 14:42 Update phosphor-defaults with stronger root password hash algorithm Joseph Reynolds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).