Commit graph

48 commits

Author SHA1 Message Date
Johanna Amann
af77a7a83b Analyzer failure logging: tweaks and test fixes
The main part of this commit are changes in tests. A lot of the tests
that previously relied on analyzer.log or dpd.log now use the new
analyzer-failed.log.

I verified all the changes and, as far as I can tell, everything
behaves as it should. This includes the external test baselines.

This change also enables logging of file and packet analyzer to
analyzer_failed.log and fixes some small behavior issues.

The analyzer_failed event is no longer raised when the removal of an
analyzer is vetoed.

If an analyzer is no longer active when an analyzer violation is raised,
currently the analyzer_failed event is raised. This can, e.g., happen
when an analyzer error happens at the very end of the connection. This
makes the behavior more similar to what happened in the past, and also
intuitively seems to make sense.

A bug introduced in the failed service logging was fixed.
2025-06-03 15:56:42 +01:00
Arne Welzel
0619fe2f4f intel/seen/manage-event-groups: Policy script for toggling intel event groups
Co-authored-by: Mohan Dhawan <mohan@corelight.com>
2025-06-02 09:51:14 +02:00
Johanna Amann
28ec4e2f2a External tests: add removed logs to CT list to prevent baseline changes 2025-04-28 16:42:52 +01:00
Johanna Amann
0e9cf7b019 DPD: update test baselines; change options for external tests.
As services are sorted by default now, this disables the canonifier that
sorts the service field for the external baseline.

This also adds the tracking of disabled services in the service field
via DPD::track_removed_services_in_connection - to make such changes
more visible, and check that the feature works as desired.
2025-02-06 18:56:30 +00:00
Johanna Amann
0fa1ecce8f DPD: change policy script for service violation logging; add NEWS
This commit renames the `service_violation` column that can be added via
a policy script to `failed_service`. This expresses the intent of it
better - the column contains services that failed and were removed after
confirmation.

Furthermore, the script is fixed so it actually does this - before it
would sometimes add services to the list that were not actually removed.
In the course of this, the type of the column was changed from a vector
to an ordered set.

Due to the column rename, the policy script itself is also renamed.

Also adds a NEWS entry for the DPD changes.
2025-02-06 18:56:30 +00:00
Johanna Amann
e3493bc110 DPD changes - small script fixes and renames.
This addresses review feedback of GH-4200. No functional changes.
2025-02-05 13:55:43 +00:00
Johanna Amann
20ace6209f Update public and private test suite for DPD changes.
The changes are mostly quite minor. The main change reasons are:

* analyzers that were confirmed, and later removed now show up in the
  conn.log.
* a couple of removed lines in analyzer.log, because non-confirmed
  analyzers get removed more quickly.
* in some cases there are additional lines in analyzer.log. These are
  cases in which an analyzer gets removed due to a violation and then
  re-attached because of a later signature match, which replays the
  violating content. In all examples that I have so far, this is caused
  by both sides of a connection speaking a differing protocol. There
  probably should be a better way to handle this - but it works.
* new column for failed analyzers in conn.log
2025-01-30 16:59:44 +00:00
Arne Welzel
e12e873461 testing/external: Exclude telemetry.log from baselines
The diffs produced by telemetry.log when introducing a weird or
removing/adding protocol specific logs is overwhelming and distracting
without providing value. Exclude telemetry.log similar to how we already
exclude stats.log.

Some more targeted telemetry.log tests exists in the normal testing/btest
suite and that appears more sensible.
2023-08-30 10:49:46 +02:00
Arne Welzel
bfc2374c8f Bump external test suites, filter some telemetry.log entries 2023-02-27 15:42:18 +01:00
Arne Welzel
d9e5cc3078 external/testing-setup: Less telemetry.log volume
For traces spanning a long time period, don't produce immense
amounts of logs. Also filter down the event handler invocation
entries to connection related events in telemetry.log.
2023-02-22 12:10:10 +01:00
Arne Welzel
17d0ade26a analyzer: Add analyzer.log for logging violations/confirmations
By default this only logs all the violations, regardless of the
confirmation state (for which there's still dpd.log). It includes
packet, protocol and file analyzers.

This uses options, change handlers and event groups for toggling
the functionality at runtime.

Closes #2031
2023-01-09 18:11:49 +01:00
Tim Wojtulewicz
d442ea1bb9 egrep reported as obsolete by opensuse-tumbleweed builds 2022-10-27 11:48:43 -07:00
Arne Welzel
3fe930dbf2 Introduce telemetry framework
Adds base/frameworks/telemetry with wrappers around telemetry.bif
and updates telemetry/Manager to support collecting metrics from
script land.

Add policy/frameworks/telemetry/log for logging of metrics data
into a new telemetry.log and telemetry_histogram.log and add into
local.zeek by default.
2022-08-05 11:43:44 +02:00
Christian Kreibich
bf9b1ebbbe Add helpers for syncing commit files with external testsuites
This provides "make sync-repos" to check out all locally available testsuites at
the commits indicated in their commit files, and "make sync-commits" to update
the commit files to the HEADs of the local testsuite repos.

Also adds the commit -> repo sync for the Makefile init target so initialization
always lands on the right version, and removes the corresponding explicit
checkout from the CI repo setup.
2022-06-28 13:20:14 -07:00
Tim Wojtulewicz
107f4fdc99 Add --retry to curl invocations in update-traces 2022-05-13 11:54:27 -07:00
Benjamin Bannier
1f388e3f40 Format shell scripts with shfmt.
All changes in this patch were performed automatically with `shfmt` with
configuration flags specified in `.pre-commit-config.yaml`.

In addition to fixing whitespace the roundtrip through shfmt's AST also
transforms command substitutions

    `cmd`
    # becomes
    $(cmd)

and some redirects

    >&2 echo "msg"
    # becomes
    echo >&2 "msg"
2021-11-24 23:13:02 +01:00
Christian Kreibich
b999448e3d Minor updates to the external-testsuite scripts
Delete the unused Baseline folder, remove a Bro-era name from gitignore,
change create-new-repo to work with a second argument that is actually
a URL, and tweak whitespace. Expand description in README and update the
explanation of OPENSSL_ENABLE_MD5_VERIFY in subdir-btest.cfg.
2021-09-01 17:29:40 -07:00
Christian Kreibich
c96a177d88 Make update-traces fail when the curl invocation fails 2021-06-02 19:12:46 -07:00
Jon Siwek
23ad81400b Rename aux/ to auxil/
Since "aux" is not an allowed file/dir name on Windows.
2020-06-04 15:18:44 -07:00
Jon Siwek
2107c3e0b7 Extend CI config to cover building with libmaxminddb support 2020-04-28 17:37:31 -07:00
Daniel Thayer
3f9e7138bd More bro-to-zeek renaming in the unit tests 2019-05-16 02:27:54 -05:00
Jon Siwek
1e57e3f026 Use .zeek file suffix in unit tests 2019-04-16 16:08:57 -07:00
Jon Siwek
9f12b56105 Misc. unit test improvements 2018-08-10 16:58:27 -05:00
Daniel Thayer
3584495562 Fix information leak in the update-traces script
For trace files that require authentication to download, hide
part of the URL in output messages.  This avoids leaking potentially
sensitive info when running tests using a continuous integration
service.
2018-03-21 15:24:29 -05:00
Johanna Amann
77c79bd010 Load static CA list for validation tests too.
This fixes test failures in some cases (and should protect against future test failures).
2015-10-02 15:12:32 -04:00
Johanna Amann
236a895418 Update mozilla CA list.
This also patches a few tests to contain certificates that were removed.
Furthermore, we include the old CA file with the external tests and load
it automatically. Those traces are kind of old now, more and more of the
CAs in them are no longer valid and it does not really make sense to
update them on each change...
2015-04-14 16:40:41 -07:00
Robin Sommer
996d118d68 Fixing tests. 2014-08-13 21:33:03 -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
Robin Sommer
4bdac985cb Tweaking logs-to-elasticsearch.bro so that it doesn't do anything if
ES server is unset.
2012-07-28 11:21:20 -07:00
Robin Sommer
99f59dc5c0 Quieting external test output somehwat. 2012-05-14 18:18:30 -07:00
Robin Sommer
83038d78e0 Adding new leak tests involving remote logging. 2012-03-08 17:35:58 -08:00
Robin Sommer
3d2dc5f5fc Merge remote-tracking branch 'origin/topic/script-reference'
* origin/topic/script-reference: (50 commits)
  A few updates for the FAQ.
  Fixing some doc warnings.
  Forgot to add protocol identifier support for TLS 1.2
  Finished SSL & syslog autodocs.
  Adding the draft SSL extension type next_protocol_negotiation.
  Fix some documentation errors.
  Tweaks.
  A set of script-reference polishing.
  fixed a couple typos in comments
  Add summary documentation to bif files.
  Add ssl and syslog script documentation
  Add Conn and DNS protocol script documentation. (fixes #731)
  Small updates to the default local.bro.
  Documentation updates for HTTP & IRC scripts.
  SSH&FTP Documentation updates.
  Fixing a warning from the documentation generation.
  This completes framework documentation package 4.
  Minor notice documentation tweaks.
  Fix some malformed Broxygen xref roles.
  Minor doc tweaks to init-bare.bro.
  ...

Conflicts:
	aux/broccoli
	aux/broctl
	src/bro.bif
	src/strings.bif

Includes:

    - Updated baselines for autodoc tests.
    - Now excluding stats.bro from external texts, it's not stable.
2012-01-10 14:00:44 -08:00
Jon Siwek
ff1768f857 Minor fixes to external test process. (addresses #298)
- Skip diffing of debug.log always.
- Skip diffing of reporter.log if it only contains an error about
  missing GeoIP support.
- Canonicalize X.509 Distinguished Name subjects since that can vary
  depending on installed OpenSSL version.
2011-12-20 11:47:39 -06:00
Robin Sommer
f1e132cd1a Adding missing script. 2011-12-07 10:28:56 -08:00
Robin Sommer
3c2fa085d4 Adapting diff-all so that it expands globs in both current and
baseline directory.

This way, it now spots if a Baseline file isn't produced anymore.

Closes #677.
2011-12-07 10:03:44 -08:00
Jon Siwek
357341c887 Changing some external testing scripts.
- The absolute path canonifier was overzealously canonifying relevant
  log fields, so it's no longer generally applied to diffing all
  baselines.  I don't think there's any logs that require local
  filesystem path names that aren't already tested by a unit test,
  but if any show up in the future, they can be canonified on a
  case-by-case basis.

- Removed some logs from being diff'd in the diff-all script
  because they're either already covered by a unit test
  (load_scripts.log) or because of difficulty/maintainenance
  tradeoff (prof.log).

Baselines for the external bro-testing repo still need updating.
2011-10-04 10:51:41 -05: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
6ffde1abc2 Updating baselines and testing helper script. 2011-09-12 12:12:47 -07:00
Robin Sommer
5e1ec1c50e Fix for proxy usage. 2011-09-09 11:56:44 -07:00
Robin Sommer
3a3f58d5df Bugfix for trace updater. 2011-09-08 19:21:52 -07:00
Robin Sommer
7a989c476d Test infrastructure fixes.
- A new helper script to btest-diff a bunch of files simulatiously.

- Fixes to btest.cfg.

- A few further script updates.
2011-09-08 18:50:51 -07:00
Robin Sommer
bd4a629bef Changes to the testing/external infrastructure.
The traces for external test-suites are no longer kept inside the
repositories themselves but downloaded separately via curl. This is
because git is pretty bad at dealing with large files.

See the README for more information.
2011-09-08 12:36:35 -07:00
Robin Sommer
0291083170 Spelling unification. 2011-08-01 21:03:06 -07:00
Robin Sommer
f95b645dd4 Updatin README. 2011-08-01 20:56:22 -07:00
Robin Sommer
42f214b8d0 Test repository directory names no longer need to end in *.git. 2011-07-09 08:44:29 -07:00
Robin Sommer
c738701ffd Cleaning up some testing stuff.
- The Makefiles now run btest with "-f diag.log" so that diangnostics
  output will always be written into that file.

- Makefiles now hardcode path to btest to avoid picking up the wrong version
  if in PATH.

- The canonifier scripts now live in testing/scripts, and they are
  used from both btest/ and external/.

- There's a new diff-remove-uids scripts that removed connection UIDs
  for diffing. The external/* tests now use that by default.

- Timestamp removal now has its own script: diff-remove-timestamps.
  diff-canonifier calls that.

- All Makefile have a "brief" target that runs btest with -b.

- The higher-level directories have Makefile to call the subdirs.
2011-07-05 18:47:08 -07:00
Robin Sommer
80fcabdb47 Polishing the setup for external tests. 2011-06-30 22:54:25 -07:00
Robin Sommer
6f44fffcea Starting a small framework for doing regression testing with larger
traces and more complex Bro configurations.

That's "Type 2" in the terminology of
http://www-new.bro-ids.org/devel/projects/testing.html

This leverages btest as well and will replace the set of scripts that
the old private test-suite is using. It can accomodate tests with both
public and private traces.

This is a checkpoint commmit, not much there yet in terms of actual
testing. Also still need to figure out a mechanmism to allow for
different baselines based on which branch we're testing.
2011-06-30 16:55:45 -07:00