booster icon indicating copy to clipboard operation
booster copied to clipboard

Implement events synchronization mechanism (pubsub?)

Open anatol opened this issue 4 years ago • 1 comments

Booster has a few points that depend on results of other operations, e.g.

  • yubikey unlocking can be started only after a Yubikey inserted/detected
  • Clevis/tang requires network interface to be initialized
  • password needs to be entered by user before unlocking some slot

Currently booster uses either hacky delays or single-thread processing to make sure the events are ordered.

Replace it with better synchronization mechanism. It will help to avoid race conditions in the code.

One option is to use events pub-sub. Operations can be launched with multiple goroutines. If a thread needs a subsystem ready (e.g. network is initialized; a new Yubikey appeared; ...) then it subscribes to a specific pub-sub channel and waits for event.

anatol avatar Sep 10 '21 17:09 anatol

I think I could rework the code I PR'd to fix the TPM race condition into something that could be used for the other things listed too. Just need to find some time for it.

Each of these need to wait for some condition that may or may not ever be satisfied, just like unlocking the TPM. A simple channel might work for this.

Axelen123 avatar Nov 25 '22 16:11 Axelen123