Commit graph

5140 commits

Author SHA1 Message Date
Jon Siwek
70131b5c84 Refactor SerializationFormat::EndWrite and ChunkedIO::Chunk mem mgmt.
SerializationFormat::EndWrite now transfers ownership of the buffer
to the caller instead of doing a memcpy.

ChunkedIO::Chunk is no longer a POD type, hopefully the ctor/dtor
make it easier to manage its associated memory.  It also now
tracks how to deallocate its buffer (i.e. delete vs. free).
2014-03-18 14:42:38 -05:00
Seth Hall
a07a40dc86 Now the standalone sumstats works even if Bro is shutting down by blocking. 2014-03-17 16:45:36 -04:00
Seth Hall
af36915186 Change the standalone sumstats mode to work incrementally. 2014-03-17 16:06:14 -04:00
Robin Sommer
bf6f21041c Updating submodule(s).
[nomail]
2014-03-17 09:18:01 -07:00
Jon Siwek
07a4a8d147 Merge branch 'master' into topic/jsiwek/faster-val-clone 2014-03-17 11:05:08 -05:00
Robin Sommer
13081c984c Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  update submodules
  Fix compile errror on freebsd - defines have to be moved up due to header dependencies.
2014-03-17 08:25:24 -07:00
Bernhard Amann
66ec267b2a update submodules 2014-03-17 00:11:27 -07:00
Bernhard Amann
636d25e526 Fix compile errror on freebsd - defines have to be moved up due to
header dependencies.
2014-03-16 22:22:44 -07:00
Robin Sommer
908b574c18 Updating submodule(s).
[nomail]
2014-03-16 07:47:06 -07:00
Jon Siwek
6595c7c75b Improve SerializationFormat's write buffer growth strategy. 2014-03-14 17:26:38 -05:00
Robin Sommer
8061a34b3e Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Derive results of DNS lookups from from input when in BRO_DNS_FAKE mode.

BIT-1134 #closed
2014-03-14 10:24:26 -07:00
Jon Siwek
dbe5dfb3c3 Derive results of DNS lookups from from input when in BRO_DNS_FAKE mode.
Addresses BIT-1134.
2014-03-14 12:01:09 -05: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
Robin Sommer
8b241947d6 Fixing a few cases of undefined behaviour introduced by recent
formatter work.

Thanks, Coverity!
2014-03-14 08:45:36 -07:00
Robin Sommer
17f9d0a47d Fixing compiler error.
Hopefully ...
2014-03-13 18:02:41 -07:00
Robin Sommer
00755f1e40 Fixing (very unlikely) double delete in HTTP analyzer when decapsulating
CONNECTs.

BIT-1149 #closed
2014-03-13 16:51:21 -07:00
Robin Sommer
ff261ea626 Merge remote-tracking branch 'origin/topic/seth/json-formatter'
* origin/topic/seth/json-formatter:
  Updating a couple of tests.
  Expanded support for modifying the timestamp format in the JSON formatter.
  Ascii input reader now supports all config options per-input stream.
  Added an option to the JSON formatter to use ISO 8601 for timestamps.
  Refactored formatters and updated the the writers a bit.

Includes some minor bugfixes and cleanup at various places, including
in old code.
2014-03-13 16:50:56 -07:00
Bernhard Amann
285de1390a Forgot the preamble for the new leak test 2014-03-13 16:20:49 -07:00
Bernhard Amann
d42d9bbc3f (hopefully) last change -> return real opaque vec instead of any_vec 2014-03-13 16:10:59 -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
Bernhard Amann
4da0718511 Finishing touches of the x509 file analyzer.
Mostly baseline updates and new tests.

addresses BIT-953, BIT-760, BIT-1150
2014-03-13 15:21:30 -07:00
Robin Sommer
4eb81de08e Refactoring code to reuse ApplyScheduledAnalyzers().
This is potentially changing the exact time when the
scheduled_analyzer_applied() event is executed, but that should be
fine afaict.
2014-03-13 15:00:19 -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
Robin Sommer
a90bf11e35 Merge remote-tracking branch 'origin/topic/jsiwek/flip-roles'
* origin/topic/jsiwek/flip-roles:
  Improve analysis of TCP SYN/SYN-ACK reversal situations.
  Fix bug in Connection::FlipRoles, addresses BIT-1148.

BIT-1148 #merged
2014-03-13 14:15:29 -07:00
Bernhard Amann
74d728656d Revert change to only log certificates once per hour.
addresses BIT-953, BIT-760, BIT-1150
2014-03-13 13:38:44 -07:00
Bernhard Amann
b0c3486fd6 Merge remote-tracking branch 'origin/master' into topic/bernhard/file-analysis-x509 2014-03-13 00:09:48 -07:00
Bernhard Amann
0d50b8b04f Change x509 log - now certificates are only logged once per hour.
Add parsing of several more types to SAN extension.

Make error messages of x509 file analyzer more useful.

Fix file ID generation.

You apparently have to be very careful which EndOfFile function of
the file analysis framework you call... otherwhise it might try
to close another file id. This took me quite a while to find.

addresses BIT-953, BIT-760, BIT-1150
2014-03-13 00:05:48 -07:00
Robin Sommer
a42b865bed Updating submodule(s).
[nomail]
2014-03-12 17:23:48 -07:00
Robin Sommer
3065c20712 Merge remote-tracking branch 'origin/topic/jsiwek/jemalloc'
* origin/topic/jsiwek/jemalloc:
  Fix --with-jemalloc and make it imply --enable-jemalloc.
  Teach configure script --enable-jemalloc, --with-jemalloc.

BIT-1128 #merged
2014-03-12 17:23:35 -07:00
Robin Sommer
04dc318806 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Improve DBG_LOG macro (perf. improvement for --enable-debug mode).
  Misc. documentation fixes.
2014-03-12 17:20:14 -07:00
Jon Siwek
302c063874 Improve DBG_LOG macro (perf. improvement for --enable-debug mode).
Many usages of this macro do some string formatting work inline in the
arguments that end up being unnecessary because the debug stream is
disabled.
2014-03-12 15:59:05 -05:00
Seth Hall
ed7f658ee2 Updating a couple of tests. 2014-03-12 10:10:40 -04:00
Seth Hall
c591e4f57f Expanded support for modifying the timestamp format in the JSON formatter. 2014-03-12 10:01:59 -04:00
Seth Hall
6cd9358a71 Ascii input reader now supports all config options per-input stream. 2014-03-12 10:01:17 -04: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
063200c71a Merge branch 'master' into topic/jsiwek/flip-roles 2014-03-11 16:41:03 -05:00
Jon Siwek
d3f88ba9d1 Improve performance of MHR script, addresses BIT-1139.
The MHR script involves a "when" statement which can be expensive due to
the way it clones frames/vals.  In this case, the fa_file record is
expensive to clone, but this change works around that by unrolling only
the necessary fields from it that are needed to populate a Notice::Info
record.  A drawback to this is that the full fa_file or connection
records aren't available in the Notice::Info record when evaluating
Notice::policy hooks for MHR hit notices (though they can possibly be
recovered by using e.g. the lookup_connection() builtin_function).
2014-03-11 13:18:14 -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
Jon Siwek
01dde0b19f Fix --with-jemalloc and make it imply --enable-jemalloc. 2014-03-10 14:48:13 -05:00
Jon Siwek
ea432102a8 Teach configure script --enable-jemalloc, --with-jemalloc.
Addresses BIT-1128.
2014-03-10 14:36:42 -05:00
Seth Hall
c9aaf9e753 Added an option to the JSON formatter to use ISO 8601 for timestamps.
- It's not *exactly* ISO 8601 which doesn't seem to support
   subseconds, but subseconds are very important to us and
   most things that support ISO8601 seem to also support subseconds
   in the way I'm implemented it.
2014-03-10 14:22:35 -04:00
Robin Sommer
18eb31a6df Merge remote-tracking branch 'origin/topic/jsiwek/bit-1153'
* origin/topic/jsiwek/bit-1153:
  Fix non-deterministic logging of unmatched DNS msgs, addresses BIT-1153

BIT-1153 #merged
2014-03-10 11:10:36 -07:00
Jon Siwek
f30d3e635e Fix non-deterministic logging of unmatched DNS msgs, addresses BIT-1153
Unmatched DNS messages may fail to be logged sometimes due to a type of
iterator invalidation.
2014-03-10 11:34:57 -05:00
Seth Hall
a56c343715 Refactored formatters and updated the the writers a bit.
- Formatters have been abstracted similarly to readers and writers now.
 - The Ascii writer has a new option for writing out logs as JSON.
 - The Ascii writer now has all options availble as per-filter
   options as well as global.
2014-03-10 10:42:59 -04:00
Robin Sommer
69d52feb18 Merge remote-tracking branch 'origin/topic/seth/dns-srv-fix'
* origin/topic/seth/dns-srv-fix:
  No longer accidentally attempting to parse NBSTAT RRs as SRV RRs.
  Fix DNS SRV responses and a small issue with NBNS queries and label length.

BIT-1147 #merged
2014-03-09 08:59:48 -07:00
Seth Hall
83ec05bb4a Merge remote-tracking branch 'origin/topic/bernhard/ssl-failure'
* origin/topic/bernhard/ssl-failure:
  only call disable_analyzer if the connection is still open.
  update test baselines
  At the moment, SSL connections where the ssl_established event does not fire are not logged.
2014-03-06 22:56:15 -05:00
Jon Siwek
2f5f0d8408 Fix bug in Connection::FlipRoles, addresses BIT-1148.
It didn't swap address values right and also didn't consider that
analyzers might be scheduled for the new connection tuple.

Issues were reported by Kevin McMahon, thanks.
2014-03-06 17:08:45 -06:00
Jon Siwek
095a68b2ec Various minor changes related to file mime type detection.
- Improve or just remove some file magic signatures ported from libmagic
  that were too general and matched incorrectly too often.

- Fix MHR script's use of fa_file$mime_type before checking if it's
  initialized.  It may be uninitialized if no signatures match.

- The "fa_file" record now contains a "mime_types" field that contains
  all magic signatures that matched the file content (where the
  "mime_type" field is just a shortcut for the strongest match).
2014-03-06 11:41:10 -06:00
Seth Hall
bcdffe3212 No longer accidentally attempting to parse NBSTAT RRs as SRV RRs.
The NetBios name service RFC (1002) specified NBSTAT (NetBios Status)
resource records to have identifier 0x0021.  The DNS SRV RFC specified
SRV records to have identifier 33.  Unfortunately those are the
same number. :)

We now check the resp port to handle this situation better so that
we won't be attempting to parse NBSTAT records as SRV (which
causes several weird messages).
2014-03-06 09:06:23 -05:00
Seth Hall
9743959995 Fix DNS SRV responses and a small issue with NBNS queries and label length.
- DNS SRV responses never had the code written to actually
   generate the dns_SRV_reply event.  Adding this required
   extending the event a bit to add extra information.  SRV responses
   now appear in the dns.log file correctly.

 - Fixed an issue where some Microsoft NetBIOS Name Service lookups
   would exceed the max label length for DNS and cause an incorrect
   "DNS_label_too_long" weird.
2014-03-05 16:11:06 -05:00