1# Initial expired passwords 2 3Author: 4 Joseph Reynolds <josephreynolds1> 5 6Other contributors: 7 None 8 9Created: 10 2019-07-24 11 12## Problem Description 13OpenBMC has a default password, connects to the network via DHCP, and 14does not have a mechanism to require administrators to change the 15BMC's password. This may lead to BMCs which have default passwords 16being on the network for long time periods, effectively giving 17unrestricted access to the BMC. 18 19## Background and References 20Various computer systems ship with default userid and passwords and 21require the password be changed on the initial signon. This reduces 22the time window when the system is accessible with a default password. 23 24Various BMC interfaces require authentication before access is 25granted. The authentication and account validation steps typically 26result in outcomes like this: 271. Success, when the access credentials (such as username and password) 28 are correct and the account being accessed is valid. 292. Failure, when either the access credentials are invalid or the 30 account being accessed is invalid. For example, the account itself 31 (not merely its password) may be expired. 323. PasswordChangeRequired, when the access credentials are correct and 33 the account is valid except the account's password is expired (such as 34 indicated by PAM_CHANGE_EXPIRED_AUTHTOK). 35 36OpenBMC currently implements the first two outcomes; it treats 37PasswordChangeRequired the same as an account that is invalid for any 38other reason. Some servers (such as the OpenSSH server) handle the 39PasswordChangeRequired by implementing a "password change dialog". 40 41The [Redfish Specification version 1.7.0][] section 13.2.6.1 ("Password 42change required handling") provides the ManagerAccount resource v1.3 43with a PasswordChangeRequired property which supports a password 44change dialog. 45 46[Redfish Specification version 1.7.0]: https://www.dmtf.org/sites/default/files/standards/documents/DSP0266_1.7.0.pdf 47 48Note the terminology: 49An "expired password" is a special case of "password change required". 50 51The meaning of the term "access" varies by context. It could mean: 52 1. Access to the BMC's network interfaces. 53 2. Access to the BMC's authentication mechanisms together with 54 correct credentials, whether or not those credentials have 55 expired and must be changed. 56 3. Access to the BMC's function via an authenticated interface, for 57 example, such as establishing a session after you've changed your 58 initial password. 59 4. Access to the BMC's function via an unauthenticated interface such 60 as host IPMI or physical control panel (example: power button). 61 62This design uses meanings 3 and 4 except where indicated. 63 64## Requirements 65The requirements are: 66 - The BMC's initial password must be expired when the new 67 EXPIRED_PASSWORD image feature is used. 68 - An account with an expired password must not be allowed to use the 69 BMC (except to change the password). 70 - There must be a way to change the expired password using a 71 supported interface. 72 73The use case is: 74 - The BMC automatically connects to its management network which 75 offers administrative or operational interfaces (whether or not the 76 BMC is normally operated via its host). 77 - The BMC is operated from its management network. 78 79Preconditions for the BMC include: 80 - The BMC has at least one account with a default password built in. 81 - The BMC can update the password; for example, the `/etc/passwd` 82 file is writeable. 83 84## Proposed Design 85This design has three main parts: 86 871. There is a new image feature EXPIRED_PASSWORD. When 88 EXPIRED_PASSWORD is enabled, the BMC's default password will 89 initially be expired as if via the `passwd --expire root` command. 90 This administratively expires the password and is not based on 91 time. An account with an expired password is neither locked nor 92 disabled. 93 94 This feature is intended to be enabled by default, with a staging 95 plan: the feature will be disabled to give time for the continuous 96 integration (CI) and test automation efforts to adapt, then enabled 97 for the overall project. 98 992. The BMC's network interfaces (such as REST APIs, SSH, and IPMI) 100 disallow access via an account which has an expired password. If 101 the access credentials are otherwise correct and the reason for the 102 authentication failure is an expired password (determined by the 103 usual Linux practices), where possible, the interface should 104 indicate the password is expired and how to change it (see below). 105 Otherwise the usual security protocols apply (giving no additional 106 information). 107 108 The `/login` URI is enhanced. If it is used with correct 109 credentials (userid and password) and the password needs to be 110 changed the request will fail to create a session and indicate a 111 password change is needed. If it is used with correct userid and 112 incorrect password, or with an incorrect userid, the behavior must 113 not change. Note the `/login` URI is deprecated. 114 115 The '/redfish/v1/SessionService/Sessions/<session>' and 116 '/redfish/v1/AccountService/Accounts/<account>' resources are 117 enhanced to indicate PasswordChangeRequired per the Redfish spec. 118 119 The `ipmitool` command treats an expired password the same as an 120 invalid password. Note the RMCP+ standard, such as used for the 121 BMC's network IPMI interface, does not support changing the 122 password when establishing a session. The ipmitool is not being 123 enhanced by this design. 124 125 The Secure Shell access (via the `ssh` command) already correctly 126 indicates when the password is expired. No change is needed. But 127 see the next bullet for the expired password dialog. 128 1293. There is a way for an account owner to change their own expired 130 password. This can be either from a network-facing or in-band 131 password changing protocol. For example: 132 - Redfish: This design adds the Redfish PasswordChangeRequired 133 handling to BMCWeb. See below for details. 134 - SSH server: The SSH servers may have an expired password change 135 dialog. For example, OpenSSH implement this feature. However, 136 the Dropbear SSH server announces the password is expired, but 137 does not implement the dialog to change it. 138 - Access via the BMC's host: for example, via the `ipmitool user 139 set password` command when accessed in-band. 140 141When Redfish creates a session with PasswordChangeRequired, every 142response contains a PasswordChangeRequired message. The session 143effectively has only the ConfigureSelf privilege which allows it to 144only change the password and terminate the session. The usage 145pattern is: 146 1. Create a session. 147 2. If the PasswordChangeRequired message is present: 148 1. PATCH the new password into the ManagerAccount object. 149 2. Any other use of the session will get HTTP status code 403 150 Forbidden. 151 3. DELETE the Session object to terminate the session. 152 4. Create a new session and continue. 153 154This design is intended to cover any cause of expired password, 155including both the BMC's initial expired password and password expired 156for another cause such as aging or via the `passwd --expire` command. 157 158This design is intended to enable the phosphor-webui web application 159to implement a password change dialog for the signon screen. 160 161Per the above design, when the web app uses either `/login` or 162`/redfish/v1/SessionService` to establish a session and the account 163has an expired password: 164 - If the `/login` URI was used, the HTTP response indicates the 165 password must be changed, and will not establish a session. In 166 this case, the web app must use the Redfish API to establish a 167 session. 168 - POST to `/redfish/v1/SessionService/Sessions` will establish a 169 session which will have the PasswordChangeRequired message. 170 - At this point the web app can display a message that the password 171 is expired and must be changed, then get the new password. 172 - PATCH the password to the account specified in the 173 PasswordChangeRequired message. 174 - DELETE the Session object to terminate the session. 175 - Create a new session and continue. 176 177## Alternatives Considered 178The following alternate designs were considered: 179- Unique password per machine. That approach requires additional 180 effort, for example, to set and track assigned passwords. 181- Default to having no users with access to the BMC via its network. 182 When network access is needed, a technician would create or modify 183 the userid to have network authority and establish a password at 184 that time. This may be through the BMC's host system or via the 185 BMC's serial console. That approach requires the tech to have 186 access, and requires re-provisioning the account after factory reset 187- Disable network access by default. That approach requires another 188 BMC access vector, such as physical access or via the BMC's host, to 189 enable network access. 190- Provision the BMC with a certificate instead of a password, for 191 example, an SSH client certificate. That approach suffers from the 192 same limitations as a default password (when the matching private 193 certificate becomes well known) and requires the BMC provide SSH 194 access. 195- Require physical presence to change the password. For example, 196 applying a jumper, or signing in via a serial cable. That approach 197 is not standard. 198- Have LDAP (or any authentication/authorization server) configured 199 and have no local users which have default passwords configured in 200 the BMC firmware image. That approach requires the customer have an 201 LDAP (or similar) server. Also, how we can configure the LDAP, as 202 we don't know the customer LDAP server configuration? 203- Have a new service to detect if any password has its default value, 204 and write log messages for that condition, with the idea to alert 205 the system owner of this condition. That approach doesn't solve the 206 problem and burdens BMC resources. 207 208Warning. This design may leave the BMC with its default password for 209an extended period of time if the use case given in the requirements 210section of this design does not apply. For example, when the host is 211operated strictly via its power button and not through the BMC's 212network interface. In this case, the alternatives listed above may 213mitigate this risk. Another alternative is a design where the BMC is 214initially in a provisioning mode which does not allow the BMC to 215operate its host. The idea is that you have to establish access to 216the BMC (which includes changing its password) before you can leave 217provisioning mode. 218 219The BMCWeb Redfish server could be enhanced so that when the Password 220is successfully patched, the session no longer asserts the 221PasswordChangeRequired condition and re-asserts the user's usual 222authority immediately without requiring a new session. This is 223allowed by the Redfish spec, but was not implemented because it would 224be more difficult to code and test. 225 226## Impacts 227Having to change an expired password is annoying and breaks 228operational procedures and scripts. Documentation, lifecycle review, 229and test are needed. Expect pain when this is enabled. 230 231To help with this, the [REDFISH-cheatsheet][] will be updated with 232commands needed to detect and change an expired password. 233 234[REDFISH-cheatsheet]: https://github.com/openbmc/docs/blob/master/REDFISH-cheatsheet.md 235 236This design does not affect other policies such as password aging. 237 238## Testing 239Scenarios: 2401. Ensure that when the BMC is in its initial state: 241 - All available network interfaces deny access. 242 - Selected interfaces allow the password to be changed. 2432. Ensure factory reset resets the password to its initial expired 244 state (repeat the tests above). 2453. Ensure the password change is effective for users entering from all 246 supported interfaces. For example, change the password via the 247 Redfish API, and validate that the old password does not work and 248 the new password does work via IPMI for the same user. 2494. Handle BMC code update scenarios. For example, (A) Ensure code 250 update does not cause a previously set password to change to 251 default or to expire. (B) Validate what happens when the BMC has a 252 default password and does code update to a release which has the 253 default expired password design (this design). 2545. Ensure the BMC continues to operate its host, for example, when the 255 BMC is factory reset while the host is running. Ensure the power 256 button can be used to power off the host while the BMC's password is 257 expired. 2586. Test on BMC using Linux PAM both with and without LDAP or 259 ActiveDirectory configured. 2607. Validate you can to change an IPMI user's expired password, such as 261 with: ipmitool user set password 1 NEWPASSWORD. This can be from 262 another IPMI user's session or from unauthenticated access. 263