Commit graph

3724 commits

Author SHA1 Message Date
Seth Hall
9e2ddac572 Fixes for known-services.
- I was wildly misunderstanding the semantics of the
  connection_state_remove event.  That's fixed now in
  my brain and in the script.

- If a service isn't detected, logging is delayed by
  2 minutes to try and allow for another connection
  to happen that actually does the protocol correctly
  and detectably.
2011-09-28 12:51:44 -04:00
Seth Hall
6b52ca5222 Small changes for the capture-loss script make the output more understandable. 2011-09-28 11:19:15 -04:00
Seth Hall
c621da523b Since these now measure "seen" data, set the default to 0.
- A null value no longer fits since if there is no body
  a value of zero makes sense.  Previously, a null value would
  makes sense because the Content-Length header may not have
  been sent which would leave the field null.
2011-09-28 11:18:24 -04:00
Seth Hall
6db77dc285 Ported the capture-loss script back into Bro.
- I removed the byte loss estimate since everything indicated that
  it could frequently be inaccurate.

- It has it's own logging stream now.  Notices are only used
  when too much loss has been detected (CaptureLoss::Too_Much_Loss)

- The gap_report event isn't used anymore.  I'm scheduling events
  to get the same effect by using the get_gap_summary BiF to
  collect the gap summary on demand.
2011-09-28 00:08:53 -04:00
Jon Siwek
7af3977a50 Change logging of HTTP 1xx responses to occur in their own columns.
Instead of as entirely new log lines (addresses #411).
2011-09-27 14:15:23 -05:00
Seth Hall
8db949678d Fix a small bug in the metrics framework. 2011-09-27 14:42:55 -04:00
Seth Hall
19f1e34408 Deleting scripts that aren't ready to be included.
- scan.bro and hot.conn.bro will be returning soon.

- The rest are going to return as updated protocol analysis
  scripts and new/updated frameworks later.
2011-09-27 14:40:11 -04:00
Jon Siwek
a71ab223c4 Various unit test cleanup.
Updated README and collected coverage-related tests in a common dir.

There are still coverage failures resulting from either the following
scripts not being @load'd in the default bro mode:

base/frameworks/time-machine/notice.bro
base/protocols/http/partial-content.bro
base/protocols/rpc/main.bro

Or the following result in errors when @load'd:

policy/protocols/conn/scan.bro
policy/hot.conn.bro

If these are all scripts-in-progress, can we move them all to live
outside the main scripts/ directory until they're ready?
2011-09-27 12:41:30 -05:00
Jon Siwek
64e821624b Fix handling of HTTP 1xx response codes (addresses #411).
Changed the parser to not treat 1xx response codes as a final answer
to an unanswered request -- a later response is still expected.

The scripting layer will also not finish a request-reply pair when
seeing 1xx's, instead it logs both the 1xx and final response messages
with associated information of the current request as they're seen.
2011-09-26 17:37:29 -05:00
Seth Hall
8710d3749f New SSL policy scripts.
- protocols/ssl/expiring-certs uses time based information from
  certificates to determine if they will expire soon, have already
  expired, or haven't yet become valid.

- protocols/ssl/extract-certs-pem is a script for taking certs off
  the line and converting them to PEM certificates with the openssl
  command line tool then dumping them to a file.
2011-09-25 02:42:36 -04:00
Seth Hall
38792875b3 Add shorthand variable for modifying suppression intervals.
- Notice::type_suppression_intervals: table[Notice::Type] of interval
  can be used to modify the suppression intervals for entire types of
  notices.
2011-09-25 02:30:55 -04:00
Seth Hall
43ea0ba182 Some script level fixes.
- Fixed a type name conflict in the Known namespace.

- Fixed a DPD framework bug that was causing Reporter messages.
2011-09-25 02:09:50 -04:00
Seth Hall
5911520563 Cleanup and fixes to notice framework.
- Fixed the notice_policy log.

- Predicate functions are now logged.

- Predicate functions are now optional.  If not given, it's assumed that
  the result should always apply.
2011-09-25 01:10:07 -04:00
Seth Hall
3449321dc1 Fix a problem with accidental and mistaken HTTP log lines. 2011-09-25 00:56:53 -04:00
Robin Sommer
c9b9bab473 Merge remote-tracking branch 'origin/topic/seth/notice-suppression'
* origin/topic/seth/notice-suppression:
  Updated a notice related baseline and added a necessary @load line.
  Notice suppression clean up and notice/cluster integrtion fixes.
  Updates for notice suppression to use the &create_expire attribute
  Small, mostly cosmetic updates and fixing a test.
  Fix crash on exit (addresses #607).
  Duplicate notice suppression.

Closes #623.
2011-09-22 19:20:34 -07:00
Robin Sommer
fc491c087b Merge branch 'master', remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix PktSrc setting next_timestamp even when no packet available
  Fix lack of NUL-termination in to_upper/to_lower BIF's return val.
  Fixing unit tests and some minor bugs.
  Fix broctl cluster log rotation (addresses #619)

* master:
2011-09-22 19:04:54 -07:00
Jon Siwek
928baf4b66 Fix lack of NUL-termination in to_upper/to_lower BIF's return val. 2011-09-22 13:56:16 -05:00
Jon Siwek
d2118200ea Fixing unit tests and some minor bugs. 2011-09-22 12:42:16 -05:00
Seth Hall
d18fdef2d4 Merge remote-tracking branch 'origin/master' into topic/seth/notice-suppression 2011-09-21 02:26:19 -04:00
Seth Hall
f53d5fe0b9 Added session ID to the SSL logging. 2011-09-20 13:59:22 -04:00
Seth Hall
16eafb771f Merge branch 'master' of ssh://git.bro-ids.org/bro 2011-09-20 13:56:02 -04:00
Seth Hall
b20edb8542 Updated the mozilla root certs. 2011-09-20 13:55:36 -04:00
Seth Hall
664500226e Updated a notice related baseline and added a necessary @load line. 2011-09-20 12:19:22 -04:00
Seth Hall
412cdb16a0 Notice suppression clean up and notice/cluster integrtion fixes.
- Worker raised notices are printed a single time by the manager now.

- Cluster/notices integration cleaned up.

- New tests for cluster/notice integration.

- Notice suppression fixes and tests.
2011-09-19 12:05:13 -04:00
Seth Hall
123a3bd4e3 Small rework with ssl base script to reduce memory usage.
- We are now removing the SSL analyzer after logging the session
  infomrtion.  This seems to help a lot with overly high memroy
  consumption.
2011-09-16 23:47:04 -04:00
Robin Sommer
62581ede31 Merge remote-tracking branch 'origin/topic/jsiwek/filter-rotation'
* origin/topic/jsiwek/filter-rotation:
  Remove Log::rotation_control (addresses #572).
  Add an optional Log::RotationControl to Log::Filter records.

Closes #572.
2011-09-15 16:28:13 -07:00
Robin Sommer
9ee8a9f806 Testing/external scripts no longer compute MD5 checksums for SMTP
entities.

Before, whether they did depended on libmagic. To do that,
smpt/entities.bro gets a new option `never_calc_md5`.

Also restructuring the tests a bit so that load a common
testing-setup.bro scripts that can set a global configuration.
2011-09-15 15:42:10 -07:00
Robin Sommer
53f93e7073 Removing load of script that doesn't exist anymore. 2011-09-15 15:06:21 -07:00
Seth Hall
8006f26db2 Merge remote-tracking branch 'origin/master' into topic/seth/notice-suppression 2011-09-15 00:27:57 -04:00
Seth Hall
c8e6255666 More options for the header-names.bro script. 2011-09-14 22:44:17 -04:00
Seth Hall
f32b567c85 New script for logging header names and values.
- Closes #519.
2011-09-13 22:33:26 -04:00
Seth Hall
af6c7c8b1a HTTP body size measurement added to http log.
- The value of the content-length headers has now been removed
  but it could be added back locally at an installation by a user.

- Added fields to indicate if some parsing interruption happened
  during the body transfer.

- Closes #581
2011-09-13 21:34:29 -04:00
Seth Hall
fa375d3164 Removing a small "TODO" now that a bug has been fixed. 2011-09-13 09:10:19 -04:00
Seth Hall
ee1884ca93 Another change to possibly fix the SSL memory consumption problem.
- If a protocol violation happens, Bro now logs what it has seen
  up until the protocol violation and deletes the c$ssl record
  so that a long lived connection with a protocol violation does
  continue to hold the memory.
2011-09-13 09:09:55 -04:00
Seth Hall
c87704cc25 Small usability and correctness updates.
- Removed an notice definition from the base SSL scripts.

- Moved a logging stream ID into the export section for known-services
  and bumped priority for creating the stream.

- Adding configuration knobs for the SQL injection attack detection
  script and renaming the HTTP::SQL_Injection_Attack notice to
  HTTP::SQL_Injection_Attack_Against

- Bumped priority when creating Known::CERTS_LOG.
2011-09-12 16:14:28 -04:00
Seth Hall
eda8632d62 Small updates for a warning from the cluster framework. 2011-09-12 15:50:04 -04:00
Seth Hall
e0af4f6e8d Small, mostly cosmetic updates and fixing a test.
- The test needed to append the second notice the event queue so that
  the notice would be suppressed correctly.

- Setting $suppress_for manually in apply_policy since it doesn't pick
  up the &default when directly creating the record inside the NOTICE call.
2011-09-12 15:08:25 -04:00
Seth Hall
2d85ab9818 Duplicate notice suppression.
- Duplicate notices are discovered with the new Notice::Info
  field $identifier.  It's a string that is left up to the
  notice implementor to define which would indicate a
  fundamentally duplicate notice.  The field is optional and
  if it's not included it's not possible for notice
  suppression to take place.

- Duplicate notices are suppressed by default for the interval
  defined by the Notice::default_suppression_interval variable
  (1 hour by default).

- A new notice action was defined ACTION_NO_SUPPRESS to prevent
  suppression for a specific notice instance.  A convenience set
  named not_suppressed_types was also created to not suppress
  entire notice types.

- A new field was added to the PolicyItem type to modify the length
  of time a notice should be suppressed if the predicate matches.
  The field is named $suppress_for.  This name makes the code more
  readable like this: $suppress_for = 1day

- New events were created to give visibility into the notice
  framework's suppression activity.
  - event Notice::begin_suppression(n: Notice::Info)
  - event Notice::suppressed(n: Notice::Info)
  - event Notice::end_suppression(n: Notice::Info)

- The suppression.bro script doesn't have a baseline because
  it is causing a segfault in Bro.  This one test is the
  reason that this is being integrated into a branch instead
  of master.
2011-09-11 08:44:48 -04:00
Jon Siwek
fe38c22d2b Remove Log::rotation_control (addresses #572).
Log rotation is now controlled directly through Filter records.

Also addressed a TODO in the default_path_func regarding the
LogMgr::AddFilter function generating internal filter path
suggestions/fallbacks.  Now, if the user doesn't explicitly set a filter
path, the filter's path will be the result of the first call to
default_path_func (happens during the first write to the log).  And in
that case the path suggestion argument to the path_func is an empty
string.
2011-09-08 15:00:31 -05:00
Jon Siwek
d8c716ae17 Merge branch 'master' into topic/jsiwek/filter-rotation 2011-09-08 13:01:00 -05:00
Robin Sommer
db8ab89c3a Merge remote branch 'origin/topic/jsiwek/misc-doc-fixes'
* origin/topic/jsiwek/misc-doc-fixes:
  More tweaks to generated script docs.
  Various changes to documentation framework.

Closes #598.
2011-09-08 09:07:20 -07:00
Seth Hall
3bf98548f7 The script level pf_ring support isn't working so removing it. 2011-09-08 02:28:04 -04:00
Seth Hall
4931aa815f Delete SSL certificates from memory after ssl_established event.
- This is an attempt at fixing the memory issues brought about by
  the introduction of the new SSL analyzer.  My initial testing
  shows a hefty memory saving.
2011-09-08 01:52:25 -04:00
Seth Hall
e07e4ca117 Cleaned up some small SSL mistakes. 2011-09-07 15:11:01 -04:00
Jon Siwek
d2bf33ee19 Merge branch 'master' into topic/jsiwek/filter-rotation 2011-09-07 12:30:47 -05:00
Jon Siwek
80e154ba3c Various changes to documentation framework.
- Reorganize top-level 'doc' Makefile target so submodules can easily
  add their own doc-generating routines to it.  e.g. the Bro project
  makes a placeholder 'doc' target, then adds 'restdoc', 'sphinxdoc';
  later Broccoli can add it's own target as a dependency for generating
  API docs.

- Fixed generated docs for BIFs not being organized under a base/
  subdirectory like the original source files.

- Fixed documentation style for function parameters not applying to
  functions declared as record fields.

- Misc. script documentation tweaks to address warnings given by Sphinx.
2011-09-07 10:02:15 -05:00
Seth Hall
eda2245e9e Merge remote-tracking branch 'origin/topic/seth/pf_ring_support'
* origin/topic/seth/pf_ring_support:
  Added pf_ring load balancing support to the scripting layer.
2011-09-06 15:20:22 -04:00
Robin Sommer
630c256a72 Merge remote branch 'origin/topic/gilbert/ascii-header'
* origin/topic/gilbert/ascii-header:
  Updated tests; removed net type from type conversion code.
  Updated header format (see #558)
  Header modification to LogWriterAscii to make it easier for scripts to understand bro log files.

Notes:

    - I've refactored the code a bit, also adapting the style a bit.
      Also edited the header format slightly.

    - I'm skipping the testing/btest/profiles directory, which seems
      unrelated.

    - I'm also skipping the baseline updates as they weren't
      up-to-date anymore. Will update them in a subsequent commit.
2011-09-04 12:12:08 -07:00
Seth Hall
11c437faa3 Logging framework update and mass Log::ID renaming.
- Log path's are generated in the scripting land
  now.  The default Log stream ID to path string
  mapping works like this:
    - Notice::LOG -> "notice"
    - Notice::POLICY_LOG -> "notice_policy"
    - TestModule::LOG -> "test_module"

- Logging streams updated across all of the shipped
  scripts to be more user friendly.  Instead of
  the logging stream ID HTTP::HTTP, we now have
  HTTP::LOG, etc.

- The priorities on some bro_init handlers have
  been adjusted to make the process of applying
  filters or disabling streams easier for users.
2011-09-03 01:10:17 -04:00
Seth Hall
771f8bc910 Added pf_ring load balancing support to the scripting layer.
- If the misc/pf-ring-load-balancing script is loaded, the correct
  environment variables will be set to enable automatic flow based
  load balancing used pf_ring if Bro is built against the pf_ring
  libpcap wrapper.  Loading the script on non-Linux OSs or when Bro
  isn't linked against the correct libpcap has no known side effects
  since the script just sets environment variables.

- Added a BiF named setenv for setting environment variables.
2011-09-02 10:43:32 -04:00