Commit graph

369 commits

Author SHA1 Message Date
Robin Sommer
8bacb6eb3d New BiF record_field_vals() that returns the fields of a record in a
table with meta-information.

Example:

type r: record {
	a: count;
	b: string &default="Foo";
	c: double &optional;
	d: string &log;
};

event bro_init()
{
    local x: r = [$a=42, $d="Bar"];
    print record_fields(x);
}

This prints:

  {
  [a] = [type_name=record, log=F, value=42, default_val=<uninitialized>]
  [b] = [type_name=record, log=F, value=<uninitialized>, default_val=Foo],
  [c] = [type_name=record, log=F, value=<uninitialized>, default_val=<uninitialized>],
  [d] = [type_name=record, log=T, value=Bar, default_val=<uninitialized>],
  }

This is one more step in Seth's quest for full inspection support. :-)
2011-07-07 19:56:48 -07:00
Seth Hall
d1e8722f5f Fixed a problem with the cluster framework unintentionally terminating bro. 2011-07-07 21:28:26 -04:00
Seth Hall
77435d2724 Removing more vestiges of BroCtl from Bro. 2011-07-07 21:24:51 -04:00
Seth Hall
6010f7950e Update for cluster framework.
- CLUSTER_NODE is now specified by name given as the index
  value in the Cluster::nodes variable.  e.g. worker-1
2011-07-07 15:57:25 -04:00
Seth Hall
e4052aba3d Adding a peer name to the communication logs. 2011-07-07 15:15:53 -04:00
Seth Hall
be65acec4e Initial commit of the new cluster framework.
- It's ok to always load the framework.  If you don't
  specifiy the CLUSTER_NODE environment variable it doesn't
  ultimately do anything.
- The $CLUSTER_NODE variable causes the framework to try and
  load a script named cluster-layout.bro which must be located
  somewhere in your $BROPATH.  The value of the $CLUSTER_NODE
  variable is a count that indicates a node in the Cluster::nodes
  variable that is set in the cluster-layout.bro script.
- The Cluster::nodes variable is a flat configuration because
  it's assumed that it would be automatically generated by a
  utility such as BroControl.  This will facilitate the tiered or
  "deep" clustering that is coming.
2011-07-07 13:21:19 -04:00
Seth Hall
ee59c86b8f Restructing bro.init a little bit to load required frameworks at the end. 2011-07-06 10:28:45 -04:00
Seth Hall
02b94f7141 Removed the notice_tag injection from the conn log.
It had some conceptual problems because notices aren't
always logged and in some cases are fairly infrequently
logged which resulted in a lot of notice tags being
attached to connections where the notice didn't show
up in a log file.  Also, the rule of thumb here is that
frameworks should never load protocols.  It's just bad
practice and probably indicates incorrect design somewhere.

The link between the conn log and the notice log should
now be made with the connections unique ID which is logged
in both logs and is more reliable.
2011-07-06 10:23:30 -04:00
Seth Hall
b2af6b9fd5 Adding the reporter framework. Not much there yet. 2011-07-06 10:07:57 -04:00
Seth Hall
46d0cf517b Start detecting Microsoft Sharepoint servers. 2011-07-06 09:18:22 -04:00
Seth Hall
ef96dc8d4d Spelling mistake caused known-services to not work quite right. 2011-07-05 15:55:33 -04:00
Robin Sommer
1fded82c32 Fixing tests. 2011-07-01 22:26:45 -07:00
Robin Sommer
94be787261 Merge remote branch 'remotes/origin/topic/policy-scripts-new'
* remotes/origin/topic/policy-scripts-new:
  Fixed another SSL analyzer memory leak.
  Attempting to fix another SSL bug.
  Fixing a ref counting bug in the SSL analyzer that I just introduced.
  Fixing memory leaks in SSL analyzer.
  Fixed a parsing bug in the SSL analyzer thanks to tracefile from Aashish Sharma.
  Removing my fix from earlier.  This is indicating the script-land generated events priority problem.
  Updates to the DPD framework.
  Fixed a bug in the auth-addl DNS script.

Conflicts:
	src/bro.bif
2011-07-01 18:59:34 -07:00
Robin Sommer
bff8d39428 Fixing bug with even priorities potentially being ignored for the
handler.
2011-07-01 15:40:42 -07:00
Robin Sommer
9709b1d522 Merge remote branch 'origin/topic/robin/reporting'
* origin/topic/robin/reporting:
  Syslog BiF now goes through the reporter as well.
  Avoiding infinite loops when an error message handlers triggers errors itself.
  Renaming the Logger to Reporter.
  Overhauling the internal reporting of messages to the user.

Updating a bunch of tests/baselines as well.

Conflicts:
	aux/broccoli
	policy.old/alarm.bro
	policy/all.bro
	policy/bro.init
	policy/frameworks/notice/weird.bro
	policy/notice.bro
	src/SSL-binpac.cc
	src/bro.bif
	src/main.cc
2011-07-01 13:59:21 -07:00
Robin Sommer
66e2c3b623 Renaming the Logger to Reporter.
Also changing output to not include timestamps when we haven't started
processing packets yet.
2011-07-01 09:22:33 -07:00
Robin Sommer
80fcabdb47 Polishing the setup for external tests. 2011-06-30 22:54:25 -07:00
Seth Hall
26248fa243 Removing my fix from earlier. This is indicating the script-land generated events priority problem. 2011-06-30 22:09:16 -04:00
Seth Hall
b4b990cfb5 Updates to the DPD framework.
- Removed the ProtocolViolation notice.  I'd like to hear
  if someone actually used that notice for something.
- Folded the dyn-disable functionality into the dpd/base script.
- Other small cleanup.
2011-06-30 21:26:30 -04:00
Seth Hall
e3f6909b93 Fixed a bug in the auth-addl DNS script. 2011-06-30 21:24:12 -04:00
Robin Sommer
b57624aabf Adding new policy file test-all.bro that loads all other policies.
This is for testing only. There are also two test: one that checks
that test-all.bro loads correctly, and one that ensures that test-all
is actually loading all scripts found in policy/*.
2011-06-30 17:47:23 -07:00
Seth Hall
00065c88dd Moved the RPC script into the right place. 2011-06-30 16:47:11 -04:00
Seth Hall
556bc55068 More SSL script cleanup. 2011-06-30 16:45:13 -04:00
Seth Hall
24d570a94c Updates and fixes for the SSL analyzer.
- Fixed a pretty major eternal looping bug in the SSL analyzer and
  a few other parsing problems.
- New core scripts and log for SSL connection analysis.
- New known-certs script for logging certificate assets.
2011-06-30 13:23:31 -04:00
Seth Hall
de21409921 Renaming a poorly named notice. 2011-06-27 15:46:50 -04:00
Seth Hall
9efb27b6c6 Notice framework updates.
- Fixed problem where notices were logged even if they
  didn't have the ACTION_FILE action applied.
- New PolicyItem element, $halt.  It's used for halting
  the policy processing if a predicate returns T.
  This replaces the ACTION_STOP action.
- Initial hacky email extension mechanism.
- Removed the IDMEF line.  When that added back later
  it will likely be done more modularly.
2011-06-27 13:16:04 -04:00
Seth Hall
16b9a0e025 Fixed bug I just introduced to known-services. 2011-06-27 12:59:23 -04:00
Seth Hall
0337107a95 Known services now only logs for "normal" connections. 2011-06-27 12:46:05 -04:00
Seth Hall
4c51794874 Fix the name of the DPD log. 2011-06-27 12:44:56 -04:00
Seth Hall
4364f572df Updating the netstats script to match the new internal code. 2011-06-27 01:08:42 -04:00
Seth Hall
bdbfa2642c Removed expected_connection_timeout variable.
- expected_connection_timeout is unused and gone now.
2011-06-27 00:58:36 -04:00
Seth Hall
c070cb31da Merge remote branch 'origin/master' into topic/policy-scripts-new
Conflicts:
	policy/bro.init
	testing/btest/language/rare-events.bro
2011-06-25 23:49:20 -04:00
Robin Sommer
6d2a89f1f8 Merge remote branch 'origin/topic/seth/net-stats-bif'
* origin/topic/seth/net-stats-bif:
  Removing a stray print statement.
  Changed netstats (packet loss) handling to script-land.

Nice idea to pass the old data into a regular scheduled event!

Conflicts:
	src/event.bif
2011-06-25 17:05:15 -07:00
Robin Sommer
93894eed9b Overhauling the internal reporting of messages to the user.
The Logger class is now in charge of reporting all errors, warnings,
informational messages, weirds, and syslogs. All other components
route their messages through the global bro_logger singleton.

The Logger class comes with these reporting methods:

    void Message(const char* fmt, ...);
    void Warning(const char* fmt, ...);
    void Error(const char* fmt, ...);
    void FatalError(const char* fmt, ...); // Terminate Bro.
    void Weird(const char* name);
    [ .. some more Weird() variants ... ]
    void Syslog(const char* fmt, ...);
    void InternalWarning(const char* fmt, ...);
    void InternalError(const char* fmt, ...); // Terminates Bro.

See Logger.h for more information on these.

Generally, the reporting now works as follows:

    - All non-fatal message are reported in one of two ways:

        (1) At startup (i.e., before we start processing packets),
            they are logged to stderr.

        (2) During processing, they turn into events:

            event log_message%(msg: string, location: string%);
            event log_warning%(msg: string, location: string%);
            event log_error%(msg: string, location: string%);

            The script level can then handle them as desired.

            If we don't have an event handler, we fall back to
            reporting on stderr.

    - All fatal errors are logged to stderr and Bro terminates
      immediately.

    - Syslog(msg) directly syslogs, but doesn't do anything else.

The three main types of messages can also be generated on the
scripting layer via new Log::* bifs:

    Log::error(msg: string);
    Log::warning(msg: string);
    Log::message(msg: string);

These pass through the bro_logger as well and thus are handled in the
same way. Their output includes location information.

More changes:

    - Removed the alarm statement and the alarm_hook event.

    - Adapted lots of locations to use the bro_logger, including some
      of the messages that were previously either just written to
      stdout, or even funneled through the alarm mechanism.

    - No distinction anymore between Error() and RunTime(). There's
      now only one class of errors; the line was quite blurred already
      anyway.

    - util.h: all the error()/warn()/message()/run_time()/pinpoint()
      functions are gone. Use the bro_logger instead now.

    - Script errors are formatted a bit differently due to the
      changes. What I've seen so far looks ok to me, but let me know
      if there's something odd.

Notes:

    - The default handlers for the new log_* events are just dummy
      implementations for now since we need to integrate all this into
      the new scripts anyway.

    - I'm not too happy with the names of the Logger class and its
      instance bro_logger. We now have a LogMgr as well, which makes
      this all a bit confusing. But I didn't have a good idea for
      better names so I stuck with them for now.

      Perhaps we should merge Logger and LogMgr?
2011-06-25 16:40:54 -07:00
Seth Hall
04aa03e4ab New default notice actions for emailing network admins.
- When ACTION_EMAIL_ADMIN_ORIG or ACTION_EMAIL_ADMIN_RESP
  is applied to a notice,
  the email addresses associated with the address
  are collected from the new local_admins table
  and the email is sent to all discovered email addresses.
- The site.bro script is now in the Site module.
- Some other small cleanup.
2011-06-25 01:17:09 -04:00
Seth Hall
09e242f98f weird.bro moved into notice framework.
- That might not be the right place to put it though.
2011-06-24 16:40:05 -04:00
Seth Hall
e19e050121 Removed a redundant and out of place mozilla CA list. 2011-06-24 16:30:36 -04:00
Seth Hall
124ae1bc41 Renamed the stream for the notice log. 2011-06-24 16:14:59 -04:00
Seth Hall
3fce0f89f2 Small consistency tweaks for the communications framework. 2011-06-24 16:14:26 -04:00
Seth Hall
77948482b6 Finishing the inactivity script. 2011-06-24 16:13:45 -04:00
Jon Siwek
adeec23201 Merge branch 'topic/policy-scripts-new' of git://git.bro-ids.org/bro into topic/policy-scripts-new 2011-06-24 13:36:49 -05:00
Jon Siwek
4f33dcf59e Updating software version parsing test.
Tweaked parsing code a bit catch a couple that were failing.
2011-06-24 13:27:35 -05:00
Seth Hall
c5f683ee47 Notices actions are now accumulative.
- New log file for auditing the notice policy to
  see at a specific point in time what the fully
  ordered (by priority) notice policy was.
- New notice action "ACTION_STOP" to stop processing
  the notice policy.  This is essentially how the old
  IGNORE action can be done with the accumulative
  notices actions.  It just needs to be set as the
  $result at an at an appropriately high priority.
- No longer using the "match" statement as it didn't
  provide the flexibility to implement accumulative
  notice actions.  The functionality is now implemented
  completely in script-land.
- Beginning removal of action-filters script.
  Still need to come up with a way to implement
  some of the functionality of that script.
- Small documentation updates.
2011-06-24 13:35:48 -04:00
Seth Hall
da635c0c2c Bringing the inactivity script back. 2011-06-24 13:17:17 -04:00
Seth Hall
814f140b1a Small communication framework fixes. 2011-06-22 13:53:47 -04:00
Seth Hall
bbc1e603a9 Turn syslog off by default. 2011-06-22 13:53:09 -04:00
Seth Hall
4a31399953 Changing FTP tags to strings instead of enum values.
- This makes FTP command/response tags more similar
  to tags used in other scripts.
2011-06-19 22:59:50 -04:00
Seth Hall
856fd37759 Fixed a bug in the HTTP:build_url_http function. 2011-06-19 03:02:15 -04:00
Seth Hall
93f1b53165 Fixing a bug where a nearly empty MIME record could be logged. 2011-06-19 02:31:53 -04:00
Seth Hall
1ac65f44d2 Fixing a bug with MIME entity hashing. 2011-06-19 02:24:48 -04:00