Check if eMMC is mounted before writing during multipart update.

This change adds a check to ensure that the eMMC filesystem is mounted before attempting to write firmware bundle files during a multipart update. If the eMMC is not mounted, an error is returned, preventing writes to an unexpected location. The return type of CreateBoostRequest is also updated to StatusOr to propagate errors.

I choose sys/stat to avoid DBus dependencies (which is normally async).

This will avoid all future problem that firmware bundle is placed into rwfs and brick BMC, because of eMMC not being ready.

#bmc-bloom

No eMMC.
```
root@ddcbs3-nfd01:~# umount /mnt/luks-mmcblk0_fs/
root@ddcbs3-nfd01:~# df -h
Filesystem                Size      Used Available Use% Mounted on
dev                     468.4M         0    468.4M   0% /dev
tmpfs                   469.4M     13.3M    456.1M   3% /run
/dev/mtdblock4           52.1M     52.1M         0 100% /run/initramfs/ro
/dev/mtdblock7            3.0M    956.0K      2.1M  31% /run/initramfs/rw
cow                       3.0M    956.0K      2.1M  31% /
tmpfs                   469.4M      8.0K    469.4M   0% /dev/shm
tmpfs                   469.4M      8.7M    460.7M   2% /tmp
tmpfs                   469.4M     52.0K    469.3M   0% /var/volatile
tmpfs                   469.4M     13.3M    456.1M   3% /var/lib/systemd/coredump
root@ddcbs3-nfd01:~# mkdir /mnt/luks-mmcblk0_fs/
mkdir: can't create directory '/mnt/luks-mmcblk0_fs/': File exists
root@ddcbs3-nfd01:~# touch /mnt/luks-mmcblk0_fs/something.txt
root@ddcbs3-nfd01:~# echo "hello" >> /mnt/luks-mmcblk0_fs/something.txt
root@ddcbs3-nfd01:~# cat /mnt/luks-mmcblk0_fs/something.txt
hello

ddcbs3-n1:~# /tmp/platforms_milotic_milotictool_mpm/1-23c4ce84_050585c7_e0f8d895_e258b4ad_27400fc6/milotic_tool_cli  -uid= -gid=   --auth insecure --command post --host ddcbs3-nfd01 --port 3995 --resource_url /redfish/v1/UpdateService/MultipartUpdate --command_body_file firmware_bundle.tar.gz
E0220 17:57:13.988465   99321 google_no_envelope_resolver.cc:195] UNAVAILABLE: (ddcbs3-nfd01:3995): unknown resolver mechanism. For DNS resolution, please prepend addresses with 'dns:///'.
=== Source Location Trace: ===
net/grpc/util/address_updater/address_updater.cc:951
URL is /redfish/v1/UpdateService/MultipartUpdate
Command body will be parsed from firmware_bundle.tar.gz
F0220 17:57:14.040414   99229 grpc_dynamic_raw.cc:382] Command failed: INTERNAL: eMMC is not mounted. Can't process multipart update.
=== Source Location Trace: ===
third_party/ecclesia/lib/status/rpc.h:45

Body is
```

Have eMMC

```
root@ddcbs3-nfd01:~# df -h
Filesystem                Size      Used Available Use% Mounted on
dev                     468.4M         0    468.4M   0% /dev
tmpfs                   469.4M      4.2M    465.2M   1% /run
/dev/mtdblock4           52.1M     52.1M         0 100% /run/initramfs/ro
/dev/mtdblock7            3.0M    956.0K      2.1M  31% /run/initramfs/rw
cow                       3.0M    956.0K      2.1M  31% /
tmpfs                   469.4M      8.0K    469.4M   0% /dev/shm
tmpfs                   469.4M    224.0K    469.2M   0% /tmp
tmpfs                   469.4M     52.0K    469.3M   0% /var/volatile
tmpfs                    14.2G    304.2M     13.2G   2% /var/lib/systemd/coredump
/dev/mapper/luks-mmcblk0
                         14.2G    304.2M     13.2G   2% /mnt/luks-mmcblk0_fs
/dev/mapper/luks-mmcblk0
                         14.2G    304.2M     13.2G   2% /run/systemd/coredumps
/dev/mapper/luks-mmcblk0
                         14.2G    304.2M     13.2G   2% /var/lib/systemd/coredump

ddcbs3-n1:~# /tmp/platforms_milotic_milotictool_mpm/1-23c4ce84_050585c7_e0f8d895_e258b4ad_27400fc6/milotic_tool_cli  -uid= -gid=   --auth insecure --command post --host ddcbs3-nfd01 --port 3995 --resource_url /redfish/v1/UpdateService/MultipartUpdate --command_body_file firmware_bundle.tar.gz
E0220 18:09:52.075019  103457 google_no_envelope_resolver.cc:195] UNAVAILABLE: (ddcbs3-nfd01:3995): unknown resolver mechanism. For DNS resolution, please prepend addresses with 'dns:///'.
=== Source Location Trace: ===
net/grpc/util/address_updater/address_updater.cc:951
URL is /redfish/v1/UpdateService/MultipartUpdate
Command body will be parsed from firmware_bundle.tar.gz
Response JSON is /redfish/v1/UpdateService/MultipartUpdate{
  "@odata.id": "/redfish/v1/TaskService/Tasks/FirmwareBundleUpdate",
  "@odata.type": "#Task.v1_4_2.Task",
  "Id": "FirmwareBundleUpdate",
  "Name": "Firmware Bundle Update",
  "PercentComplete": 0,
  "TaskState": "New"
}
Response JSON is /redfish/v1/UpdateService/MultipartUpdate{
  "@odata.id": "/redfish/v1/TaskService/Tasks/FirmwareBundleUpdate",
  "@odata.type": "#Task.v1_4_2.Task",
  "Id": "FirmwareBundleUpdate",
  "Name": "Firmware Bundle Update",
  "PercentComplete": 0,
  "TaskState": "New"
}

```

PiperOrigin-RevId: 873161540
Change-Id: Ibe3dc55062a5be62f91425c2ff33533883559b7d
1 file changed
tree: 10725b30982504252478b8f87897f12313599f23
  1. .github/
  2. config/
  3. g3/
  4. http/
  5. include/
  6. install/
  7. plugins/
  8. redfish-core/
  9. redfish_authorization/
  10. scripts/
  11. src/
  12. static/
  13. subprojects/
  14. test/
  15. tlbmc/
  16. .clang-format
  17. .clang-tidy
  18. .clang-tidy-ignore
  19. .dockerignore
  20. .gitignore
  21. .markdownlint.yaml
  22. .openbmc-enforce-gitlint
  23. .openbmc-no-clang
  24. .openbmc-no-sanitize
  25. .prettierignore
  26. .shellcheck
  27. AGGREGATION.md
  28. CLIENTS.md
  29. COMMON_ERRORS.md
  30. copy.bara.sky
  31. DBUS_USAGE.md
  32. DEVELOPING.md
  33. gcovr.cfg
  34. HEADERS.md
  35. LICENSE
  36. meson.build
  37. meson_options.txt
  38. OEM_SCHEMAS.md
  39. OWNERS
  40. PLUGINS.md
  41. README.md
  42. README_GOOGLE.md
  43. Redfish.md
  44. run-ci
  45. setup.cfg
  46. TESTING.md
  47. UNIT_TESTING.md
README.md

OpenBMC webserver

This project is Google's version of BMCWeb.

See Readme Google for Google added features. The following is the original README of OpenBMC/BMCWeb.

==============================================================================

This component attempts to be a “do everything” embedded webserver for OpenBMC.

Features

The webserver implements a few distinct interfaces:

  • DBus event websocket. Allows registering on changes to specific dbus paths, properties, and will send an event from the websocket if those filters match.
  • OpenBMC DBus REST api. Allows direct, low interference, high fidelity access to dbus and the objects it represents.
  • Serial: A serial websocket for interacting with the host serial console through websockets.
  • Redfish: A protocol compliant, DBus to Redfish translator.
  • KVM: A websocket based implementation of the RFB (VNC) frame buffer protocol intended to mate to webui-vue to provide a complete KVM implementation.

Protocols

bmcweb at a protocol level supports http and https. TLS is supported through OpenSSL.

AuthX

Authentication

Bmcweb supports multiple authentication protocols:

  • Basic authentication per RFC7617
  • Cookie based authentication for authenticating against webui-vue
  • Mutual TLS authentication based on OpenSSL
  • Session authentication through webui-vue
  • XToken based authentication conformant to Redfish DSP0266

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.

Authorization

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.

Configuration

bmcweb is configured per the meson build files. Available options are documented in meson_options.txt

Compile bmcweb with default options

meson 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.

Use of persistent data

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.

TLS certificate generation

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.

Redfish Aggregation

bmcweb is capable of aggregating resources from satellite BMCs. Refer to AGGREGATION.md for more information on how to enable and use this feature.