Commit graph

3882 commits

Author SHA1 Message Date
Johanna Amann
590d4aa13e TLS decryption: add test, fix small issues
Add a test loading keys from an external file. Make some debug messages
slightly better and remove unnecessary debug output.
2022-03-01 17:45:11 +00:00
Vern Paxson
b3ff872bd7 associated btest 2022-02-28 17:38:32 -08:00
Christian Kreibich
19bfa071e0 Expand testcases around is_num(), is_alpha(), is_alnum(), is_ascii() BiFs 2022-02-28 13:09:32 -08:00
Christian Kreibich
40fa1a0769 Merge branch 'topic/christian/controller-renaming'
* topic/christian/controller-renaming:
  Bump external cluster testsuite to reflect Management framework reorg
  Bump zeek-client to reflect Management framework reorg
  Reorg of the cluster controller to new "Management framework" layout
2022-02-10 18:10:08 -08:00
Christian Kreibich
59fa19424d Bump external cluster testsuite to reflect Management framework reorg 2022-02-09 18:09:46 -08:00
Christian Kreibich
54aaf3a623 Reorg of the cluster controller to new "Management framework" layout
- This gives the cluster controller and agent the common name "Management
framework" and changes the start directory of the sources from
"policy/frameworks/cluster" to "policy/frameworks/management". This avoids
ambiguity with the existing cluster framework.

- It renames the "ClusterController" and "ClusterAgent" script modules to
"Management::Controller" and "Management::Agent", respectively. This allows us
to anchor tooling common to both controller and agent at the "Management"
module.

- It moves common configuration settings, logging, requests, types, and
utilities to the common "Management" module.

- It removes the explicit "::Types" submodule (so a request/response result is
now a Management::Result, not a Management::Types::Result), which makes
typenames more readable.

- It updates tests that depend on module naming and full set of scripts.
2022-02-09 18:09:42 -08:00
Christian Kreibich
9a7d5c986e Merge branch 'topic/christian/cluster-controller-get-nodes'
* topic/christian/cluster-controller-get-nodes:
  Bump external cluster testsuite
  Bump zeek-client for the get-nodes command
  Add ClusterController::API::get_nodes_request/response event pair
  Support optional listening ports for cluster nodes
  Don't auto-publish Supervisor response events in the cluster agent
  Make members of the ClusterController::Types::State enum all-caps
  Be more conservative with triggering request timeout events
  Move redefs of ClusterController::Request::Request to their places of use
  Simplify ClusterController::API::set_configuration_request/response
2022-02-03 13:19:34 -08:00
Johanna Amann
b1415dd364 Merge remote-tracking branch 'origin/topic/johanna/gh-1952'
* origin/topic/johanna/gh-1952:
  Match DPD TLS signature on one-sided connections.

Fixes GH-1952
2022-02-03 11:24:34 +00:00
Christian Kreibich
3b79c36146 Bump external cluster testsuite 2022-02-02 23:00:37 -08:00
Robin Sommer
5b1691f162
Merge remote-tracking branch 'origin/topic/zeke/gh-1890'
* origin/topic/zeke/gh-1890:
  Consistently warn about mixing vector and scalar operand depreciaton
2022-02-02 09:46:00 +01:00
Johanna Amann
95f1565498 Match DPD TLS signature on one-sided connections.
This commit changes DPD matching for TLS connections. A one-sided match
is enough to enable DPD now.

This commit also removes DPD for SSLv2 connections. SSLv2 connections do
basically no longer happen in the wild. SSLv2 is also really finnicky to
identify correctly - there is very little data required to match it, and
basically all matches today will be false positives. If DPD for SSLv2 is
still desired, the optional signature in policy/protocols/ssl/dpd-v2.sig
can be loaded.

Fixes GH-1952
2022-02-01 16:51:21 +00:00
Robin Sommer
9b0d525728
Let our TCP-based application analyzers operate without any TCP parent analyzer.
Conceptually, a TCP-based application analyzer should not need any
knowledge about the underlying TCP analysis; it's supposed to just
process its reassembled input stream as it's handed over. But our
analyzers break that assumption at a few places because sometimes
knowledge about the TCP state of the connection can be helpful for
heuristics. This is fine as long as there actually *is* a TCP parent
analyzer available. Sometimes, however, there isn't: if the payload
stream is encapsulated inside another application-layer protocol, the
semantic link to TCP is broken. And if the outer connection is even
UDP, then we don't have a TCP analyzer at all.

We didn't handle this situation well so far. Most analyzers needing
TCP state would just crash if there's no TCP analyzer (in debug mode
with an `assert`, in release mode with a null pointer deref ...). Only
HTTP did the right thing already: check if TCP is available and adapt
accordingly.

We know extend that check to all other analyzers as well: all accesses
to `TCP()` are guarded, with reasonable defaults if not available.
It's actually a pretty small change overall, which is evidence for how
little this layering violation actually matters.

The existing behavior is what's causing
https://github.com/corelight/zeek-spicy-openvpn/issues/3.
2022-01-28 16:25:27 +01:00
Tim Wojtulewicz
0793a38cc5 Merge remote-tracking branch 'origin/topic/vern/vec-slice-bug'
* origin/topic/vern/vec-slice-bug:
  btest to catch vector slice assignment issues
  bug fix for vector slice assignment
2022-01-25 13:52:19 -07:00
Vern Paxson
c378017269 btest to catch vector slice assignment issues 2022-01-25 10:47:33 -08:00
Zeke
7ec2fa2ac9 Consistently warn about mixing vector and scalar operand depreciaton
Resolves #1890
2022-01-21 14:34:48 -08:00
Johanna Amann
796e18ecfc Add intersect operation for bloom filters
Intersecting two bloom filters yields a bloom filter that returns true
when an element was contained in both bloom filters. The false positive
rate is potentially a bit higher than in the original bloom filters.

This operation also works for counting bloom filters, however the
counters are discarded and the bloomfilters are converted to basic bloom
filters. The reason is that there is no obvious meaning to the counters
when two bloom filters are intersected - besides the fact if an element
was inserted at all.
2022-01-20 13:34:07 +00:00
Johanna Amann
aa58b6b37b Add bloomfilter_decrement bif
This bif implements the decrement operation for counting bloom filters.

It also clarifies some of the documentation.
2022-01-18 17:58:10 +00:00
Johanna Amann
b78f30339f TLS decryption: refactoring, more comments, less bare pointers
This commit refactors TLS decryption, adds more comments in scripts and
in C++ source-code, and removes use of bare pointers, instead relying
more on stl data types.
2022-01-17 15:04:44 +00:00
Johanna Amann
689b06d9bd Merge remote-tracking branch 'origin/master' into topic/johanna/tls12-decryption 2022-01-17 10:56:06 +00:00
Johanna Amann
becc966106 Merge remote-tracking branch 'origin/topic/vern/vec-del-bug'
* origin/topic/vern/vec-del-bug:
  new btest to catch regressions to previous behavior/crash
  fix for adding a non-managed type to an empty vector
2022-01-17 10:35:51 +00:00
Vern Paxson
d6a68ada22 new btest to catch regressions to previous behavior/crash 2022-01-14 14:10:15 -08:00
Tim Wojtulewicz
3d9d6e953b Merge remote-tracking branch 'origin/topic/vern/when-lambda'
* origin/topic/vern/when-lambda:
  explicitly provide the frame for evaluating a "when" timeout expression
  attempt to make "when" btest deterministic
  tests for new "when" semantics/errors
  update existing test suite usage of "when" statements to include captures
  update uses of "when" in base scripts to include captures
  captures for "when" statements update Triggers to IntrusivePtr's and simpler AST traversal introduce IDSet type, migrate associated "ID*" types to "const ID*"
  logic (other than in profiling) for assignments that yield separate values
  option for internal use to mark a function type as allowing non-expression returns
  removed some now-obsolete profiling functionality
  minor commenting clarifications
2022-01-14 14:41:42 -07:00
Johanna Amann
543c992e66 Small code fix and test baseline update.
After this, tests hopefully should pass consistently.
2022-01-11 11:20:05 +00:00
Johanna Amann
304a06bb88 Merge remote-tracking branch 'origin/master' into topic/johanna/tls12-decryption 2022-01-11 11:04:20 +00:00
Robin Sommer
964293209b
Merge remote-tracking branch 'origin/topic/robin/gh1844-host'
* origin/topic/robin/gh1844-host:
  Fix host header normalization in intel framework.
  Switch to recording unmodified HTTP header.
2022-01-10 14:43:30 +01:00
Vern Paxson
fa848167bb attempt to make "when" btest deterministic 2022-01-07 21:52:11 -08:00
Vern Paxson
c5ab916710 tests for new "when" semantics/errors 2022-01-07 14:54:47 -08:00
Vern Paxson
b59ee83979 update existing test suite usage of "when" statements to include captures 2022-01-07 14:54:06 -08:00
Tim Wojtulewicz
4c1b3c82d9 Merge remote-tracking branch 'origin/topic/vern/record-constructor-bug'
* origin/topic/vern/record-constructor-bug:
  bug fix for reporting poorly formed record constructors
2022-01-06 15:07:13 -07:00
Vern Paxson
16be867fef test suite alternative baseline fixes for recent test renaming 2022-01-06 13:54:07 -07:00
Tim Wojtulewicz
03b2adb312 Fixed local-compat test and added NEWS section for 5.0 2022-01-05 09:11:45 -07:00
Johanna Amann
d1e7134156 Merge remote-tracking branch 'origin/master' into topic/johanna/tls12-decryption 2022-01-05 10:27:55 +00:00
Christian Kreibich
e0e779ade1 Bump the zeek-testing-cluster testsuite 2022-01-04 16:17:33 -08:00
Tim Wojtulewicz
5400d789fe Merge remote-tracking branch 'origin/topic/vern/local-scope-work'
* origin/topic/vern/local-scope-work:
  added notice of deprecation to NEWS
  test suite update
  deprecation warning on use of out-of-scope local
2022-01-03 13:56:27 -07:00
Tim Wojtulewicz
a75b46bd12 Merge remote-tracking branch 'origin/topic/robin/gh1822-bittorrent-re'
* origin/topic/robin/gh1822-bittorrent-re:
  Switch BitTorrent analyzer to Zeek's regex engine
  Adding test for BitTorrent tracker.
2022-01-03 13:55:18 -07:00
Vern Paxson
38c6c8f073 test suite update 2021-12-25 16:04:08 -08:00
Vern Paxson
4f566f35ee bug fix for reporting poorly formed record constructors 2021-12-22 14:26:03 -08:00
Avinal Kumar
c2cff6dac7
Switch BitTorrent analyzer to Zeek's regex engine
- Removes dependency on <regex.h>
- Replaces regex function with Zeek's standard regex functions
- Some replacements are workaround, may be improved later via an
appropiate API
- Update test baseline to fix what seems to be capturing on a bug in the
existing code.

Edit pass by Robin Sommer. Note that our test doesn't cover all the code
paths, but it does go through the one with the most substantial change.
2021-12-22 08:24:27 +01:00
Christian Kreibich
a56ee6b9a6 Add separate utility module for controller and agent
We can figure out later whether & where to re-settle helper functions that end
up in there.
2021-12-21 14:52:28 -08:00
Christian Kreibich
e9bdaebc70 Add Github action job for cluster tests
This job runs in sequence after the image build one, using its resulting image.
The actual tests live in the external zeek-testing-cluster testsuite, which
the new job clones and runs.

To specify a version of the testsuite to use, testing/external/ has a new
commit-hash.zeek-testing-cluster file that tracks the testsuite's relevant
commit ref
2021-12-21 14:52:28 -08:00
Robin Sommer
a7427e95bf
Switch to recording unmodified HTTP header.
We used to attempt to remove any port specification before recording
HTTP host headers in logs. Doing so would (1) remove potentially useful
information, (2) not match what the documentation seemed to suggest, and
(3) fail for IP6 addresses containing colons.

We now record the original HOST header as is.

Addresses #1844.
2021-12-21 21:54:47 +01:00
Robin Sommer
0507f6005c
Adding test for BitTorrent tracker.
Our test trace is extracted from https://www.cloudshark.org/captures/b9089aac6eee.

There actually seems to be a bug in the existing code: the URI passed to
bt_tracker_request() includes a partial HTTP version. This commits
includes the baseline as the current code produces it, we'll fix that in
a subsequent comment.
2021-12-21 17:48:26 +01:00
Vern Paxson
77f6a658e6 additional test suite updates for "-u" usage issues 2021-12-14 15:35:24 -08:00
Vern Paxson
dff664dc1f test suite updates for "xform" and "usage" alternatives, plus test name change 2021-12-14 12:50:17 -08:00
Vern Paxson
deb518588a fix typo in btest filename 2021-12-14 11:33:21 -08:00
Tim Wojtulewicz
7de9a7d76f GH-1860: Add double_to_int() bif 2021-12-13 10:46:14 -07:00
Vern Paxson
a0e7feda6f btests for new --optimize-funcs and --optimize-files 2021-12-10 13:02:52 -08:00
Vern Paxson
267f5461d8 update btest to no longer use (unsupported) %S formatting, no longer needed 2021-12-10 12:46:07 -08:00
Tim Wojtulewicz
c105cbad6e Merge remote-tracking branch 'origin/topic/vern/ZAM-maint'
* origin/topic/vern/ZAM-maint:
  updates to ZAM to track recent changes in script semantics
2021-12-10 13:11:20 -07:00
Tim Wojtulewicz
7a6a81c200 Merge remote-tracking branch 'origin/topic/timw/1740-table-key-error'
* origin/topic/timw/1740-table-key-error:
  GH-1741: Print error if calling a non-hook with hook keyword
  GH-1740: Report a better error message if table key is not a list
2021-12-10 09:28:34 -07:00