xref: /openbmc/docs/designs/expired-password.md (revision 67032dffe31f98a8638927f74a7a35990d6a1fbc)
18d29479fSJoseph Reynolds# Initial expired passwords
28d29479fSJoseph Reynolds
3f4febd00SPatrick WilliamsAuthor: Joseph Reynolds <josephreynolds1>
48d29479fSJoseph Reynolds
5f4febd00SPatrick WilliamsOther contributors: None
68d29479fSJoseph Reynolds
7f4febd00SPatrick WilliamsCreated: 2019-07-24
88d29479fSJoseph Reynolds
98d29479fSJoseph Reynolds## Problem Description
10f4febd00SPatrick Williams
11f4febd00SPatrick WilliamsOpenBMC has a default password, connects to the network via DHCP, and does not
12f4febd00SPatrick Williamshave a mechanism to require administrators to change the BMC's password. This
13f4febd00SPatrick Williamsmay lead to BMCs which have default passwords being on the network for long time
14f4febd00SPatrick Williamsperiods, effectively giving unrestricted access to the BMC.
158d29479fSJoseph Reynolds
168d29479fSJoseph Reynolds## Background and References
178d29479fSJoseph Reynolds
18f4febd00SPatrick WilliamsVarious computer systems ship with default userid and passwords and require the
19f4febd00SPatrick Williamspassword be changed on the initial signon. This reduces the time window when the
20f4febd00SPatrick Williamssystem is accessible with a default password.
21f4febd00SPatrick Williams
22f4febd00SPatrick WilliamsVarious BMC interfaces require authentication before access is granted. The
23f4febd00SPatrick Williamsauthentication and account validation steps typically result in outcomes like
24f4febd00SPatrick Williamsthis:
25f4febd00SPatrick Williams
26f4febd00SPatrick Williams1. Success, when the access credentials (such as username and password) are
27f4febd00SPatrick Williams   correct and the account being accessed is valid.
28f4febd00SPatrick Williams2. Failure, when either the access credentials are invalid or the account being
29f4febd00SPatrick Williams   accessed is invalid. For example, the account itself (not merely its
30f4febd00SPatrick Williams   password) may be expired.
31f4febd00SPatrick Williams3. PasswordChangeRequired, when the access credentials are correct and the
32f4febd00SPatrick Williams   account is valid except the account's password is expired (such as indicated
33f4febd00SPatrick Williams   by PAM_CHANGE_EXPIRED_AUTHTOK).
348d29479fSJoseph Reynolds
358d29479fSJoseph ReynoldsOpenBMC currently implements the first two outcomes; it treats
36f4febd00SPatrick WilliamsPasswordChangeRequired the same as an account that is invalid for any other
37f4febd00SPatrick Williamsreason. Some servers (such as the OpenSSH server) handle the
388d29479fSJoseph ReynoldsPasswordChangeRequired by implementing a "password change dialog".
398d29479fSJoseph Reynolds
40*67032dffSPeter DelevoryasThe [Redfish Specification version 1.7.0][] section 13.2.6.1 ("Password change
41*67032dffSPeter Delevoryasrequired handling") provides the ManagerAccount resource v1.3 with a
42*67032dffSPeter DelevoryasPasswordChangeRequired property which supports a password change dialog.
438d29479fSJoseph Reynolds
44f4febd00SPatrick Williams[redfish specification version 1.7.0]:
45f4febd00SPatrick Williams  https://www.dmtf.org/sites/default/files/standards/documents/DSP0266_1.7.0.pdf
468d29479fSJoseph Reynolds
47f4febd00SPatrick WilliamsNote the terminology: An "expired password" is a special case of "password
48f4febd00SPatrick Williamschange required".
498d29479fSJoseph Reynolds
508d29479fSJoseph ReynoldsThe meaning of the term "access" varies by context. It could mean:
51f4febd00SPatrick Williams
528d29479fSJoseph Reynolds1.  Access to the BMC's network interfaces.
53f4febd00SPatrick Williams2.  Access to the BMC's authentication mechanisms together with correct
54f4febd00SPatrick Williams    credentials, whether or not those credentials have expired and must be
55f4febd00SPatrick Williams    changed.
56f4febd00SPatrick Williams3.  Access to the BMC's function via an authenticated interface, for example,
57f4febd00SPatrick Williams    such as establishing a session after you've changed your initial password.
58f4febd00SPatrick Williams4.  Access to the BMC's function via an unauthenticated interface such as host
59f4febd00SPatrick Williams    IPMI or physical control panel (example: power button).
608d29479fSJoseph Reynolds
618d29479fSJoseph ReynoldsThis design uses meanings 3 and 4 except where indicated.
628d29479fSJoseph Reynolds
638d29479fSJoseph Reynolds## Requirements
64f4febd00SPatrick Williams
658d29479fSJoseph ReynoldsThe requirements are:
66f4febd00SPatrick Williams
67f4febd00SPatrick Williams- The BMC's initial password must be expired when the new EXPIRED_PASSWORD image
68f4febd00SPatrick Williams  feature is used.
69f4febd00SPatrick Williams- An account with an expired password must not be allowed to use the BMC (except
70f4febd00SPatrick Williams  to change the password).
71f4febd00SPatrick Williams- There must be a way to change the expired password using a supported
72f4febd00SPatrick Williams  interface.
738d29479fSJoseph Reynolds
748d29479fSJoseph ReynoldsThe use case is:
75f4febd00SPatrick Williams
76f4febd00SPatrick Williams- The BMC automatically connects to its management network which offers
77f4febd00SPatrick Williams  administrative or operational interfaces (whether or not the BMC is normally
78f4febd00SPatrick Williams  operated via its host).
798d29479fSJoseph Reynolds- The BMC is operated from its management network.
808d29479fSJoseph Reynolds
818d29479fSJoseph ReynoldsPreconditions for the BMC include:
82f4febd00SPatrick Williams
838d29479fSJoseph Reynolds- The BMC has at least one account with a default password built in.
84f4febd00SPatrick Williams- The BMC can update the password; for example, the `/etc/passwd` file is
85f4febd00SPatrick Williams  writeable.
868d29479fSJoseph Reynolds
878d29479fSJoseph Reynolds## Proposed Design
88f4febd00SPatrick Williams
898d29479fSJoseph ReynoldsThis design has three main parts:
908d29479fSJoseph Reynolds
91f4febd00SPatrick Williams1. There is a new image feature EXPIRED_PASSWORD. When EXPIRED_PASSWORD is
92f4febd00SPatrick Williams   enabled, the BMC's default password will initially be expired as if via the
93f4febd00SPatrick Williams   `passwd --expire root` command. This administratively expires the password
94f4febd00SPatrick Williams   and is not based on time. An account with an expired password is neither
95f4febd00SPatrick Williams   locked nor disabled.
968d29479fSJoseph Reynolds
97f4febd00SPatrick Williams   This feature is intended to be enabled by default, with a staging plan: the
98f4febd00SPatrick Williams   feature will be disabled to give time for the continuous integration (CI) and
99f4febd00SPatrick Williams   test automation efforts to adapt, then enabled for the overall project.
1008d29479fSJoseph Reynolds
101f4febd00SPatrick Williams2. The BMC's network interfaces (such as REST APIs, SSH, and IPMI) disallow
102f4febd00SPatrick Williams   access via an account which has an expired password. If the access
103f4febd00SPatrick Williams   credentials are otherwise correct and the reason for the authentication
104f4febd00SPatrick Williams   failure is an expired password (determined by the usual Linux practices),
105f4febd00SPatrick Williams   where possible, the interface should indicate the password is expired and how
106f4febd00SPatrick Williams   to change it (see below). Otherwise the usual security protocols apply
107f4febd00SPatrick Williams   (giving no additional information).
1088d29479fSJoseph Reynolds
109f4febd00SPatrick Williams   The `/login` URI is enhanced. If it is used with correct credentials (userid
110f4febd00SPatrick Williams   and password) and the password needs to be changed the request will fail to
111f4febd00SPatrick Williams   create a session and indicate a password change is needed. If it is used with
112f4febd00SPatrick Williams   correct userid and incorrect password, or with an incorrect userid, the
113f4febd00SPatrick Williams   behavior must not change. Note the `/login` URI is deprecated.
1148d29479fSJoseph Reynolds
1158d29479fSJoseph Reynolds   The '/redfish/v1/SessionService/Sessions/<session>' and
116f4febd00SPatrick Williams   '/redfish/v1/AccountService/Accounts/<account>' resources are enhanced to
117f4febd00SPatrick Williams   indicate PasswordChangeRequired per the Redfish spec.
1188d29479fSJoseph Reynolds
119f4febd00SPatrick Williams   The `ipmitool` command treats an expired password the same as an invalid
120f4febd00SPatrick Williams   password. Note the RMCP+ standard, such as used for the BMC's network IPMI
121f4febd00SPatrick Williams   interface, does not support changing the password when establishing a
122f4febd00SPatrick Williams   session. The ipmitool is not being enhanced by this design.
1238d29479fSJoseph Reynolds
124f4febd00SPatrick Williams   The Secure Shell access (via the `ssh` command) already correctly indicates
125f4febd00SPatrick Williams   when the password is expired. No change is needed. But see the next bullet
126f4febd00SPatrick Williams   for the expired password dialog.
1278d29479fSJoseph Reynolds
128f4febd00SPatrick Williams3. There is a way for an account owner to change their own expired password.
129f4febd00SPatrick Williams   This can be either from a network-facing or in-band password changing
130f4febd00SPatrick Williams   protocol. For example:
131f4febd00SPatrick Williams   - Redfish: This design adds the Redfish PasswordChangeRequired handling to
132f4febd00SPatrick Williams     BMCWeb. See below for details.
133f4febd00SPatrick Williams   - SSH server: The SSH servers may have an expired password change dialog. For
134f4febd00SPatrick Williams     example, OpenSSH implement this feature. However, the Dropbear SSH server
135f4febd00SPatrick Williams     announces the password is expired, but does not implement the dialog to
136f4febd00SPatrick Williams     change it.
137f4febd00SPatrick Williams   - Access via the BMC's host: for example, via the
138f4febd00SPatrick Williams     `ipmitool user set password` command when accessed in-band.
1398d29479fSJoseph Reynolds
140f4febd00SPatrick WilliamsWhen Redfish creates a session with PasswordChangeRequired, every response
141f4febd00SPatrick Williamscontains a PasswordChangeRequired message. The session effectively has only the
142f4febd00SPatrick WilliamsConfigureSelf privilege which allows it to only change the password and
143f4febd00SPatrick Williamsterminate the session. The usage pattern is:
144f4febd00SPatrick Williams
1458d29479fSJoseph Reynolds1.  Create a session.
1468d29479fSJoseph Reynolds2.  If the PasswordChangeRequired message is present:
1478d29479fSJoseph Reynolds    1.  PATCH the new password into the ManagerAccount object.
148f4febd00SPatrick Williams    2.  Any other use of the session will get HTTP status code 403 Forbidden.
1498d29479fSJoseph Reynolds    3.  DELETE the Session object to terminate the session.
1508d29479fSJoseph Reynolds    4.  Create a new session and continue.
1518d29479fSJoseph Reynolds
152f4febd00SPatrick WilliamsThis design is intended to cover any cause of expired password, including both
153f4febd00SPatrick Williamsthe BMC's initial expired password and password expired for another cause such
154f4febd00SPatrick Williamsas aging or via the `passwd --expire` command.
1558d29479fSJoseph Reynolds
156d8e8237dSGunnar MillsThis design is intended to enable the webui-vue web application to implement a
157d8e8237dSGunnar Millspassword change dialog for the signon screen.
1588d29479fSJoseph Reynolds
1598d29479fSJoseph ReynoldsPer the above design, when the web app uses either `/login` or
160f4febd00SPatrick Williams`/redfish/v1/SessionService` to establish a session and the account has an
161f4febd00SPatrick Williamsexpired password:
162f4febd00SPatrick Williams
163f4febd00SPatrick Williams- If the `/login` URI was used, the HTTP response indicates the password must be
164f4febd00SPatrick Williams  changed, and will not establish a session. In this case, the web app must use
165f4febd00SPatrick Williams  the Redfish API to establish a session.
166f4febd00SPatrick Williams- POST to `/redfish/v1/SessionService/Sessions` will establish a session which
167f4febd00SPatrick Williams  will have the PasswordChangeRequired message.
168f4febd00SPatrick Williams- At this point the web app can display a message that the password is expired
169f4febd00SPatrick Williams  and must be changed, then get the new password.
170f4febd00SPatrick Williams- PATCH the password to the account specified in the PasswordChangeRequired
171f4febd00SPatrick Williams  message.
1728d29479fSJoseph Reynolds- DELETE the Session object to terminate the session.
1738d29479fSJoseph Reynolds- Create a new session and continue.
1748d29479fSJoseph Reynolds
1758d29479fSJoseph Reynolds## Alternatives Considered
176f4febd00SPatrick Williams
1778d29479fSJoseph ReynoldsThe following alternate designs were considered:
178f4febd00SPatrick Williams
179f4febd00SPatrick Williams- Unique password per machine. That approach requires additional effort, for
180f4febd00SPatrick Williams  example, to set and track assigned passwords.
181f4febd00SPatrick Williams- Default to having no users with access to the BMC via its network. When
182f4febd00SPatrick Williams  network access is needed, a technician would create or modify the userid to
183f4febd00SPatrick Williams  have network authority and establish a password at that time. This may be
184f4febd00SPatrick Williams  through the BMC's host system or via the BMC's serial console. That approach
185f4febd00SPatrick Williams  requires the tech to have access, and requires re-provisioning the account
186f4febd00SPatrick Williams  after factory reset
187f4febd00SPatrick Williams- Disable network access by default. That approach requires another BMC access
188f4febd00SPatrick Williams  vector, such as physical access or via the BMC's host, to enable network
1898d29479fSJoseph Reynolds  access.
190f4febd00SPatrick Williams- Provision the BMC with a certificate instead of a password, for example, an
191f4febd00SPatrick Williams  SSH client certificate. That approach suffers from the same limitations as a
192f4febd00SPatrick Williams  default password (when the matching private certificate becomes well known)
193f4febd00SPatrick Williams  and requires the BMC provide SSH access.
194f4febd00SPatrick Williams- Require physical presence to change the password. For example, applying a
195f4febd00SPatrick Williams  jumper, or signing in via a serial cable. That approach is not standard.
196f4febd00SPatrick Williams- Have LDAP (or any authentication/authorization server) configured and have no
197f4febd00SPatrick Williams  local users which have default passwords configured in the BMC firmware image.
198f4febd00SPatrick Williams  That approach requires the customer have an LDAP (or similar) server. Also,
199f4febd00SPatrick Williams  how we can configure the LDAP, as we don't know the customer LDAP server
200f4febd00SPatrick Williams  configuration?
201f4febd00SPatrick Williams- Have a new service to detect if any password has its default value, and write
202f4febd00SPatrick Williams  log messages for that condition, with the idea to alert the system owner of
203f4febd00SPatrick Williams  this condition. That approach doesn't solve the problem and burdens BMC
204f4febd00SPatrick Williams  resources.
2058d29479fSJoseph Reynolds
206f4febd00SPatrick WilliamsWarning. This design may leave the BMC with its default password for an extended
207f4febd00SPatrick Williamsperiod of time if the use case given in the requirements section of this design
208f4febd00SPatrick Williamsdoes not apply. For example, when the host is operated strictly via its power
209f4febd00SPatrick Williamsbutton and not through the BMC's network interface. In this case, the
210f4febd00SPatrick Williamsalternatives listed above may mitigate this risk. Another alternative is a
211f4febd00SPatrick Williamsdesign where the BMC is initially in a provisioning mode which does not allow
212f4febd00SPatrick Williamsthe BMC to operate its host. The idea is that you have to establish access to
213f4febd00SPatrick Williamsthe BMC (which includes changing its password) before you can leave provisioning
214f4febd00SPatrick Williamsmode.
2158d29479fSJoseph Reynolds
216f4febd00SPatrick WilliamsThe BMCWeb Redfish server could be enhanced so that when the Password is
217f4febd00SPatrick Williamssuccessfully patched, the session no longer asserts the PasswordChangeRequired
218f4febd00SPatrick Williamscondition and re-asserts the user's usual authority immediately without
219f4febd00SPatrick Williamsrequiring a new session. This is allowed by the Redfish spec, but was not
220f4febd00SPatrick Williamsimplemented because it would be more difficult to code and test.
2218d29479fSJoseph Reynolds
2228d29479fSJoseph Reynolds## Impacts
2238d29479fSJoseph Reynolds
224f4febd00SPatrick WilliamsHaving to change an expired password is annoying and breaks operational
225f4febd00SPatrick Williamsprocedures and scripts. Documentation, lifecycle review, and test are needed.
226f4febd00SPatrick WilliamsExpect pain when this is enabled.
2278d29479fSJoseph Reynolds
228f4febd00SPatrick WilliamsTo help with this, the [REDFISH-cheatsheet][] will be updated with commands
229f4febd00SPatrick Williamsneeded to detect and change an expired password.
230f4febd00SPatrick Williams
231f4febd00SPatrick Williams[redfish-cheatsheet]:
232f4febd00SPatrick Williams  https://github.com/openbmc/docs/blob/master/REDFISH-cheatsheet.md
2338d29479fSJoseph Reynolds
2348d29479fSJoseph ReynoldsThis design does not affect other policies such as password aging.
2358d29479fSJoseph Reynolds
2368d29479fSJoseph Reynolds## Testing
237f4febd00SPatrick Williams
2388d29479fSJoseph ReynoldsScenarios:
239f4febd00SPatrick Williams
2408d29479fSJoseph Reynolds1. Ensure that when the BMC is in its initial state:
2418d29479fSJoseph Reynolds   - All available network interfaces deny access.
2428d29479fSJoseph Reynolds   - Selected interfaces allow the password to be changed.
243f4febd00SPatrick Williams2. Ensure factory reset resets the password to its initial expired state (repeat
244f4febd00SPatrick Williams   the tests above).
245f4febd00SPatrick Williams3. Ensure the password change is effective for users entering from all supported
246f4febd00SPatrick Williams   interfaces. For example, change the password via the Redfish API, and
247f4febd00SPatrick Williams   validate that the old password does not work and the new password does work
248f4febd00SPatrick Williams   via IPMI for the same user.
249f4febd00SPatrick Williams4. Handle BMC code update scenarios. For example, (A) Ensure code update does
250f4febd00SPatrick Williams   not cause a previously set password to change to default or to expire. (B)
251f4febd00SPatrick Williams   Validate what happens when the BMC has a default password and does code
252f4febd00SPatrick Williams   update to a release which has the default expired password design (this
253f4febd00SPatrick Williams   design).
254f4febd00SPatrick Williams5. Ensure the BMC continues to operate its host, for example, when the BMC is
255f4febd00SPatrick Williams   factory reset while the host is running. Ensure the power button can be used
256f4febd00SPatrick Williams   to power off the host while the BMC's password is expired.
257f4febd00SPatrick Williams6. Test on BMC using Linux PAM both with and without LDAP or ActiveDirectory
258f4febd00SPatrick Williams   configured.
259f4febd00SPatrick Williams7. Validate you can to change an IPMI user's expired password, such as with:
260f4febd00SPatrick Williams   ipmitool user set password 1 NEWPASSWORD. This can be from another IPMI
261f4febd00SPatrick Williams   user's session or from unauthenticated access.
262