Commit graph

416 commits

Author SHA1 Message Date
Jon Siwek
5a73c11baa broker integration: fix memory leak, add leak tests
Leak tests won't pass w/ libcaf 0.12.2, needs the develop branch
(actor-framework@a89485a3098965f104264808994fabfbc3a1bf61).
2015-02-12 11:40:04 -06:00
Vlad Grigorescu
b259a41ef2 Merge remote-tracking branch 'origin/master' into topic/vladg/mysql
Conflicts:
	testing/btest/Baseline/coverage.bare-load-baseline/canonified_loaded_scripts.log
	testing/btest/Baseline/coverage.default-load-baseline/canonified_loaded_scripts.log
	testing/btest/Baseline/scripts.policy.misc.dump-events/all-events.log
2014-10-27 13:24:31 -04:00
Robin Sommer
3e669daa05 Interface tweaks for PktSrc, plus docs for PktSrc and PktDumper. 2014-08-28 00:52:36 -04:00
Robin Sommer
5f817513d0 A set of various fixes and smaller API tweaks, plus tests.
Also moving PCAP-related bifs to iosource/pcap.bif.
2014-08-24 19:55:26 -07:00
Robin Sommer
8737eae906 Move DataSeries and ElasticSearch into plugins. 2014-08-08 18:32:21 -07:00
Vlad Grigorescu
49a2198dd5 Add memleak and auth btests. 2014-08-06 10:13:22 -05:00
Robin Sommer
f4cbcb9b03 Converting log writers and input readers to plugins. 2014-07-20 19:17:58 +02:00
Robin Sommer
62d07a3fc4 Merge branch 'topic/robin/dynamic-plugins-2.3' of git.bro.org:bro into topic/robin/dynamic-plugins-2.3 2014-06-18 14:44:26 -07:00
Robin Sommer
c24bb9cacd Adding a test building a file analyzer plugin.
Also cleaning up, and moving, the other plugin tests.
2014-06-18 14:33:42 -07:00
Robin Sommer
ba7af428a7 Merge remote-tracking branch 'origin/master' into topic/robin/dynamic-plugins-2.3 2014-06-13 09:27:02 -07:00
Robin Sommer
ed4cd9352a Merge remote-tracking branch 'origin/topic/bernhard/even-more-ssl-changes'
Good stuff! (but I admit I didn't look at the OpenSSL code too closely :)

* origin/topic/bernhard/even-more-ssl-changes:
  small test update & script fix
  update baselines & add ocsp leak check
  Add policy script adding ocsp validation to ssl.log
  Implement verification of OCSP replies.
  Add tls flag to smtp.log. Will be set if a connection switched to startls.
  add starttls support for pop3
  Add smtp starttls support
  Replace errors when parsing x509 certs with weirds (as requested by Seth).
  move tls content types from heartbleed to consts.bro. Seems better to put them there...
  Add new features from other branch to the heartbleed-detector (and clean them up).
  Let TLS analyzer fail better when no longer in sync with the data stream. The version field in each record-layer packet is now re-checked.

BIT-1190 #merged

Conflicts:
	testing/btest/Baseline/scripts.policy.misc.dump-events/all-events.log
	testing/btest/Baseline/scripts.policy.misc.dump-events/smtp-events.log
2014-05-16 14:45:25 -07:00
Bernhard Amann
5db240f291 update baselines & add ocsp leak check 2014-05-16 11:23:44 -07:00
Robin Sommer
79531a4538 Making test more stable. 2014-05-15 15:41:19 -07:00
Robin Sommer
6b3f11493d Making a test's output predictable.
Plus, a baseline update.
2014-05-15 15:04:26 -07:00
Vlad Grigorescu
9ab4744072 Radius functionality and memleak test. 2014-05-15 11:49:03 -04:00
Robin Sommer
bbd409d274 Merge remote-tracking branch 'origin/master' into topic/robin/dynamic-plugins-2.3
(Never good to name a branch after version anticipated to include it ...)
2014-05-14 16:23:04 -07:00
Robin Sommer
116ed370a2 Merge remote-tracking branch 'origin/topic/jsiwek/bit-348'
* origin/topic/jsiwek/bit-348:
  Update SNMP analyzer's DeliverPacket method signature.
  Fix reassembly of data w/ sizes beyond 32-bit capacities (BIT-348).

Conflicts:
	src/analyzer/protocol/file/File.cc
	src/analyzer/protocol/file/File.h
2014-04-24 18:14:04 -07:00
Bernhard Amann
3d22692b6e Fix a few failing tests 2014-04-24 14:45:06 -07:00
Jon Siwek
13d8908a8d Fix a memory leak in ASCII log writer. 2014-04-14 16:53:49 -05:00
Jon Siwek
f3bb4a455f Merge branch 'master' into topic/jsiwek/bit-348 2014-04-09 13:14:32 -05:00
Jon Siwek
2b3c2bd394 Fix reassembly of data w/ sizes beyond 32-bit capacities (BIT-348).
The main change is that reassembly code (e.g. for TCP) now uses
int64/uint64 (signedness is situational) data types in place of int
types in order to support delivering data to analyzers that pass 2GB
thresholds.  There's also changes in logic that accompany the change in
data types, e.g. to fix TCP sequence space arithmetic inconsistencies.

Another significant change is in the Analyzer API: the *Packet and
*Undelivered methods now use a uint64 in place of an int for the
relative sequence space offset parameter.
2014-04-09 13:03:24 -05:00
Robin Sommer
cf7e25643e Merge remote-tracking branch 'origin/topic/jsiwek/snmp'
* origin/topic/jsiwek/snmp:
  Add memory leak unit test for SNMP.
  Fix compiler nitpicks from new SNMP code.
  Add SNMP datagram parsing support.

BIT-1142
2014-04-08 15:31:03 -07:00
Robin Sommer
e8339d5c63 Merge remote-tracking branch 'origin/topic/bernhard/file-analysis-x509'
* origin/topic/bernhard/file-analysis-x509:
  Forgot the preamble for the new leak test
  (hopefully) last change -> return real opaque vec instead of any_vec
  Fix dump-events - it cannot be used with ssl anymore, because openssl does not give the same string results in all versions.
  Finishing touches of the x509 file analyzer.
  Revert change to only log certificates once per hour.
  Change x509 log - now certificates are only logged once per hour.
  Fix circular reference problem and a few other small things.
  X509 file analyzer nearly done. Verification and most other policy scripts work fine now.
  Add verify functionality, including the ability to get the validated chain. This means that it is now possible to get information about the root-certificates that were used to secure a connection.
  Second try on the event interface.
  Backport crash fix that made it into master with the x509_extension backport from here.
  Make x509 certificates an opaque type
  rip out x509 code from ssl analyzer. Note that since at the moment the file analyzer does not yet re-populate the info record that means quite a lot of information is simply not available.
  parse out extension. One event for general extensions (just returns the openssl-parsed string-value), one event for basicconstraints (is a certificate a CA or not) and one event for subject-alternative-names (only DNS parts).
  Very basic file-analyzer for x509 certificates. Mostly ripped from the ssl-analyzer and the topic/bernhard/x509 branch.
2014-03-14 09:53:07 -07:00
Bernhard Amann
285de1390a Forgot the preamble for the new leak test 2014-03-13 16:20:49 -07:00
Bernhard Amann
3f52eeacda Fix dump-events - it cannot be used with ssl anymore, because openssl
does not give the same string results in all versions.

Add leak test for x509 verify and fix small leak (type).
2014-03-13 15:41:57 -07:00
Robin Sommer
126bd298fe Merge remote-tracking branch 'origin/topic/jsiwek/dns_fake'
* origin/topic/jsiwek/dns_fake:
  Teach async DNS lookup builtin-functions about BRO_DNS_FAKE.
2014-03-13 14:27:44 -07:00
Jon Siwek
066473b1f1 Improve analysis of TCP SYN/SYN-ACK reversal situations.
- Since it's just the handshake packets out of order, they're no
  longer treated as partial connections, which some protocol analyzers
  immediately refuse to look at.

- The TCP_Reassembler "is_orig" state failed to change, which led to
  protocol analyzers sometimes using the wrong value for that.

- Add a unit test which exercises the Connection::FlipRoles() code
  path (i.e. the SYN/SYN-ACK reversal situation).

Addresses BIT-1148.
2014-03-11 17:03:59 -05:00
Jon Siwek
da338c8ffe Teach async DNS lookup builtin-functions about BRO_DNS_FAKE.
And enable fake DNS mode for test suites.

Addresses BIT-1134.
2014-03-10 16:51:04 -05:00
Robin Sommer
02ab000b81 Merge remote-tracking branch 'origin/master' into topic/robin/http-connect
Conflicts:
	scripts/base/protocols/ssl/consts.bro
2014-03-02 13:55:13 -08:00
Robin Sommer
338d521003 Fixing removal of support analyzers, plus some tweaking and cleanup of
CONNECT code.

Removal of support analyzers was broken. The code now actually doesn't
delete them immediately anymore but instead just flags them as
disabled. They'll be destroyed with the parent analyzer later.

Also includes a new leak tests exercising the CONNECT code.

Lines starting # with '#' will be ignored, and an empty message aborts
the commit. # On branch topic/robin/http-connect # Changes to be
committed: # modified: scripts/base/protocols/http/main.bro #
modified: scripts/base/protocols/ssl/consts.bro # modified:
src/analyzer/Analyzer.cc # modified: src/analyzer/Analyzer.h #
modified: src/analyzer/protocol/http/HTTP.cc # new file:
testing/btest/core/leaks/http-connect.bro # modified:
testing/btest/scripts/base/protocols/http/http-connect.bro # #
Untracked files: # .tags # changes.txt # conn.log # debug.log # diff #
mpls-in-vlan.patch # newfile.pcap # packet_filter.log # reporter.log #
src/PktSrc.cc.orig # weird.log #
2014-03-02 13:52:32 -08:00
Bernhard Amann
80c319b522 adjust timings of a few leak tests.
Without the longer timeouts, these consistently fail for me
on caddy when doing "make test".
2014-02-26 14:47:40 -08:00
Jon Siwek
2636d3aee7 Add memory leak unit test for SNMP. 2014-02-18 15:58:53 -06:00
Robin Sommer
ba81aa4387 Support for MPLS over VLAN.
Patch by Chris Kanich.

BIT-1017 #merged
2014-02-14 12:07:24 -08:00
Robin Sommer
a57f0ef9a0 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Increase timeouts of some unit tests.
  Fix memory leak in modbus analyzer.
  add channel_id tls extension number.
2014-02-13 12:45:02 -08:00
Jon Siwek
e844727e73 Increase timeouts of some unit tests. 2014-02-12 17:03:51 -06:00
Robin Sommer
d81bfed45d Fixing memory leaks in input framework. 2014-02-06 17:58:56 -08:00
Robin Sommer
4621745906 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Also use exec-module test to check for leaks.
2014-01-30 16:02:22 -08:00
Bernhard Amann
62b3cb0a5b Also use exec-module test to check for leaks. 2014-01-28 12:28:12 -08:00
Robin Sommer
3f47c5bc87 Merge remote-tracking branch 'origin/master' into topic/robin/dynamic-plugins-2.3 2014-01-24 20:26:00 -08:00
Jon Siwek
9b12967d40 Improve gap reporting in TCP connections that never see data.
The previous behavior was to accomodate SYN/FIN/RST-filtered traces by
not reporting missing data (via the content_gap event) for such
connections.  The new behavior always reports gaps for connections that
are established and terminate normally, but sequence numbers indicate
that all data packets of the connection were missed.  The behavior can
be reverted by redef'ing "detect_filtered_trace".
2014-01-24 16:21:02 -06:00
Jon Siwek
5b3573394e Improve TCP FIN retransmission handling.
In the case multiple FIN packets are seen from a TCP endpoint (e.g.
when one is retransmitted), only the first counted towards a byte in the
sequence space.  This could cause a subsequent FIN packet to induce an
incorrect wrap around in the sequence numbers (e.g.  the retransmitted
FIN packet now is one sequence number behind the the first) and
misleadingly large connection sizes.  The change is to always treat a
FIN packet as counting one byte in to the sequence space.
2014-01-24 15:51:58 -06:00
Robin Sommer
fdd386a898 A test with a plugin exercising all hooks. 2014-01-22 14:35:31 -08:00
Robin Sommer
ea01a1be30 Reworking plugin interface to not rely on macros.
The Plugin.cc file is now just a standard class, with the interface
changed a bit to make it more easy to write. However, there're still
some conventions that one must follow to make everything work (like
using the right namespace structure).

This commit also includes the option to compile built-in plugins
dynamically instead of statically by adding
SET(BRO_PLUGIN_BUILD_DYNAMIC TRUE) to their CMake config. This hasn't
been tested much yet, and I'm still undecided if it's somethign we
would want to do by default--but we could now if wanted. :)

Also some minor other cleanup of plugin APIs and built infrastructure.

All tested on MacOS only currently.
2014-01-20 13:39:11 -08:00
Jon Siwek
7717a3eb67 BIT-867 - Support GRE tunnel decapsulation.
This includes enhanced GRE headers.  GRE tunnels are treated just like
IP-in-IP tunnels by parsing past the GRE header in between the delivery
and payload IP packets.
2014-01-16 16:03:04 -06:00
Robin Sommer
b91b62b2b1 Test updates. 2013-12-16 11:57:57 -08:00
Robin Sommer
a80dd10215 Updates of the dynamic plugin code.
Includes:

    - Cleanup of the plugin API, in particular generally changing
      const char* to std::string

    - Renaming environment variable BRO_PLUGINS to BRO_PLUGIN_PATH,
      defaulting to <prefix>/lib/bro/plugins

    - Reworking how dynamic plugins are searched and activated. See
      doc/devel/plugins.rst for details.

    - New @load-plugin directive to explicitly activate a plugin

    - Support for Darwin. (Linux untested right now)

    - The init-plugin updates come with support for "make test", "make
      sdist", and "make bdist" (see how-to).

    - Test updates.

Notes: The new hook mechanism, which allows plugins to hook into Bro's
core a well-defined points, is still essentially untested.
2013-12-16 11:57:56 -08:00
Jon Siwek
63c36d58f3 Another attempt to improve core.when-interpreter-exceptions unit test.
lookup_hostname("localhost") occassionally timed out (after allowed 10
secs) when running test suite on some systems.  Not sure why, but
changed to use the Exec module for when block conditions instead as the
scope of the test doesn't depend on a particular type of condition, it
just needs something that will work reliably/quickly.
2013-12-11 14:28:23 -06:00
Bernhard Amann
504d22b91b fix memory leak in input framework.
If the input framework was used to read event streams and
those streams contained records with more than one field, not all
elements of the threading Values were cleaned up.

The reason for this is, that the SendEventStreamEvent function
returned the number of record elements in the outmost record
instead of the number of unrolled elements in the whole vector.

This number is later used to determine how many objects to delete.

Also - add a whole bunch of leak checks for the input framework
that would have caught that and should cover quite a number of
use-cases.
2013-12-05 10:53:12 -08:00
Jon Siwek
2ea6011186 Improve a unit test involving 'when' conditionals.
May fix a sporadic failure, in which case it was just not getting enough
time to run or lookup_hostname() taking longer than ~3 seconds.  Else,
the new output should give more hints on what's going wrong.  In any
case, termination conditions for the test are now explicit.
2013-12-03 16:51:36 -06:00
Robin Sommer
555df1e7ea Checkpointing the dynamic plugin code.
This is essentially the code from the dynamic-plugin branch except for
some pieces that I have split out into separate, earlier commits.

I'm going to updatre things in this branch going forward.
2013-11-26 14:04:29 -08:00