Commit graph

2284 commits

Author SHA1 Message Date
Daniel Thayer
aee307f02b Add more test cases to ascii-double.bro 2017-11-02 16:16:06 -05:00
Johanna Amann
bcd5624f79 Merge remote-tracking branch 'origin/topic/vladg/bit-1838'
* origin/topic/vladg/bit-1838:
  Add btest for new SSH curve25519 KEX
  Updates the SSH analyzer to support the "curve25519-sha256" KEX.
2017-10-05 14:35:16 -07:00
Vlad Grigorescu
6cbcfbcd49 Merge remote-tracking branch 'origin/master' into topic/vladg/bit-1838 2017-10-05 14:36:45 -05:00
Vlad Grigorescu
d7fbaad024 Add btest for new SSH curve25519 KEX 2017-10-05 14:36:13 -05:00
Jon Siwek
e7d3dd0818 Merge branch 'topic/corelight/eval-condition-crash' of https://github.com/corelight/bro
* 'topic/corelight/eval-condition-crash' of https://github.com/corelight/bro:
  Fix segmentation fault on eval condition with no return value.
2017-10-03 11:56:32 -05:00
Robin Sommer
ad6162ce44 Merge remote-tracking branch 'origin/topic/johanna/in-binary'
BIT-1845 #merged

* origin/topic/johanna/in-binary:
  Make "in" keyword work with binary data.
2017-09-21 10:00:32 -07:00
Robin Sommer
92746d3257 Merge remote-tracking branch 'origin/topic/johanna/tls13experiment'
Closes BIT-1843.

* origin/topic/johanna/tls13experiment:
  Add TLS 1.3 fix and testcase.
2017-09-21 09:43:15 -07:00
Johanna Amann
5243a054ef Fix segmentation fault on eval condition with no return value.
Signatures using an eval-condition that had no return value caused a
segmentation fault. This fix just returns false in this case, as it is
done for an interpreter error.
2017-09-19 09:23:09 -07:00
Johanna Amann
a4d25c8828 Make "in" keyword work with binary data.
This switches in from using strstr to use strnstr (implementation from
FreeBSD on systems which do not bring their own implementation).

It is especially likely that users come accross this when using the
DATA_EVENT analyzer with files that contain binary data - the test uses
exactly this case.
2017-09-18 12:12:38 -07:00
Johanna Amann
6ffa99d67e Merge remote-tracking branch 'origin/topic/dnthayer/ticket1836'
* origin/topic/dnthayer/ticket1836:
  Add test to verify that log rotation works with gzipped logs
  Fix ascii writer to not discard a ".gz" file extension

BIT-1836 #close
2017-09-15 10:57:06 -07:00
Daniel Thayer
75647a448c Add test to verify that log rotation works with gzipped logs 2017-09-15 12:17:31 -05:00
Johanna Amann
e1997144c2 Fix small OCSP parser bug.
It turns out that the serial number field in all events was never
populated correctly. Instead, the previous field (issuer key hash) was
re-read and repeated in all events.
2017-09-11 09:26:33 -07:00
Johanna Amann
1ede6bf7fe Add TLS 1.3 fix and testcase.
It turns out that Chrome supports an experimental mode to support TLS
1.3, which uses a non-standard way to negotiate TLS 1.3 with a server.
This non-standard way to negotiate TLS 1.3 breaks the current draft RFC
and re-uses an extension on the server-side with a different binary
formatting, causing us to throw a binpac exception.

This patch ignores the extension when sent by the server, continuing to
correctly parse the server_hello reply (as far as possible).

From what I can tell this seems to be google working around the fact
that MITM equipment cannot deal with TLS 1.3 server hellos; this change
makes the fact that TLS 1.3 is used completely opaque unless one looks
into a few extensions.

We currently log this as TLS 1.2.
2017-09-09 22:25:49 -07:00
Robin Sommer
5efaaf1368 Merge remote-tracking branch 'origin/fastpath' 2017-08-15 16:58:17 -07:00
Jon Siwek
fcd735cecd Fix core.truncation unit test on macOS.
The pcap file format has a global header and a header per packet.  The
global header of the pcap in question had a snaplen of 1, but with
packet headers indicating the full number of bytes saved within the
file.  It seems like the pcap file must of been artifically edited in
order for it to be this way.

When reporting the captured length of a packet, Apple's version of
libpcap now seems to report the full number of bytes saved within the
pcap's per-packet headers, but other versions seem to report the snaplen
from the global pcap header.  This caused the core.truncation test to
behave differently on macOS from other platforms.

I've manually hexedit'd the pcap so that the snaplen is still 1, but
contains just a single packet with a pcap header indicating a length of
8, which is less than the size of the link layer header and so should
still test the original code path that the unit test intended to
exercise.
2017-08-11 14:03:06 -05:00
Daniel Thayer
7127800791 Fix the expire-redef.bro test
The expire-redef.bro test was sometimes failing due to the second "Run"
message being printed after (should happen before) the "Expired"
message.  Fixed by increasing the time interval between events.

Also reduced the number of events raised to make the test finish more
quickly.
2017-08-10 14:15:31 -05:00
Daniel Thayer
c251245538 Fix a netcontrol test that often fails
The catch-and-release.bro test was failing whenever three conditions
were all true:  sorting the netcontrol.log before comparing to
the baseline, the presence of LC_ALL=C in btest.cfg changes the sort
order, and sometimes the timestamp increases slightly beginning
with one of the rule_id == 5 lines.

As a result of these three conditions, the sorted order of the lines
with rule_id of 5 were different than the baseline.

Fixed by not sorting netcontrol.log, as this doesn't seem necessary.
2017-08-07 16:26:17 -05:00
Robin Sommer
b950145c13 Merge branch 'master' of git.bro.org:bro 2017-08-04 14:17:10 -07:00
Seth Hall
dbac2b1abb Addresses BIT-1831
There is apparently some situation where a field wasn't being populated
which resulted in a reporter messsage.

Thanks to the report from Chris Herdt!
2017-08-01 16:24:44 -04:00
Robin Sommer
faa4150154 Merge remote-tracking branch 'origin/topic/johanna/ocsp-sct-validate'
Closes #1830.

* origin/topic/johanna/ocsp-sct-validate: (82 commits)
  Tiny script changes for SSL.
  Update CT Log list
  SSL: Update OCSP/SCT scripts and documentation.
  Revert "add parameter 'status_type' to event ssl_stapled_ocsp"
  Revert "parse multiple OCSP stapling responses"
  SCT: Fix script error when mime type of file unknown.
  SCT: another memory leak in SCT parsing.
  SCT validation: fix small memory leak (public keys were not freed)
  Change end-of-connection handling for validation
  OCSP/TLS/SCT: Fix a number of test failures.
  SCT Validate: make caching a bit less aggressive.
  SSL: Fix type of ssl validation result
  TLS-SCT: compile on old versions of OpenSSL (1.0.1...)
  SCT: Add caching support for validation
  SCT: Add signed certificate timestamp validation script.
  SCT: Allow verification of SCTs in Certs.
  SCT: only compare correct OID/NID for Cert/OCSP.
  SCT: add validation of proofs for extensions and OCSP.
  SCT: pass timestamp as uint64 instead of time
  Add CT log information to Bro
  ...
2017-07-30 08:49:41 -07:00
Robin Sommer
c609177cf0 Merge remote-tracking branch 'origin/topic/johanna/http-percent'
* origin/topic/johanna/http-percent:
  Better handling of % at end of line.
2017-07-28 10:06:51 -07:00
Johanna Amann
3bb05693d9 Add canonifier to catch and release test that should fix test failures. 2017-07-28 09:40:58 -07:00
Johanna Amann
ade9aa219b Better handling of % at end of line. 2017-07-27 22:04:47 -07:00
Johanna Amann
9594f69598 SSL: Update OCSP/SCT scripts and documentation. 2017-07-27 16:22:40 -07:00
Johanna Amann
9126376581 Revert "add parameter 'status_type' to event ssl_stapled_ocsp"
This reverts commit 545848d906.

Revert further part of stapled OCSP response handling that probably
never worked.
2017-07-27 15:12:19 -07:00
Johanna Amann
924482d540 Merge remote-tracking branch 'origin/master' into topic/johanna/ocsp-sct-validate 2017-07-27 14:24:48 -07:00
Johanna Amann
089f87d8da Merge remote-tracking branch 'origin/topic/robin/plugin-version-check'
I added another small change - since we are inlining Configure(), we can
just set bro_plugin directly to BRO_PLUGIN_BRO_VERSION in
src/plugin/Plugin.h, instead of depending on the plugin to do it. This
also means we do not need to change init-plugin in bro-aux at this
moment.

BIT-1828 #closed

* origin/topic/robin/plugin-version-check:
  Adding plugin API number into versioned function name, and removing old runtime API version check.
  Extend plugin infrastructure to catch Bro version mismatches at link time.
2017-07-25 16:14:49 -07:00
Robin Sommer
78f8ff432f Adding plugin API number into versioned function name, and removing
old runtime API version check.
2017-07-21 13:25:56 -07:00
Seth Hall
71c9945f26 Several fixes and improvements for software version parsing.
- Addresses Philip Romero's question from the Bro mailing list.
 - Adds Microsoft Edge as a detected browser.
 - We are now unescaping encoded characters in software names.
2017-07-13 02:22:03 -04:00
Johanna Amann
b7a7e45a07 Merge remote-tracking branch 'origin/master' into topic/johanna/ocsp-sct-validate 2017-06-26 11:16:08 -07:00
Robin Sommer
7ff5ca1df9 Merge remote-tracking branch 'origin/topic/dnthayer/ticket1821'
* origin/topic/dnthayer/ticket1821:
  Remove loading of listen.bro in tests that do not need it
  Serialize tests that load listen.bro
  Fix race condition causing some tests to fail
  Fix a race condition in some failing tests
  The broccoli-v6addrs "-r" option was renamed to "-R"
  Fix a race condition in some failing tests
2017-06-14 07:25:04 -07:00
Johanna Amann
1ad5b12ef8 Fix at_least in Version.bro.
at_least did extactly the opposite from what it said.
2017-06-05 15:16:41 -07:00
Daniel Thayer
e9102f3de4 Remove loading of listen.bro in tests that do not need it
Removed the loading of "frameworks/communication/listen" from some
tests that don't need that functionality.  This is to avoid
serializing these tests.
2017-05-24 21:28:56 -05:00
Daniel Thayer
361a5dc2d8 Serialize tests that load listen.bro
Tests that load "frameworks/communication/listen" must be serialized
to prevent other tests failing due to multiple Bro instances trying
to listen on the same port.
2017-05-24 21:25:01 -05:00
Daniel Thayer
bd2d559fbf Fix race condition causing some tests to fail
Removed loading of the "frameworks/communication/listen" script for
a couple of tests that don't need this functionality.  This was causing
failures of some broccoli-related tests in the "istate" test directory
due to two instances of Bro trying to listen on the same port.
2017-05-24 14:45:11 -05:00
Daniel Thayer
961c247777 Fix a race condition in some failing tests
Use the new "-R" option for broccoli-vectors and broping so that
they will retry connecting to Bro until the connection is established.
This avoids a race condition and eliminates the need for a "sleep"
after starting Bro.
2017-05-24 13:13:20 -05:00
Daniel Thayer
34551dda15 The broccoli-v6addrs "-r" option was renamed to "-R" 2017-05-24 13:10:26 -05:00
Jon Siwek
5540b228e5 Merge branch 'nfs_changes' of https://github.com/jwallior/bro
* 'nfs_changes' of https://github.com/jwallior/bro:
  Add nfs unittest. Includes an example for the new nfs_proc_rename.
  Added rename event to rpc/nfs protocol analyzer. 	This event identifies and reports information 	about nfs/rpc calls and replies of the type 	rename.
  Expand parsing of RPC Call packets to add Uid, Gid, Stamp, MachineName and AuxGIDs
  Fix NFS protocol parser.
2017-05-22 20:35:56 -05:00
Daniel Thayer
f336aa5084 Fix a race condition in some failing tests
The tests that were using the broccoli-v6addrs test program would
sometimes fail because broccoli-v6addrs would try to connect to Bro
and fail (presumably because Bro hadn't yet fully initialized).
Fixed by using the new broccoli-v6addrs "-r" option which will retry
upon failure to connect to Bro.
2017-05-22 14:32:59 -05:00
Jon Siwek
4d06ee85ce Merge branch 'topic/corelight/ascii-gzip' of https://github.com/corelight/bro
* 'topic/corelight/ascii-gzip' of https://github.com/corelight/bro:
  Add gzip log writing to the ascii writer.
2017-05-22 00:10:09 -05:00
Julien Wallior
9a75c52726 Add nfs unittest. Includes an example for the new nfs_proc_rename. 2017-05-18 08:41:52 -04:00
Johanna Amann
876f492a35 OCSP/TLS/SCT: Fix a number of test failures.
These were caused by earlier code updates.

This commit also removes the ocsp stapling logging script; it was
defunctional and the information provided by it wnever really has been
especially interesting.
2017-05-06 08:01:20 -07:00
Jon Siwek
874d2b9fb0 Merge branch 'topic/corelight/logging-hooks' of https://github.com/corelight/bro
* 'topic/corelight/logging-hooks' of https://github.com/corelight/bro:
  Plugin: Add hooks for log init and writing.
2017-05-04 11:44:43 -05:00
Johanna Amann
684ea8aa37 Plugin: Add hooks for log init and writing.
The two hooks being added are:

void HookLogInit(const std::string& writer, const std::string& instantiating_filter, bool local, bool remote, const logging::WriterBackend::WriterInfo& info, int num_fields, const threading::Field* const* fields);

which is called when a writer is being instantiated and contains
information about the fields being logged, as well as

bool HookLogWrite(const std::string& writer, const std::string& filter, const logging::WriterBackend::WriterInfo& info, int num_fields, const threading::Field* const* fields, threading::Value** vals);

which is called for each log line being written by each writer. It
contains all the data being written. The data can be changed in the
function call and lines can be prevented from being written.

This commit also fixes a few small problems with plugin hooks itself,
and extends the tests that were already there, besides introducing tests
for the added functionality.
2017-04-24 14:02:05 -07:00
Johanna Amann
c868a19a28 Add gzip log writing to the ascii writer.
This feature can be enabled globally for all logs by setting
LogAscii::gzip_level to a value greater than 0.

This feature can be enabled on a per-log basis by setting gzip-level in
$confic to a value greater than 0.
2017-04-24 13:15:32 -07:00
Johanna Amann
333bb71ed1 Add rename, unlink, and rmdir bifs. 2017-04-24 11:58:05 -07:00
Robin Sommer
bf15ff4c83 Merge remote-tracking branch 'origin/topic/johanna/tls13-extensions'
* origin/topic/johanna/tls13-extensions:
  Add support for two TLS 1.3 extensions.
2017-04-21 14:15:23 -07:00
Johanna Amann
9e302c7e89 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix some failing tests
2017-04-10 13:31:17 -07:00
Daniel Thayer
817b9e01a3 Fix some failing tests
Increase delay time before launching 2nd process to give bro more of a
chance to startup.
2017-04-10 15:24:21 -05:00
Johanna Amann
a3b664c77d Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix the test group name in some broker test files
2017-04-07 10:33:47 -07:00