Commit graph

5593 commits

Author SHA1 Message Date
Robin Sommer
4677174aa4 Merge remote branch 'origin/topic/robin/comm-ssl'
The merge does not include the hack to switch back to 32-bit for
Broccoli. It does contain a version of the SSL tests converted to
btest, which however doesn't pass yet (as some of the others as well)

* origin/topic/robin/comm-ssl:
  Fixing crashes when SSL is not configured correctly.
  Adding a test for SSL-based communciation to the istate testsuite.
2011-04-01 15:57:07 -07:00
Robin Sommer
bc39f9f048 Porting the istate tests to btest.
Note that currently most of them don't pass because (i) the code
adding the environment variable for seeding the RNG has not been
merged into master yet; and (2) Broccoli to Bro communication is
currently broken because of the int64 problem. Once these are fixed,
then baselines need to be recreated and checked.

Therefore, the istate tests aren't activated in btest.cfg yet.
2011-03-29 21:46:06 -07:00
Robin Sommer
3562682ac9 Merge remote branch 'origin/topic/appleman/unittests'
Note that I've shifted things around a little bit. The traces are now
in Traces/* (capital T), and the known-hosts-test in policy/*.
Scripts/ was meant just for helper shell scripts for the testing
framework. Also, I've not yet included "policy" in btest.cfg as a
TestDir because the corresponding script is not yet in master.

* origin/topic/appleman/unittests:
  Test, trace file, and baseline for testing the known-services policy script
  Baseline for KNOWN-HOSTS tesT
  Initial drop of known-hosts unit test, with tracefile and directory structure, as well as c ouple of files pulled from Robin's logging branch.
2011-03-29 21:43:34 -07:00
Seth Hall
4943a87205 Merge remote branch 'origin/topic/robin/logging-internals' into topic/policy-scripts-new 2011-03-29 10:21:01 -04:00
Robin Sommer
1cbde793d8 Merge branch 'topic/robin/extend-records' into topic/robin/logging-internals
Includes some fixes for using &log with record-extension.
2011-03-28 18:56:19 -07:00
Robin Sommer
38a1aa5a34 &log keyword, and vector logging.
The &log keyword now operates as discussed:

    - When associated with individual record fields, it defines them
      as being logged.

    - When associated with a complete record type, it defines all fields
      to be logged.

    - When associated with a record extension, it defines all added
      fields to be logged.

    Note that for nested record types, the inner fields must likewise
    be declared with &log. Consequently, conn_id is now declared with
    &log in bro.init.

Vectors are now allowed to be logged and will be recorded as an
ordered set of items.
2011-03-28 18:14:05 -07:00
Don Appleman
ebb4eb552a Test, trace file, and baseline for testing the known-services policy script 2011-03-25 16:17:27 -05:00
Don Appleman
c81f1889a5 Baseline for KNOWN-HOSTS tesT 2011-03-24 13:28:48 -05:00
Don Appleman
638eb2f8eb Initial drop of known-hosts unit test, with tracefile and directory structure, as well as c ouple of files pulled from Robin's logging branch. 2011-03-24 11:27:21 -05:00
Seth Hall
fdd8ce4e57 Another software test and fixes to version parsing. 2011-03-17 14:55:58 -04:00
Seth Hall
8faca52add Software parsing test updates. 2011-03-17 14:29:25 -04:00
Seth Hall
f4b27016cf Merge commit '878d263f11' into topic/policy-scripts-new
* commit '878d263f11':
  More tests for default software parsing function.
2011-03-16 17:04:26 -04:00
Seth Hall
86a127de44 Merge commit 'febfd4cf04' into topic/policy-scripts-new
* commit 'febfd4cf04':
  Better software version parsing.
2011-03-16 17:04:16 -04:00
Seth Hall
9384fbd968 Merge commit '50acf152bd' into topic/policy-scripts-new
* commit '50acf152bd':
  More software fixes (and successful tests!).
2011-03-16 17:03:45 -04:00
Seth Hall
25318de82d Merge commit '65c3cb6faf' into topic/policy-scripts-new
* commit '65c3cb6faf':
  Updates for detecting and logging software.
2011-03-16 17:03:40 -04:00
Seth Hall
59acb8bb3e Merge remote branch 'origin/topic/robin/logging-internals' into topic/policy-scripts-new 2011-03-16 16:49:57 -04:00
Seth Hall
878d263f11 More tests for default software parsing function. 2011-03-14 17:01:45 -04:00
Seth Hall
febfd4cf04 Better software version parsing.
* $addl field now parsed out in many cases.
* A few new tests for web browser versions.
  * Browers user-agents need preprocessed though.
* All tests pass.
2011-03-14 15:41:45 -04:00
Seth Hall
50acf152bd More software fixes (and successful tests!).
* SSH now removes the protocol information for detecting the actual software and not protocol used.
* Updates for the default version parsing.
* No longer testing default version parsing for the $addl field.  It doesn't seem to be generically extractable.
2011-03-11 15:07:07 -05:00
Seth Hall
65c3cb6faf Updates for detecting and logging software.
* Tests for the default software version parsing (showing how broken it is!)
* Software::cmp_versions(v1: Version, v2: Version) is now exported
* Many small naming tweaks to adjust to namespaces.
2011-03-11 13:51:31 -05:00
Robin Sommer
0f854315e9 New test. 2011-03-10 18:18:58 -08:00
Robin Sommer
871561939b Updating baselines. 2011-03-09 19:42:24 -08:00
Robin Sommer
170a8bd403 Setting random number generator seed in btest.cfg. 2011-03-09 19:42:24 -08:00
Robin Sommer
89e8ea7353 Enums are now logged with their ID names, not anymore with their
numerical values.
2011-03-09 18:06:50 -08:00
Robin Sommer
c6e3174bc8 The logging systems now supports fields of type set[<atomic_type>]. 2011-03-09 18:01:41 -08:00
Robin Sommer
52c54859b6 Bugfix: the header line was ending with a separator.
Test baselines needed adaption as well.
2011-03-09 16:55:29 -08:00
Robin Sommer
b69ecff3ee More options for the ASCII writer.
# The prefix for the header line if included.
	const header_prefix = "# " &redef;

	# The string to use for empty string fields.
	const empty_field = "" &redef;

	# The string to use for an unset optional field.
	const unset_field = "-" &redef;
2011-03-09 16:52:46 -08:00
Robin Sommer
cb9e0a5d5a If a field value contains the separator, that is now escape with hex
characters.
2011-03-09 16:26:11 -08:00
Robin Sommer
c6d20dbfdf Adding a few options to the ASCII writer.
module LogAscii;

export {
	# Output everything to stdout rather than into files. This is primarily
	# for testing purposes.
	const output_to_stdout = F &redef;

	# The separator between fields.
	const separator = "\t" &redef;

	# True to include a header line with column names.
	const include_header = T &redef;
}
2011-03-08 21:44:46 -08:00
Robin Sommer
26eab74ecc The ASCII writer can now deal with /dev/* paths.
It will not longer try to add a ".log" extension.
2011-03-08 17:59:05 -08:00
Robin Sommer
4b7c5905f1 New functions Log::disable_stream() and Log::enable_stream().
When disabled, all outout to a stream will be ignored (but no error
raised).
2011-03-08 17:54:11 -08:00
Robin Sommer
5d8b9f2e74 New function Log::get_filter() that allows to retrieve previously
installed filter by name.

This filter can then be modified and reinstalled via add_filter(),
which will replace the old one with the same name.
2011-03-08 17:31:46 -08:00
Robin Sommer
b8ee425e0d Adding test for per-file rotation. 2011-03-08 16:33:06 -08:00
Robin Sommer
51f9cb2ac5 Updating test baseline after fixing an older bug in previous commit. 2011-03-08 16:26:31 -08:00
Robin Sommer
d6cef16f77 Rotation support.
This follows rather closely how rotation currently works in
rotate-logs.bro. logging.bro now defines:

        # Default rotation interval; zero disables rotation.
        const default_rotation_interval = 0secs &redef;

        # Default naming suffix format.
        const default_rotation_date_format = "%y-%m-%d_%H.%M.%S" &redef;

        # Default postprocessor for writers outputting into files.
        const default_rotation_postprocessor = "" &redef;

        # Default function to construct the name of the rotated file.
        # The default implementation includes
        # default_rotation_date_format into the file name.
        global default_rotation_path_func: function(info: RotationInfo) : string &redef;

Writer support for rotation is optional, usually it will only make
sense for file-based writers.

TODO: Currently, there's no way to customize rotation on a per file
basis, there are only the global defaults as described above.
Individual customization is coming next.
2011-03-06 19:32:44 -08:00
Robin Sommer
90af0d06c3 A first test for remote logging.
Needs the updated btest, which has two new scripts for running
processes in the background.
2011-03-03 21:47:08 -08:00
Robin Sommer
c355f5d1fa Adding options to enable/disable local and remote logging.
Only the local option has an effect right now.

Also moving Log::default_writer out of the bif into logging.bro.
2011-03-01 17:13:50 -08:00
Robin Sommer
ab15437339 Working on the logging API exposed to scripts.
- Moving all functions into the Log::* namespace, using the recent
  bifcl updates. Moved logging-specific stuff to logging.bif.

- Log::create_stream() now takes a record Log::Stream as its second
  argument, which specifies columns and (optionally) the event.

- All the internal BiFs are now called "Log::__<something>", with
  script-level wrappers "Log::<something>". That first allows to add
  additional code at the script-level, and second makes things better
  comprehendible as now all relevant functionality is collected (and
  later documetned) in policy/logging.bro.

- New function Log::flush(id), which does the obvious assuming the
  writer supports it.

- add_default_filter() is now called implicitly with every
  create_stream(). Seems that we usually want that functionality, and
  when not, remove_default_filter() gets rid of it.

- The namespace of a stream's ID is now used as the default "path"
  (e.g., if the namespace is SSH, the default log file is "ssh.log").

- Updated policy/test-logging.bro as well as the btest tests according
  to these changes.
2011-02-27 15:09:37 -08:00
Robin Sommer
2a82e0bd9b Updating indenpdentn state tests to work with new setyp.
Note that the broccoli test does currently not pass because of the
64-bit changes.
2011-02-25 17:01:11 -08:00
Robin Sommer
f02e465c92 Tests for the logging functionality, including a basic btest
configuration.
2011-02-21 18:29:41 -08:00
Robin Sommer
3942b253cc Adding a test for SSL-based communciation to the istate testsuite. 2011-02-07 21:47:29 -08:00
Robin Sommer
2f30c3d245 Adding some tests for the record-extension feature.
These will go somewhere else eventually, just making sure they don't
get lost.
2011-02-07 16:10:09 -08:00
Robin Sommer
61757ac78b Initial import of svn+ssh:://svn.icir.org/bro/trunk/bro as of r7088 2010-09-27 20:42:30 -07:00