Commit graph

5909 commits

Author SHA1 Message Date
Jon Siwek
5a2cd265ab Update the generated script doc organization.
Added an additional master TOC index for Bro script packages that
automatically gets filled in at ``make doc`` time.  The master TOC
links to per-package indexes which contains links to all the scripts
contained within it along with their summary.  The per-package index
is also now automatically generated/derived from the path component
of the script passed into the rest_target() macro.
2011-06-30 16:58:20 -05:00
Seth Hall
cf527147e7 Changing back the last commit. It made things worse. 2011-06-30 17:07:07 -04:00
Seth Hall
5382456f12 Trying a different method of record parsing for SSL analyzer. 2011-06-30 17:04:32 -04:00
Seth Hall
06a0b2df67 Fixed a segfault from empty strings in the SSL analyzer. 2011-06-30 14:24:15 -04:00
Seth Hall
b9e36025a7 Removing what I believe is the last stray print statement from the SSL analyzer. 2011-06-30 13:44:46 -04:00
Seth Hall
a62d1d1fe0 Fixed more eternal looping bugs in the SSL analyzer. 2011-06-30 13:42:42 -04:00
Seth Hall
aebc2ea030 Merge branch 'topic/policy-scripts-new' of ssh://git.bro-ids.org/bro into topic/policy-scripts-new 2011-06-30 13:23:45 -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
Jon Siwek
fe5f4b8e53 Changes to make generated script docs understand new policy/ hierarchy.
Added an arg to the search_for_files() util function that can return
the subpath of BROPATH's policy/ dir in which the loaded file is found.
This subpath is then used in both the the reST file's document title
(so that script's named e.g. "base.bro" actually have some context) and
in figuring out how to interlink with other generated docs of other
scripts that are found in @load directives.

I still need to overhaul things so the loading of "packages" is
documented in a meaningful way and that the CMake targets are able
to generate indexes for packages.
2011-06-30 11:37:15 -05:00
Robin Sommer
a5e13b184d Merge remote branch 'remotes/origin/topic/policy-scripts-new'
* remotes/origin/topic/policy-scripts-new: (264 commits)
  Update core.vlan-mpls baseline.
  Update core.conn-uid test/baseline.
  Fixing tests / updating baselines.
  Renaming a poorly named notice.
  Resolving a conflict in scan.l.
  Notice framework updates.
  Fixed bug I just introduced to known-services.
  Known services now only logs for "normal" connections.
  Fix the name of the DPD log.
  Updating the netstats script to match the new internal code.
  Removed expected_connection_timeout variable.
  New default notice actions for emailing network admins.
  New default notice action for emailing network admins.
  weird.bro moved into notice framework.
  Removed a redundant and out of place mozilla CA list.
  Renamed the stream for the notice log.
  Small consistency tweaks for the communications framework.
  Finishing the inactivity script.
  Intel framework test passes now.
  Reorganized some of the tests for consistency.
  ...
2011-06-29 21:48:19 -07:00
Jon Siwek
f24a67d662 Move event arg. record coercion check; now only done for recv'd remote events 2011-06-27 17:11:14 -05:00
Jon Siwek
1c30ce7e23 Merge branch 'master' into topic/jsiwek/pybroccoli-fixes 2011-06-27 16:00:50 -05:00
Jon Siwek
73fa60f769 Resolving a conflict in scan.l.
Caused by changes made while working on the way loaded scripts are tracked
(commit 9de6e9170c to master branch) that
didn't take into account an unmerged commit on the policy-scripts-new branch
(56a946568a).

(re-added warning comments that were removed in the former commit since they
still seem relevant now)
2011-06-27 13:08:30 -05: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
ab182e792e Merge remote branch 'origin/master' into topic/policy-scripts-new 2011-06-27 00:45:56 -04:00
Robin Sommer
3ddba11e87 Changing logging's default naming scheme.
We now take the enum ID name rather than the module. Closes #483.
2011-06-26 16:45:44 -07: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
6b9d23abb2 Applying DNS TTL patch from #368.
I've restructured/cleaned up the original patch by thomas.other a bit.
2011-06-25 17:44:56 -07:00
Robin Sommer
ded395007f Merge remote branch 'origin/topic/jsiwek/script-load-cleanup'
* origin/topic/jsiwek/script-load-cleanup:
  Cleaning up the script loading implementation.
  Fix baseline for core.conn-id (now core.conn-uid) test.
2011-06-25 17:11:54 -07: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
85f7d2e809 Merge remote branch 'origin/fastpath'
* origin/fastpath:
  Raise internal error when failing to read contents of state file with -x option

I've changed this to use error() instead of internal_error(). The
latter should only be used for logic errors that indicate a bug in
Bro. In this case, the message flags a problem that's more likely to
be external.
2011-06-25 16:44:56 -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
Jon Siwek
143427e35e Raise internal error when failing to read contents of state file with -x option
Instead of just exiting w/ code 0
2011-06-22 14:43:23 -05:00
Jon Siwek
3f436cf419 Merge branch 'master' into topic/jsiwek/pybroccoli-fixes 2011-06-20 12:18:20 -05:00
Jon Siwek
9de6e9170c Cleaning up the script loading implementation.
This change primarily improves the way Bro detects and prevents
the same script from being loaded twice.  It now compares inode
numbers instead of path names.
2011-06-20 12:10:09 -05:00
Seth Hall
c60015af22 Changed netstats (packet loss) handling to script-land.
- Removed the net_stats_update event.
- Created a net_stats function for building and retrieving the
  current network statistics.
- Removed the internal timer for firing the net_stats_update event
  along with the global heartbeat_interval variable.
- Updated the netstats script to use the new BiF.
- Updated the stats script to use the new BiF.
2011-06-17 09:02:50 -04:00
Seth Hall
f30a8a3e21 Merge remote branch 'origin/master' into topic/policy-scripts-new 2011-06-16 22:02:09 -04:00
Robin Sommer
ff7b92ffc8 Fixing bug with logging &optional records.
Closes #476.
2011-06-16 17:24:15 -07:00
Seth Hall
8b9c1f1dcd Merge remote branch 'origin/topic/jsiwek/pybroccoli-fixes' into topic/policy-scripts-new 2011-06-16 16:04:00 -04:00
Jon Siwek
303dba6372 Coerce event handler record arguments to correct record type.
This lets events be sent to bro that contain record arguments that
don't have to fill in all &optional record fields.

This corresponds to broccoli-python tests that were updated in
commit 8b87d8f61ef89162019cd4acc01be93700b0c588
2011-06-15 13:56:37 -05:00
Seth Hall
00f4751ada Merge remote branch 'origin/master' into topic/policy-scripts-new 2011-06-14 13:02:19 -04:00
Jon Siwek
71c2e79202 Merge branch 'master' into fastpath 2011-06-13 20:21:24 -05:00
Robin Sommer
a73fc15659 Merge remote branch 'origin/fastpath' 2011-06-13 18:03:02 -07:00
Robin Sommer
5bd8caa7a0 Merge remote branch 'origin/topic/gregor/rpc'
Note, I haven't gone through the script-level code as that will change
soon anyway.
2011-06-13 17:56:28 -07:00
Jon Siwek
53dc4ef084 Change bro doc mode to write out docs immediately after parsing.
Originally docs were written right after parsing, but it changed to after
the bro_init event happens when I was experimenting with auto-documenting
logging streams by querying the LogMgr after bro_init.  That experiment
dead-ended, and that location is bad for other reasons: the doc framework
may try to access BroObj's that have already been freed.
2011-06-13 19:50:11 -05:00
Jon Siwek
eb85ae9654 Really, null-terminate full 15-char NetBIOS host names, too. 2011-06-12 08:46:58 -05:00
Seth Hall
270758267e Updating the default policy script paths for the new scripts organization. 2011-06-10 14:10:56 -04:00
Jon Siwek
d358ef1e71 Null-terminate the string created by decode_netbios_name BiF.
(initially observed through failures of bifs.netbios-functions unit test)
2011-06-10 12:59:05 -05:00
Seth Hall
4ff47db8c1 Fixed small bug with unique_id BiF. 2011-06-08 00:16:58 -04:00
Seth Hall
27f692799f Small but crucial fix for the new unique_id function. 2011-06-07 23:47:39 -04:00
Seth Hall
57531e0769 Merge remote branch 'origin/master' into topic/policy-scripts-new
Conflicts:
	policy/bro.init
	policy/ssl.bro
2011-06-07 23:26:03 -04:00
Robin Sommer
8266709e20 A new bif unique_id(prefix) that returns a string that's unique across
Bro instaces with high probablity.

"prefix" is a string that will be prepended to the returned ID.
2011-06-07 17:57:22 -07:00
Robin Sommer
4bdb94955d Merge remote branch 'origin/topic/seth/ssl-binpac'
* origin/topic/seth/ssl-binpac:
  Fixed bug due to vectors now initially indexed on 0.
  Finished core support for new SSL analyzer.
  SSL analyzer changes with accompanying BiF.
  A table_s_of_s type to get around bifcl type limitation.
  Regenerated the Mozilla CA bundle without the untrusted server authentication certs.
  Complete rewrite to SSL analyzer.

Conflicts:
	src/AnalyzerTags.h
	src/CMakeLists.txt

Notes:

    - Haven't looked at the script-level, postponed to
      policy-scripts-new.

    - I renamed X509Extension to X509_extension for consistency.
2011-06-07 10:12:25 -07:00
Robin Sommer
6e6af4c541 Merge remote branch 'origin/topic/seth/syslog-analyzer'
Note: I didn't merge anything in policy/*. Seems there was some
unrelated stuff in there, and the ticket says that the policy script
was a dummy for now anyway.

* origin/topic/seth/syslog-analyzer:
  Updates for syslog analyzer to prepare it for merging.
  Added the initial syslog analyzer and policy script.
  Adding some of the initial scripts that are going to be merged from my script repository.
2011-06-05 18:37:48 -07:00
Seth Hall
6322130c37 Updates for syslog analyzer to prepare it for merging.
- Integrated with CMake.
- Analyzer only support syslog over UDP right now.
- Fixed small bug in the analyzer to make it generate events correctly.
2011-06-03 10:28:10 -04:00
Seth Hall
b621b8eccc Merge remote branch 'origin/master' into topic/seth/syslog-analyzer
Conflicts:
	src/Analyzer.cc
	src/Makefile.am
2011-06-03 09:38:23 -04:00
Seth Hall
72f2472d1d Updates for the pcap.bro script.
- The install_pcap_filter BiF no longer will prevent
  a filter from being installed if a -f filter was
  provided.  This was already causing a problem where
  command line supplied filters weren't working.
  The pcap.bro script is now where the filter update
  limitation is placed making it possible for users
  to still update the filter at runtime if they really
  want to.
2011-06-03 07:50:30 -04:00
Seth Hall
fbf207deda Merge remote branch 'origin/master' into topic/policy-scripts-new 2011-06-03 07:38:28 -04:00
Robin Sommer
fac328685b @load now supports loading a directory.
With a directory "foo" somewhere in BROPATH, "@load foo" now checks if
there's a file "foo/__load__.bro". If so, it reads that file in. (If
not, Bro reports the same error as before, complaining that it can't
read a directory).
2011-06-02 21:57:24 -07:00
Robin Sommer
5c0704eec8 ASCII logger now escapes non-printable characters.
Closes #450.
2011-06-01 22:33:44 -07:00