mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

- policy/ renamed to scripts/ - By default BROPATH now contains: - scripts/ - scripts/policy - scripts/site - *Nearly* all tests pass. - All of scripts/base/ is loaded by main.cc - Can be disabled by setting $BRO_NO_BASE_SCRIPTS - Scripts in scripts/base/ don't use relative path loading to ease use of BRO_NO_BASE_SCRIPTS (to copy and paste that script). - The scripts in scripts/base/protocols/ only (or soon will only) do logging and state building. - The scripts in scripts/base/frameworks/ add functionality without causing any additional overhead. - All "detection" activity happens through scripts in scripts/policy/. - Communications framework modified temporarily to need an environment variable to actually enable (ENABLE_COMMUNICATION=1) - This is so the communications framework can be loaded as part of the base without causing trouble when it's not needed. - This will be removed once a resolution to ticket #540 is reached.
79 lines
2.8 KiB
Text
79 lines
2.8 KiB
Text
module Cluster;
|
|
|
|
event bro_init() &priority=9
|
|
{
|
|
local me = nodes[node];
|
|
|
|
for ( i in Cluster::nodes )
|
|
{
|
|
local n = nodes[i];
|
|
|
|
# Connections from the control node for runtime control and update events.
|
|
# Every node in a cluster is eligible for control from this host.
|
|
if ( n$node_type == CONTROL )
|
|
Communication::nodes["control"] = [$host=n$ip, $connect=F,
|
|
$class="control", $events=control_events];
|
|
|
|
if ( me$node_type == MANAGER )
|
|
{
|
|
if ( n$node_type == WORKER && n$manager == node )
|
|
Communication::nodes[i] =
|
|
[$host=n$ip, $connect=F,
|
|
$class=i, $events=worker_events, $request_logs=T];
|
|
|
|
if ( n$node_type == PROXY && n$manager == node )
|
|
Communication::nodes[i] =
|
|
[$host=n$ip, $connect=F,
|
|
$class=i, $events=proxy_events, $request_logs=T];
|
|
|
|
if ( n$node_type == TIME_MACHINE && me?$time_machine && me$time_machine == i )
|
|
Communication::nodes["time-machine"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
|
|
$connect=T, $retry=1min];
|
|
}
|
|
|
|
else if ( me$node_type == PROXY )
|
|
{
|
|
if ( n$node_type == WORKER && n$proxy == node )
|
|
Communication::nodes[i] =
|
|
[$host=n$ip, $connect=F, $class=i, $events=worker_events];
|
|
|
|
# accepts connections from the previous one.
|
|
# (This is not ideal for setups with many proxies)
|
|
# FIXME: Once we're using multiple proxies, we should also figure out some $class scheme ...
|
|
if ( n$node_type == PROXY )
|
|
{
|
|
if ( n?$proxy )
|
|
Communication::nodes[i]
|
|
= [$host=n$ip, $p=n$p,
|
|
$connect=T, $auth=F, $sync=T, $retry=1mins];
|
|
else if ( me?$proxy && me$proxy == i )
|
|
Communication::nodes[me$proxy]
|
|
= [$host=nodes[i]$ip, $connect=F, $auth=T, $sync=T];
|
|
}
|
|
|
|
# Finally the manager, to send it status updates.
|
|
if ( n$node_type == MANAGER && me$manager == i )
|
|
Communication::nodes["manager"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
|
|
$connect=T, $retry=1mins,
|
|
$class=node];
|
|
}
|
|
|
|
else if ( me$node_type == WORKER )
|
|
{
|
|
if ( n$node_type == MANAGER && me$manager == i )
|
|
Communication::nodes["manager"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
|
|
$connect=T, $retry=1mins,
|
|
$class=node];
|
|
|
|
if ( n$node_type == PROXY && me$proxy == i )
|
|
Communication::nodes["proxy"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
|
|
$connect=T, $retry=1mins,
|
|
$class=node];
|
|
|
|
if ( n$node_type == TIME_MACHINE && me?$time_machine && me$time_machine == i )
|
|
Communication::nodes["time-machine"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
|
|
$connect=T, $retry=1min];
|
|
|
|
}
|
|
}
|
|
}
|