Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
Updates to make broccoli work with communication API updates.
Browse files Browse the repository at this point in the history
- Python bindings need to be updated still. (one small change)
  • Loading branch information
Seth Hall committed Oct 7, 2011
1 parent 999a935 commit 6597882
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 116 deletions.
2 changes: 1 addition & 1 deletion bindings/broccoli-ruby
Submodule broccoli-ruby updated from aded47 to 14afa2
2 changes: 1 addition & 1 deletion contrib/rcvpackets.bro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

@load listen-clear
@load frameworks/communication/listen

redef Remote::destinations += {
["broccoli"] = [$host=127.0.0.1, $accept_state=T, $sync=F]
Expand Down
46 changes: 22 additions & 24 deletions doc/broccoli-manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1142,14 +1142,15 @@ quickly enable/disable a certificate configuration, the
/broccoli/host_cert <path>/bro_cert.pem
/broccoli/host_key <path>/bro_cert.key

In a Bro policy, you need to load the ``listen-ssl.bro`` script and
redef ``ssl_ca_certificate`` and ``ssl_private_key``, defined in
``bro.init``:
In a Bro policy, you need to load the ``frameworks/communication/listen.bro``
script and redef ``Communication::listen_encrypted=T``,
``ssl_ca_certificate``, and ``ssl_private_key``, defined in ``bro.init``:

.. code:: bro
@load frameworks/communication/listen-ssl
@load frameworks/communication/listen
redef Communication::listen_encrypted=T;
redef ssl_ca_certificate = "<path>/ca_cert.pem";
redef ssl_private_key = "<path>/bro.pem";
Expand All @@ -1174,29 +1175,26 @@ Configuring event reception in Bro scripts
Before a remote Bro will accept your connection and your events, it
needs to have its policy configured accordingly:

1. Load either ``listen-ssl`` or ``listen-clear``,
depending on whether you want to have encrypted or cleartext
communication. Obviously, encrypting the event exchange is
recommended and cleartext should only be used for early experimental
setups. See below for details on how to set up encrypted
communication via SSL.
1. Load ``frameworks/communication/listen``, and redef the boolean variable
``Communication::listen_encrypted`` depending on whether you want to have
encrypted or cleartext communication. Obviously, encrypting the event
exchange is recommended and cleartext should only be used for early
experimental setups. See below for details on how to set up encrypted
communication via SSL.

#. You need to find a port to use for the Bros and Broccoli applications
that will listen for connections. Every such agent can use a
different port, though default ports are provided in the Bro
policies. To change the port the Bro agent will be listening on from
its default, redefine the ``listen_port_ssl`` or
``listen_port_clear`` variables from ``listen-clear.bro`` or
``listen-ssl.bro``, respectively, in the
``policy/frameworks/communication/`` scripts subdirectory. Have a
its default, redefine the ``Communication::listen_port``. Have a
look at these policies as well as
``base/frameworks/communication/main.bro`` for the default values.
Here is the policy for the unencrypted case:

.. code:: bro
@load frameworks/communication/listen-clear
redef listen_port_clear = 12345/tcp;
@load frameworks/communication/listen
redef Communication::listen_port = 12345/tcp;
..
Expand All @@ -1205,10 +1203,11 @@ needs to have its policy configured accordingly:

.. code:: bro
@load frameworks/communication/listen-ssl
redef listen_port_ssl = 12345/tcp; redef
ssl_ca_certificate = "<path>/ca_cert.pem"; redef
ssl_private_key = "<path>/bro.pem";
@load frameworks/communication/listen
redef Communication::listen_encrypted = T;
redef Communication::listen_port = 12345/tcp;
redef ssl_ca_certificate = "<path>/ca_cert.pem";
redef ssl_private_key = "<path>/bro.pem";
..
Expand All @@ -1222,9 +1221,8 @@ needs to have its policy configured accordingly:
creative one would be "broccoli"), the IP address of the peer, the
pattern of names of the events the Bro will accept from you, whether
you want Bro to connect to your machine on startup or not, if so, a
port to connect to (defaults are ``default_port_ssl`` and
``default_port_clear``, also defined in
``base/frameworks/communication/main.bro.bro``), a retry timeout,
port to connect to (default is ``Communication::default_port`` also defined in
``base/frameworks/communication/main.bro``), a retry timeout,
whether to use SSL, and the class of a connection as set on the
Broccoli side via ``bro_conn_set_class()``.

Expand Down Expand Up @@ -1289,7 +1287,7 @@ need to update the ``Communication::nodes`` variable accordingly:

.. code:: bro
@load frameworks/communication/listen-clear;
@load frameworks/communication/listen;
global ping_log = open_log_file("ping");
Expand Down
28 changes: 8 additions & 20 deletions test/broconn.bro
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
# Depending on whether you want to use encryption or not,
# include "listen-clear" or "listen-ssl":
#
# @load frameworks/communication/listen-ssl
@load frameworks/communication/listen-clear
@load protocols/conn
@load frameworks/dpd
@load frameworks/communication/listen

# Let's make sure we use the same port no matter whether we use encryption or not:
#
@ifdef (Communication::listen_port_clear)
redef Communication::listen_port_clear = 47758/tcp;
@endif
redef Communication::listen_port = 47758/tcp;

# If we're using encrypted communication, redef the SSL port and hook in
# the necessary certificates:
#
@ifdef (Communication::listen_port_ssl)
redef Communication::listen_port_ssl = 47758/tcp;
redef ssl_ca_certificate = "<path>/ca_cert.pem";
redef ssl_private_key = "<path>/bro.pem";
@endif
# Redef this to T if you want to use encryption.
redef Communication::listen_encrypted = F;

# Set the SSL certificates being used to something real if you are using encryption.
#redef ssl_ca_certificate = "<path>/ca_cert.pem";
#redef ssl_private_key = "<path>/bro.pem";

redef Communication::nodes += {
["broconn"] = [$host = 127.0.0.1, $connect=F, $ssl=F]
};

redef dpd_conn_logs = T;

function services_to_string(ss: string_set): string
{
local result = "";
Expand Down
24 changes: 8 additions & 16 deletions test/broenum.bro
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
# Depending on whether you want to use encryption or not,
# include "listen-clear" or "listen-ssl":
#
# @load frameworks/communication/listen-ssl
@load frameworks/communication/listen-clear
@load frameworks/communication/listen

# Let's make sure we use the same port no matter whether we use encryption or not:
#
@ifdef (Communication::listen_port_clear)
redef Communication::listen_port_clear = 47758/tcp;
@endif
redef Communication::listen_port = 47758/tcp;

# If we're using encrypted communication, redef the SSL port and hook in
# the necessary certificates:
#
@ifdef (Communication::listen_port_ssl)
redef Communication::listen_port_ssl = 47758/tcp;
redef ssl_ca_certificate = "<path>/ca_cert.pem";
redef ssl_private_key = "<path>/bro.pem";
@endif
# Redef this to T if you want to use encryption.
redef Communication::listen_encrypted = F;

# Set the SSL certificates being used to something real if you are using encryption.
#redef ssl_ca_certificate = "<path>/ca_cert.pem";
#redef ssl_private_key = "<path>/bro.pem";

module enumtest;

Expand Down
26 changes: 8 additions & 18 deletions test/brohose.bro
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# Depending on whether you want to use encryption or not,
# include "listen-clear" or "listen-ssl":
#
# @load frameworks/communication/listen-ssl
@load frameworks/communication/listen-clear

global brohose_log = open_log_file("brohose");
@load frameworks/communication/listen

# Let's make sure we use the same port no matter whether we use encryption or not:
#
@ifdef (Communication::listen_port_clear)
redef Communication::listen_port_clear = 47758/tcp;
@endif
redef Communication::listen_port = 47758/tcp;

# If we're using encrypted communication, redef the SSL port and hook in
# the necessary certificates:
#
@ifdef (Communication::listen_port_ssl)
redef Communication::listen_port_ssl = 47758/tcp;
redef ssl_ca_certificate = "<path>/ca_cert.pem";
redef ssl_private_key = "<path>/bro.pem";
@endif
# Redef this to T if you want to use encryption.
redef Communication::listen_encrypted = F;

# Set the SSL certificates being used to something real if you are using encryption.
#redef ssl_ca_certificate = "<path>/ca_cert.pem";
#redef ssl_private_key = "<path>/bro.pem";

redef Communication::nodes += {
["brohose"] = [$host = 127.0.0.1, $events = /brohose/, $connect=F, $ssl=F]
Expand Down
26 changes: 8 additions & 18 deletions test/broping-record.bro
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# Depending on whether you want to use encryption or not,
# include "listen-clear" or "listen-ssl":
#
# @load frameworks/communication/listen-ssl
@load frameworks/communication/listen-clear

global ping_log = open_log_file("ping");
@load frameworks/communication/listen

# Let's make sure we use the same port no matter whether we use encryption or not:
#
@ifdef (Communication::listen_port_clear)
redef Communication::listen_port_clear = 47758/tcp;
@endif
redef Communication::listen_port = 47758/tcp;

# If we're using encrypted communication, redef the SSL port and hook in
# the necessary certificates:
#
@ifdef (Communication::listen_port_ssl)
redef Communication::listen_port_ssl = 47758/tcp;
redef ssl_ca_certificate = "<path>/ca_cert.pem";
redef ssl_private_key = "<path>/bro.pem";
@endif
# Redef this to T if you want to use encryption.
redef Communication::listen_encrypted = F;

# Set the SSL certificates being used to something real if you are using encryption.
#redef ssl_ca_certificate = "<path>/ca_cert.pem";
#redef ssl_private_key = "<path>/bro.pem";


redef Communication::nodes += {
Expand Down
28 changes: 10 additions & 18 deletions test/broping.bro
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
# Depending on whether you want to use encryption or not,
# include "listen-clear" or "listen-ssl":
#
# @load frameworks/communication/listen-ssl
@load frameworks/communication/listen-clear

global ping_log = open_log_file("ping");
@load frameworks/communication/listen

# Let's make sure we use the same port no matter whether we use encryption or not:
#
@ifdef (Communication::listen_port_clear)
redef Communication::listen_port_clear = 47758/tcp;
@endif
redef Communication::listen_port = 47758/tcp;

# If we're using encrypted communication, redef the SSL port and hook in
# the necessary certificates:
#
@ifdef (Communication::listen_port_ssl)
redef Communication::listen_port_ssl = 47758/tcp;
redef ssl_ca_certificate = "<path>/ca_cert.pem";
redef ssl_private_key = "<path>/bro.pem";
@endif
# Redef this to T if you want to use encryption.
redef Communication::listen_encrypted = F;

# Set the SSL certificates being used to something real if you are using encryption.
#redef ssl_ca_certificate = "<path>/ca_cert.pem";
#redef ssl_private_key = "<path>/bro.pem";

global ping_log = open_log_file("ping");

global ping: event(src_time: time, seq: count);
global pong: event(src_time: time, dst_time: time, seq: count);
Expand Down

0 comments on commit 6597882

Please sign in to comment.