Introduce ConsoleHandler class under obmc_console

Added new ConsoleHandler class to prepare for the multiple consoles
support. All global fields are moved to the ConsoleHandler class and a
new global map added to remember the ConsoleHandler for each console
path. There is single ConsoleHandler per connection so we don't need
session map per route. There is a limit added for max number of
connection allowed to avoid any service attacks.

Testing:
    - Make sure that single console works fine and data is seen on the
      console.
    - Make sure that multiple consoles of type host console are created
      and data is seen on all consoles. Also using traces made sure
      that new handlers are destroyed.

Traces: Traces shows that multiple consoles active and later destroyed.
 [INFO "http_connection.hpp":209] Request:  0x24bb790 HTTP/1.1 GET
   /console0 ::ffff:x.xx.xxx.xx
 [DEBUG "routing.hpp":1240] Matched rule (upgrade) '/console0' 1 / 2
 [DEBUG "obmc_console.hpp":238] Connection 0x24eb424 opened
 [DEBUG "obmc_console.hpp":150] Obmc handler 0x24c18fc added 1 for path
   0x24eb424
 [DEBUG "obmc_console.hpp":257] Console Object path =
   /xyz/openbmc_project/console/default service =
   xyz.openbmc_project.Console.default Request target = /console0
 [DEBUG "obmc_console.hpp":224] Console web socket path: /console0
   Console unix FD: 13 duped FD: 14
 [DEBUG "obmc_console.hpp":44] Outbuffer empty.  Bailing out
 [INFO "http_connection.hpp":209] Request:  0x265d740 HTTP/1.1 GET
   /console0 ::ffff:x.xx.xxx.xx
 [DEBUG "routing.hpp":1240] Matched rule (upgrade) '/console0' 1 / 2
 [DEBUG "obmc_console.hpp":238] Connection 0x2661de4 opened
 [DEBUG "obmc_console.hpp":150] Obmc handler 0x25e69ac added 1 for path
   0x2661de4
 [DEBUG "obmc_console.hpp":257] Console Object path =
   /xyz/openbmc_project/console/default service =
   xyz.openbmc_project.Console.default Request target = /console0
 [DEBUG "obmc_console.hpp":224] Console web socket path: /console0
   Console unix FD: 19 duped FD: 20
 [DEBUG "obmc_console.hpp":44] Outbuffer empty.  Bailing out
 [INFO "http_connection.hpp":209] Request:  0x265d740 HTTP/1.1 GET
   /console0 ::ffff:x.xx.xxx.xx
 [DEBUG "routing.hpp":1240] Matched rule (upgrade) '/console0' 1 / 2
 [DEBUG "obmc_console.hpp":238] Connection 0x25f1fdc opened
 [DEBUG "obmc_console.hpp":150] Obmc handler 0x26ff22c added 1 for path
   0x25f1fdc
 [DEBUG "obmc_console.hpp":257] Console Object path =
   /xyz/openbmc_project/console/default service =
   xyz.openbmc_project.Console.default Request target = /console0
 [DEBUG "obmc_console.hpp":224] Console web socket path: /console0
   Console unix FD: 19 duped FD: 21
 [DEBUG "obmc_console.hpp":44] Outbuffer empty.  Bailing out
 [INFO "obmc_console.hpp":177] Closing websocket. Reason:
 [DEBUG "obmc_console.hpp":184] Remove connection 0x25f1fdc from obmc
   handler 0x26ff22c for path /console0
 [INFO "obmc_console.hpp":177] Closing websocket. Reason:
 [DEBUG "obmc_console.hpp":184] Remove connection 0x2661de4 from obmc
   handler 0x25e69ac for path /console0
 [INFO "obmc_console.hpp":177] Closing websocket. Reason:
 [DEBUG "obmc_console.hpp":184] Remove connection 0x24eb424 from obmc
   handler 0x24c18fc for path /console0

Change-Id: I77a58a3a186e87611219aed90b221f9b8be7fa2f
Signed-off-by: Ninad Palsule <ninad@linux.ibm.com>
1 file changed
tree: b2f989e1ee7222a9bea51fafc4429fe78e28c19d
  1. .github/
  2. config/
  3. http/
  4. include/
  5. redfish-core/
  6. scripts/
  7. src/
  8. static/
  9. subprojects/
  10. test/
  11. .clang-format
  12. .clang-tidy
  13. .dockerignore
  14. .gitignore
  15. .markdownlint.yaml
  16. .openbmc-enforce-gitlint
  17. .prettierignore
  18. .shellcheck
  19. AGGREGATION.md
  20. CLIENTS.md
  21. COMMON_ERRORS.md
  22. DBUS_USAGE.md
  23. DEVELOPING.md
  24. HEADERS.md
  25. LICENSE
  26. meson.build
  27. meson_options.txt
  28. OEM_SCHEMAS.md
  29. OWNERS
  30. README.md
  31. Redfish.md
  32. run-ci
  33. setup.cfg
  34. TESTING.md
README.md

OpenBMC webserver

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

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.