commit | b33a4327cb87c7e1a71e6e0d49823111a72181a3 | [log] [tgz] |
---|---|---|
author | Ninad Palsule <ninad@linux.ibm.com> | Fri Jun 09 09:19:18 2023 -0500 |
committer | Ninad Palsule <ninad@linux.ibm.com> | Mon Jun 12 21:14:44 2023 +0000 |
tree | 4511fdd2baeeba435a94ddf97c7e98d186e846c2 | |
parent | 5e577bc13511acc8b9f98c042ad3e4bb72e2a5b5 [diff] |
Add content type check in the update service The content type check is required in the update service. This may be a security issue. The correct content types to update service are multipart/form-data and application/octet-stream. The multipart content type was missing from the contentTypes array which is added in this drop. Added couple of test cases. Tested: 1) Make sure that update service content type application/octet-stream are working correctly. $ curl -k -H 'X-Auth-Token: THIbp1G0DiNVj3JrCZMf' -H 'Content-Type: \ application/octet-stream' -X POST \ -T ./obmc-phosphor-image-everest.ext4.mmc.tar \ https://${bmc}/redfish/v1/UpdateService/update { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" 2) Make sure that update service content type multipart/form-data are working correctly. $ curl -k -H 'X-Auth-Token: Vc7KBgM6z3uMs1G7uVqu' \ -H Content-Type:multipart/form-data \ -F 'UpdateParameters={"Targets":["/redfish/v1/Managers/bmc"], \ "@Redfish.OperationApplyTime":"Immediate"};type=application/json'\ -F 'UpdateFile=@obmc-phosphor-image-p10bmc.ext4.mmc.tar; \ type=application/octet-stream' \ https://${bmc}/redfish/v1/UpdateService/update { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request completed successfully.", "MessageArgs": [], "MessageId": "Base.1.16.0.Success", "MessageSeverity": "OK", "Resolution": "None" } ], "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" 3) Make sure that command fails when content type is missing. $ curl -k -H 'X-Auth-Token: vH3B88sh323sfy0YG8eN' -H Content-Type: \ -X POST -T ./obmc-phosphor-image-everest.ext4.mmc.tar \ https://${bmc}/redfish/v1/UpdateService/update Bad Request [INFO "http_connection.hpp":201] Request: 0x177f920 HTTP/1.1 POST \ /redfish/v1/UpdateService/update ::ffff:x.x.xx.xxx | [DEBUG "update_service.hpp":687] doPost: contentType= [DEBUG "update_service.hpp":692] Bad content type specified: 4) Make sure that command fails when wrong cotent type specified. $ curl -k -H 'X-Auth-Token: OQzODMaR0G29AjpD2YmT' -H 'Content-Type: \ application/octet-json' -X POST \ -T ./obmc-phosphor-image-everest.ext4.mmc.tar \ https://${bmc}/redfish/v1/UpdateService/update Bad Request [INFO "http_connection.hpp":201] Request: 0x17a69d0 HTTP/1.1 POST \ /redfish/v1/UpdateService/update ::ffff:x.x.xx.xxx | [DEBUG "update_service.hpp":687] doPost: contentType=application/octet-json [DEBUG "update_service.hpp":720] Bad content type specified: application/octet-json 5) Make sure that command fails when header is not specified. $ curl -k -H 'X-Auth-Token: Z1AEXg075qGKi0xISu6o' -X POST \ -T ./obmc-phosphor-image-everest.ext4.mmc.tar \ https://${bmc}/redfish/v1/UpdateService/update Bad Request [INFO "http_connection.hpp":201] Request: 0x17a69d0 HTTP/1.1 \ POST /redfish/v1/UpdateService/update ::ffff:x.x.xx.xxx | [DEBUG "update_service.hpp":687] doPost: contentType= [DEBUG "update_service.hpp":692] Bad content type specified: Change-Id: I48b709b6219debfed9ff60dd46ab87652e5a1fe5 Signed-off-by: Ninad Palsule <ninad@linux.ibm.com>
This component attempts to be a "do everything" embedded webserver for OpenBMC.
The webserver implements a few distinct interfaces:
bmcweb at a protocol level supports http and https. TLS is supported through OpenSSL.
Bmcweb supports multiple authentication protocols:
Each of these types of authentication is able to be enabled or disabled both via runtime policy changes (through the relevant Redfish APIs) or via configure time options. All authentication mechanisms supporting username/password are routed to libpam, to allow for customization in authentication implementations.
All authorization in bmcweb is determined at routing time, and per route, and conform to the Redfish PrivilegeRegistry.
*Note: Non-Redfish functions are mapped to the closest equivalent Redfish privilege level.
bmcweb is configured per the meson build files. Available options are documented in meson_options.txt
meson setup builddir ninja -C builddir
If any of the dependencies are not found on the host system during configuration, meson will automatically download them via its wrap dependencies mentioned in bmcweb/subprojects
.
bmcweb relies on some on-system data for storage of persistent data that is internal to the process. Details on the exact data stored and when it is read/written can seen from the persistent_data
namespace.
When SSL support is enabled and a usable certificate is not found, bmcweb will generate a self-signed a certificate before launching the server. Please see the bmcweb source code for details on the parameters this certificate is built with.
bmcweb is capable of aggregating resources from satellite BMCs. Refer to AGGREGATION.md for more information on how to enable and use this feature.