Add support for making the supervisor listen for requests

The supervisor now starts listening on the configured Broker default address and
port when the new boolean SupervisorControl::enable_listen is T. Listening
remains disabled by default. Listening allows nodes to communicate with the
supervisor via the events laid out in control.zeek, to conduct further node
management.
This commit is contained in:
Christian Kreibich 2021-07-06 18:01:05 -07:00
parent 36051dc9a1
commit efaa9ec3be
2 changed files with 12 additions and 1 deletions

View file

@ -3,7 +3,6 @@
@load ./api
@load ./control
@load base/frameworks/broker
function Supervisor::status(node: string): Supervisor::Status
{
@ -42,6 +41,13 @@ function Supervisor::node(): Supervisor::NodeConfig
event zeek_init() &priority=10
{
if ( Supervisor::is_supervisor() && SupervisorControl::enable_listen )
{
Broker::listen(Broker::default_listen_address,
Broker::default_port,
Broker::default_listen_retry);
}
Broker::subscribe(SupervisorControl::topic_prefix);
}