PII: support ENABLE_BM_CONSOLE_FLAG

bmc-config/bm-console msv package will install ENABLE_BM_CONSOLE_FLAG
/var/google/config-package/enable-bm-console.flag

This flag was used by ro serial console to disable PII for testing. r/w
console will support this also.

Tested:
refer to bug comments

Google-Bug-Id: 438565387
Change-Id: I932b77fb1aed2624888e4863c97306f1969e4fc2
Signed-off-by: Dan Zhang <zhdaniel@google.com>
1 file changed
tree: 1cf8c9b186165710374fd7ceca53b9eed6a184f5
  1. conf/
  2. test/
  3. .clang-format
  4. .clang-tidy
  5. .gitignore
  6. .linter-ignore
  7. .travis.yml
  8. CHANGELOG.md
  9. config.c
  10. console-client.c
  11. console-dbus.c
  12. console-server.c
  13. console-server.h
  14. console-socket.c
  15. LICENSE
  16. log-handler.c
  17. meson.build
  18. meson.options
  19. OWNERS
  20. pii-handler.c
  21. pii-socket.c
  22. README.md
  23. ringbuffer.c
  24. socket-handler.c
  25. syslog-handler.c
  26. tty-handler.c
  27. util.c
README.md

To Build

To build this project, run the following shell commands:

meson setup build
meson compile -C build

To test:

meson test -C build

To Run Server

Running the server requires a serial port (e.g. /dev/ttyS0):

touch obmc-console.conf
./obmc-console-server --config obmc-console.conf ttyS0

To Connect Client

To connect to the server, simply run the client:

./obmc-console-client

To disconnect the client, use the standard ~. combination.

Underlying design

This shows how the host UART connection is abstracted within the BMC as a Unix domain socket.

               +---------------------------------------------------------------------------------------------+
               |                                                                                             |
               |       obmc-console-client       unix domain socket         obmc-console-server              |
               |                                                                                             |
               |     +----------------------+                           +------------------------+           |
               |     |   client.2200.conf   |  +---------------------+  | server.ttyVUART0.conf  |           |
           +---+--+  +----------------------+  |                     |  +------------------------+  +--------+-------+
Network    | 2200 +-->                      +->+ @obmc-console.host0 +<-+                        <--+ /dev/ttyVUART0 |   UARTs
           +---+--+  | console-id = "host0" |  |                     |  |  console-id = "host0"  |  +--------+-------+
               |     |                      |  +---------------------+  |                        |           |
               |     +----------------------+                           +------------------------+           |
               |                                                                                             |
               |                                                                                             |
               |                                                                                             |
               +---------------------------------------------------------------------------------------------+

This supports multiple independent consoles. The console-id is a unique portion for the unix domain socket created by the obmc-console-server instance. The server needs to know this because it needs to know what to name the pipe; the client needs to know it as it needs to form the abstract socket name to which to connect.